Tizen 2.1 base
authorJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:49:23 +0000 (01:49 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:49:23 +0000 (01:49 +0900)
130 files changed:
AUTHORS [new file with mode: 0644]
INSTALL [new file with mode: 0644]
LICENSE.LGPLv2.1 [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
NOTICE [new file with mode: 0644]
PLUGINS [new file with mode: 0644]
README [new file with mode: 0644]
audioeq/Makefile.am [new file with mode: 0755]
audioeq/src/Makefile.am [new file with mode: 0755]
audioeq/src/gstaudioeq.c [new file with mode: 0644]
audioeq/src/gstaudioeq.h [new file with mode: 0644]
audiotp/Makefile.am [new file with mode: 0755]
audiotp/src/Makefile.am [new file with mode: 0755]
audiotp/src/gstaudiotp.c [new file with mode: 0644]
audiotp/src/gstaudiotp.h [new file with mode: 0755]
autogen.sh [new file with mode: 0755]
autoregen.sh [new file with mode: 0755]
avsystem/Makefile.am [new file with mode: 0644]
avsystem/src/Makefile.am [new file with mode: 0644]
avsystem/src/gstavsysaudiosink.c [new file with mode: 0644]
avsystem/src/gstavsysaudiosink.h [new file with mode: 0644]
avsystem/src/gstavsysaudiosrc.c [new file with mode: 0644]
avsystem/src/gstavsysaudiosrc.h [new file with mode: 0644]
avsystem/src/gstavsysmemsink.c [new file with mode: 0644]
avsystem/src/gstavsysmemsink.h [new file with mode: 0644]
avsystem/src/gstavsyssink.c [new file with mode: 0644]
avsystem/src/gstavsyssrc.c [new file with mode: 0644]
common/ChangeLog [new file with mode: 0755]
common/Makefile.am [new file with mode: 0644]
common/c-to-xml.py [new file with mode: 0755]
common/check-exports [new file with mode: 0755]
common/check.mak [new file with mode: 0755]
common/coverage/coverage-report-entry.pl [new file with mode: 0755]
common/coverage/coverage-report.pl [new file with mode: 0755]
common/coverage/coverage-report.xsl [new file with mode: 0755]
common/coverage/lcov.mak [new file with mode: 0755]
common/gettext.patch [new file with mode: 0755]
common/glib-gen.mak [new file with mode: 0755]
common/gst-autogen.sh [new file with mode: 0755]
common/gst-xmlinspect.py [new file with mode: 0755]
common/gst.supp [new file with mode: 0755]
common/gstdoc-scangobj [new file with mode: 0755]
common/gtk-doc-plugins.mak [new file with mode: 0755]
common/gtk-doc.mak [new file with mode: 0755]
common/m4/Makefile.am [new file with mode: 0644]
common/m4/README [new file with mode: 0755]
common/m4/as-ac-expand.m4 [new file with mode: 0755]
common/m4/as-auto-alt.m4 [new file with mode: 0755]
common/m4/as-compiler-flag.m4 [new file with mode: 0755]
common/m4/as-compiler.m4 [new file with mode: 0755]
common/m4/as-docbook.m4 [new file with mode: 0755]
common/m4/as-gcc-inline-assembly.m4 [new file with mode: 0755]
common/m4/as-libtool-tags.m4 [new file with mode: 0755]
common/m4/as-libtool.m4 [new file with mode: 0755]
common/m4/as-python.m4 [new file with mode: 0755]
common/m4/as-scrub-include.m4 [new file with mode: 0755]
common/m4/as-version.m4 [new file with mode: 0755]
common/m4/ax_create_stdint_h.m4 [new file with mode: 0755]
common/m4/check.m4 [new file with mode: 0755]
common/m4/gettext.m4 [new file with mode: 0755]
common/m4/glib-gettext.m4 [new file with mode: 0755]
common/m4/gst-arch.m4 [new file with mode: 0755]
common/m4/gst-args.m4 [new file with mode: 0755]
common/m4/gst-check.m4 [new file with mode: 0755]
common/m4/gst-debuginfo.m4 [new file with mode: 0755]
common/m4/gst-default.m4 [new file with mode: 0755]
common/m4/gst-doc.m4 [new file with mode: 0755]
common/m4/gst-error.m4 [new file with mode: 0755]
common/m4/gst-feature.m4 [new file with mode: 0755]
common/m4/gst-function.m4 [new file with mode: 0755]
common/m4/gst-gettext.m4 [new file with mode: 0755]
common/m4/gst-glib2.m4 [new file with mode: 0755]
common/m4/gst-libxml2.m4 [new file with mode: 0755]
common/m4/gst-parser.m4 [new file with mode: 0755]
common/m4/gst-plugin-docs.m4 [new file with mode: 0755]
common/m4/gst-plugindir.m4 [new file with mode: 0755]
common/m4/gst-valgrind.m4 [new file with mode: 0755]
common/m4/gst.m4 [new file with mode: 0755]
common/m4/gtk-doc.m4 [new file with mode: 0755]
common/m4/iconv.m4 [new file with mode: 0755]
common/m4/isc-posix.m4 [new file with mode: 0755]
common/m4/lib-ld.m4 [new file with mode: 0755]
common/m4/lib-link.m4 [new file with mode: 0755]
common/m4/lib-prefix.m4 [new file with mode: 0755]
common/m4/libtool.m4 [new file with mode: 0644]
common/m4/ltoptions.m4 [new file with mode: 0644]
common/m4/ltsugar.m4 [new file with mode: 0644]
common/m4/ltversion.m4 [new file with mode: 0644]
common/m4/lt~obsolete.m4 [new file with mode: 0644]
common/m4/pkg.m4 [new file with mode: 0755]
common/m4/progtest.m4 [new file with mode: 0755]
common/mangle-tmpl.py [new file with mode: 0755]
common/plugins.xsl [new file with mode: 0755]
common/po.mak [new file with mode: 0755]
common/release.mak [new file with mode: 0755]
common/scangobj-merge.py [new file with mode: 0755]
common/upload.mak [new file with mode: 0755]
common/win32.mak [new file with mode: 0755]
configure.ac [new file with mode: 0755]
drmsrc/Makefile.am [new file with mode: 0755]
drmsrc/src/Makefile.am [new file with mode: 0755]
drmsrc/src/gstdrmsrc.c [new file with mode: 0644]
drmsrc/src/gstdrmsrc.h [new file with mode: 0755]
encodebin/Makefile.am [new file with mode: 0644]
encodebin/src/Makefile.am [new file with mode: 0644]
encodebin/src/gstencodebin.c [new file with mode: 0644]
encodebin/src/gstencodebin.h [new file with mode: 0644]
evasimagesink/Makefile.am [new file with mode: 0644]
evasimagesink/src/Makefile.am [new file with mode: 0644]
evasimagesink/src/gstevasimagesink.c [new file with mode: 0644]
evasimagesink/src/gstevasimagesink.h [new file with mode: 0644]
gst-autogen.sh [new file with mode: 0755]
gst-plugins-ext0.10.manifest [new file with mode: 0755]
m4/Makefile.am [new file with mode: 0644]
m4/as-compiler-flag.m4 [new file with mode: 0755]
m4/as-version.m4 [new file with mode: 0755]
packaging/gst-plugins-ext0.10.spec [new file with mode: 0644]
pdpushsrc/Makefile.am [new file with mode: 0755]
pdpushsrc/src/Makefile.am [new file with mode: 0755]
pdpushsrc/src/gstpdpushsrc.c [new file with mode: 0644]
pdpushsrc/src/gstpdpushsrc.h [new file with mode: 0755]
toggle/Makefile.am [new file with mode: 0755]
toggle/src/Makefile.am [new file with mode: 0755]
toggle/src/gsttoggle.c [new file with mode: 0755]
toggle/src/gsttoggle.h [new file with mode: 0755]
xvimagesrc/Makefile.am [new file with mode: 0644]
xvimagesrc/src/Makefile.am [new file with mode: 0644]
xvimagesrc/src/gstxvimagesrc.c [new file with mode: 0755]
xvimagesrc/src/gstxvimagesrc.h [new file with mode: 0755]
xvimagesrc/src/xv_types.h [new file with mode: 0755]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..6f522a8
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,5 @@
+JongHyuk Choi <jhchoi.choi at samsung dot com>
+Seungbae Shin <seungbae.shin at samsung dot com>
+Younghwan Ahn <younghwan_.an at samsung dot com>
+Jeongmo Yang <jm80.yang at samsung dot com>
+Sangchul Lee <sc11.lee at samsung dot com>
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..23e5f25
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,236 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).  Here is a another example:
+
+     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/LICENSE.LGPLv2.1 b/LICENSE.LGPLv2.1
new file mode 100644 (file)
index 0000000..8add30a
--- /dev/null
@@ -0,0 +1,504 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE
+                      Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                 GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                           NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..0673794
--- /dev/null
@@ -0,0 +1,78 @@
+
+ACLOCAL_AMFLAGS = -I common/m4
+
+aclocaldir = $(datadir)/aclocal
+
+SUBDIRS = common
+
+if GST_EXT_USE_EXT_ENCODEBIN
+SUBDIRS += encodebin
+endif
+
+if GST_EXT_USE_EXT_AVSYSTEM
+SUBDIRS += avsystem
+endif
+
+if GST_EXT_USE_EXT_EVASIMAGESINK
+SUBDIRS += evasimagesink
+endif
+
+if GST_EXT_USE_EXT_XVIMAGESRC
+SUBDIRS += xvimagesrc
+endif
+
+if GST_EXT_USE_EXT_DRMSRC
+SUBDIRS += drmsrc
+endif
+
+if GST_EXT_USE_EXT_TOGGLE
+SUBDIRS += toggle
+endif
+
+if GST_EXT_USE_EXT_AVSYSTEM
+SUBDIRS += pdpushsrc
+endif
+
+if GST_EXT_USE_EXT_AUDIOTP
+SUBDIRS += audiotp
+endif
+
+if GST_EXT_USE_EXT_AUDIOEQ
+SUBDIRS += audioeq
+endif
+
+DIST_SUBDIRS = common
+
+if GST_EXT_USE_EXT_ENCODEBIN
+DIST_SUBDIRS += encodebin
+endif
+
+if GST_EXT_USE_EXT_AVSYSTEM
+DIST_SUBDIRS += avsystem
+endif
+
+if GST_EXT_USE_EXT_EVASIMAGESINK
+DIST_SUBDIRS += evasimagesink
+endif
+
+if GST_EXT_USE_EXT_XVIMAGESRC
+DIST_SUBDIRS += xvimagesrc
+endif
+
+if GST_EXT_USE_EXT_DRMSRC
+DIST_SUBDIRS += drmsrc
+endif
+
+if GST_EXT_USE_EXT_TOGGLE
+DIST_SUBDIRS += toggle
+endif
+
+
+EXTRA_DIST = \
+       gstreamer.spec gstreamer.spec.in \
+       configure.ac autogen.sh depcomp \
+       MAINTAINERS ABOUT-NLS RELEASE gstreamer.doap \
+       $(win32)
+
+check: check-exports
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..0e6ffbb
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under GNU LESSER GENERAL PUBLIC LICENSE, Version 2.1
+Please, see the LICENSE file for GNU LESSER GENERAL PUBLIC LICENSE terms and conditions.
diff --git a/PLUGINS b/PLUGINS
new file mode 100644 (file)
index 0000000..a737f3a
--- /dev/null
+++ b/PLUGINS
@@ -0,0 +1,15 @@
+# This file is descriptions of the plugins which are included in gstreamer0.10-plugins-ext.
+# If any plugin is added to the gstreamer0.10-plugins-ext, that shoud be described in this file.
+#
+#
+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+PLUGIN                 Registered Elements                                                             Description
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+avsysaudiosrc          avsysaudiosrc                                                   AV system audio source plugin
+avsyssink              avsysaudiosink, avsysmemsink                                    AV system audio sink plugin
+drmsrc                 drmsrc                                                          Plugin to read data from standad/DRM file
+encodebin              encodebin                                                       Extension encoder bin plugin
+evasimagesink          evasimagesink                                                   Evas video sink plugin
+toggle                 toggle                                                          Base transform plugin
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..9681276
--- /dev/null
+++ b/README
@@ -0,0 +1,12 @@
+gst-plugin is a template for writing your own GStreamer plug-in.
+
+The code is deliberately kept simple so that you quickly understand the basics
+of how to set up autotools and your source tree.
+
+This template demonstrates :
+- what to do in autogen.sh
+- how to setup configure.ac (your package name and version, GStreamer flags)
+- how to setup your source dir
+- what to put in Makefile.am
+
+More features might get added to this template later on.
diff --git a/audioeq/Makefile.am b/audioeq/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/audioeq/src/Makefile.am b/audioeq/src/Makefile.am
new file mode 100755 (executable)
index 0000000..6981e78
--- /dev/null
@@ -0,0 +1,28 @@
+# plugindir is set in configure
+
+##############################################################################
+# change libgstplugin.la to something more suitable, e.g. libmysomething.la  #
+##############################################################################
+plugin_LTLIBRARIES = libgstaudioeq.la
+
+##############################################################################
+# for the next set of variables, rename the prefix if you renamed the .la,   #
+#  e.g. libgstplugin_la_SOURCES => libmysomething_la_SOURCES                 #
+#       libgstplugin_la_CFLAGS  => libmysomething_la_CFLAGS                  #
+#       libgstplugin_la_LIBADD  => libmysomething_la_LIBADD                  #
+#       libgstplugin_la_LDFLAGS => libmysomething_la_LDFLAGS                 #
+##############################################################################
+
+# sources used to compile this plug-in
+libgstaudioeq_la_SOURCES = gstaudioeq.c
+
+# flags used to compile this plugin
+# add other _CFLAGS and _LIBS as needed
+libgstaudioeq_la_CFLAGS = $(GST_CFLAGS)  $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CONTROLLER_CFLAGS)
+libgstaudioeq_la_LIBADD = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(GST_BASE_LIBS) $(GST_CONTROLLER_LIBS) $(GST_LIBS) $(LIBM) -lgstbase-0.10  -lglib-2.0 -lgstcontroller-0.10
+libgstaudioeq_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+libgstequalizer_la_LIBTOOLFLAGS = --tag=disable-static
+
+# headers we need but don't want installed
+noinst_HEADERS = gstaudioeq.h
diff --git a/audioeq/src/gstaudioeq.c b/audioeq/src/gstaudioeq.c
new file mode 100644 (file)
index 0000000..9185861
--- /dev/null
@@ -0,0 +1,1313 @@
+/*
+ * audioeq
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Aditi Narula <aditi.n@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gstaudioeq.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_audioeq_debug);
+#define GST_CAT_DEFAULT gst_audioeq_debug
+
+#define AUDIOEQ_ENABLE_DUMP
+#define AUDIOEQ_REDUCE_MEMCPY
+
+/* Filter signals and args */
+enum
+{
+       /* FILL ME */
+       LAST_SIGNAL
+};
+
+enum
+{
+       PROP_0,
+       PROP_FILTER_ACTION,
+       PROP_CUSTOM_EQ,
+       PROP_CUSTOM_EQ_NUM,
+       PROP_CUSTOM_EQ_FREQ,
+       PROP_CUSTOM_EQ_WIDTH,
+};
+
+enum FilterActionType
+{
+       FILTER_NONE,
+       FILTER_PRESET,
+       FILTER_ADVANCED_SETTING
+};
+
+enum SampleRate
+{
+       SAMPLERATE_48000Hz,
+       SAMPLERATE_44100Hz,
+       SAMPLERATE_32000Hz,
+       SAMPLERATE_24000Hz,
+       SAMPLERATE_22050Hz,
+       SAMPLERATE_16000Hz,
+       SAMPLERATE_12000Hz,
+       SAMPLERATE_11025Hz,
+       SAMPLERATE_8000Hz,
+
+       SAMPLERATE_NUM
+};
+
+#define DEFAULT_SAMPLE_SIZE                    2
+#define DEFAULT_VOLUME                                 15
+#define DEFAULT_GAIN                                   1
+#define DEFAULT_SAMPLE_RATE                    SAMPLERATE_44100Hz
+#define DEAFULT_CHANNELS                               2
+#define DEFAULT_FILTER_ACTION                  FILTER_NONE
+#define DEFAULT_CUSTOM_EQ_NUM          7
+
+static GstStaticPadTemplate sinktemplate =
+       GST_STATIC_PAD_TEMPLATE(
+               "sink",
+               GST_PAD_SINK,
+               GST_PAD_ALWAYS,
+               GST_STATIC_CAPS (
+                       "audio/x-raw-int, "
+                       "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
+                       "signed = (boolean) true, "
+                       "width = (int) 16, "
+                       "depth = (int) 16, "
+                       "channels = (int) [1,2]"
+                       )
+       );
+
+static GstStaticPadTemplate srctemplate =
+       GST_STATIC_PAD_TEMPLATE(
+               "src",
+               GST_PAD_SRC,
+               GST_PAD_ALWAYS,
+               GST_STATIC_CAPS (
+                       "audio/x-raw-int, "
+                       "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
+                       "signed = (boolean) true, "
+                       "width = (int) 16, "
+                       "depth = (int) 16, "
+                       "channels = (int) [1,2]"
+                       )
+       );
+
+static void gst_iir_equalizer_child_proxy_interface_init (gpointer g_iface,
+    gpointer iface_data);
+
+static void gst_iir_equalizer_finalize (GObject * object);
+
+static gboolean gst_iir_equalizer_setup (GstAudioFilter * filter,
+    GstRingBufferSpec * fmt);
+
+static void
+_do_init (GType object_type)
+{
+  const GInterfaceInfo child_proxy_interface_info = {
+    (GInterfaceInitFunc) gst_iir_equalizer_child_proxy_interface_init,
+    NULL,                       /* interface_finalize */
+    NULL                        /* interface_data */
+  };
+
+  g_type_add_interface_static (object_type, GST_TYPE_CHILD_PROXY,
+      &child_proxy_interface_info);
+}
+
+GST_BOILERPLATE_FULL(Gstaudioeq, gst_audioeq, GstBaseTransform, GST_TYPE_BASE_TRANSFORM,_do_init);
+
+static void gst_audioeq_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_audioeq_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
+#ifdef AUDIOEQ_REDUCE_MEMCPY
+static GstFlowReturn gst_audioeq_transform_ip (GstBaseTransform * base, GstBuffer * buf);
+#else
+static GstFlowReturn gst_audioeq_transform (GstBaseTransform * base, GstBuffer * inbuf, GstBuffer * outbuf);
+#endif
+static gboolean gst_audioeq_set_caps (GstBaseTransform * base, GstCaps * incaps, GstCaps * outcaps);
+
+static GstStateChangeReturn
+gst_audioeq_change_state (GstElement * element, GstStateChange transition)
+{
+  GST_DEBUG ("gst_audioeq_change_state");
+       GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+       Gstaudioeq *audioeq = GST_AUDIOEQ (element);
+
+       switch (transition) {
+       case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+               audioeq->need_update_filter = TRUE;
+               break;
+       default:
+               break;
+       }
+
+       ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+       if (ret == GST_STATE_CHANGE_FAILURE)
+               return ret;
+
+       switch (transition) {
+       case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+               break;
+       default:
+               break;
+       }
+
+       return ret;
+}
+
+static void
+gst_audioeq_base_init (gpointer gclass)
+{
+
+  GST_DEBUG ("gst_audioeq_base_init");
+       static GstElementDetails element_details = {
+               "Audio Equalizer",
+               "Filter/Effect/Audio",
+               "Set equalisation effect on audio/raw streams",
+               "Samsung Electronics <www.samsung.com>"
+       };
+
+       GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
+
+       gst_element_class_add_pad_template(element_class,
+               gst_static_pad_template_get (&srctemplate));
+       gst_element_class_add_pad_template(element_class,
+               gst_static_pad_template_get (&sinktemplate));
+
+       gst_element_class_set_details(element_class, &element_details);
+}
+
+static void
+gst_audioeq_class_init (GstaudioeqClass * klass)
+{
+       GST_DEBUG ("gst_audioeq_class_init");
+       GObjectClass *gobject_class;
+       GstElementClass *gstelement_class;
+       GstBaseTransformClass *basetransform_class;
+
+       gobject_class = G_OBJECT_CLASS (klass);
+       gstelement_class = GST_ELEMENT_CLASS (klass);
+       basetransform_class = GST_BASE_TRANSFORM_CLASS(klass);
+
+       gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_audioeq_set_property);
+       gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_audioeq_get_property);
+
+       gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_audioeq_change_state);
+
+       g_object_class_install_property(gobject_class, PROP_FILTER_ACTION,
+               g_param_spec_uint("filter-action", "filter action", "(0)none (1)preset (2)advanced setting",
+               0, 2, DEFAULT_FILTER_ACTION, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_class, PROP_CUSTOM_EQ,
+               g_param_spec_pointer("custom-eq", "custom eq",
+               "pointer for 9 bands of EQ array", G_PARAM_READWRITE));
+
+       g_object_class_install_property(gobject_class, PROP_CUSTOM_EQ_NUM,
+               g_param_spec_uint("custom-eq-num", "custom eq num", "number of custom EQ bands",
+               0, 9, DEFAULT_CUSTOM_EQ_NUM, G_PARAM_READABLE));
+
+       g_object_class_install_property(gobject_class, PROP_CUSTOM_EQ_FREQ,
+               g_param_spec_pointer("custom-eq-freq", "custom eq freq", "pointer for EQ bands central frequency(Hz) array",
+               G_PARAM_READABLE));
+
+       g_object_class_install_property(gobject_class, PROP_CUSTOM_EQ_WIDTH,
+               g_param_spec_pointer("custom-eq-width", "custom eq width", "pointer for EQ bands width(Hz) array",
+               G_PARAM_READABLE));
+
+       gobject_class->finalize = GST_DEBUG_FUNCPTR(gst_iir_equalizer_finalize);
+
+/* It is possible to reduce memcpy by setting output same as input of AudioEq_InOutConfig */
+#ifdef AUDIOEQ_REDUCE_MEMCPY
+       basetransform_class->transform_ip = GST_DEBUG_FUNCPTR(gst_audioeq_transform_ip);
+#endif
+       basetransform_class->set_caps = GST_DEBUG_FUNCPTR(gst_audioeq_set_caps);
+}
+
+static void
+gst_audioeq_init (Gstaudioeq * audioeq, GstaudioeqClass * gclass)
+{
+  GST_DEBUG ("gst_audioeq_init");
+       audioeq->samplerate = DEFAULT_SAMPLE_RATE;
+       audioeq->channels = DEAFULT_CHANNELS;
+
+       audioeq->filter_action = DEFAULT_FILTER_ACTION;
+       memset(audioeq->custom_eq, 0x00, sizeof(gint) * CUSTOM_EQ_BAND_MAX);
+       audioeq->need_update_filter = TRUE;
+       audioeq->equ.bands_lock = g_mutex_new ();
+       audioeq->equ.need_new_coefficients = TRUE;
+       gst_iir_equalizer_compute_frequencies (audioeq, DEFAULT_CUSTOM_EQ_NUM);
+}
+/* equalizer implementation */
+
+static void
+gst_iir_equalizer_finalize (GObject * object)
+{
+  GST_DEBUG ("gst_iir_equalizer_finalize");
+  Gstaudioeq *audioeq = GST_AUDIOEQ(object);
+  GstIirEqualizer *equ = &audioeq->equ;
+  gint i;
+
+  for (i = 0; i < equ->freq_band_count; i++) {
+    if (equ->bands[i])
+      gst_object_unparent (GST_OBJECT (equ->bands[i]));
+    equ->bands[i] = NULL;
+  }
+  equ->freq_band_count = 0;
+
+  g_free (equ->bands);
+  g_free (equ->history);
+
+  g_mutex_free (equ->bands_lock);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+#define BANDS_LOCK(equ) g_mutex_lock(equ->bands_lock)
+#define BANDS_UNLOCK(equ) g_mutex_unlock(equ->bands_lock)
+
+/* child object */
+
+enum
+{
+  PROP_GAIN = 1,
+  PROP_FREQ,
+  PROP_BANDWIDTH,
+  PROP_TYPE
+};
+
+typedef enum
+{
+  BAND_TYPE_PEAK = 0,
+  BAND_TYPE_LOW_SHELF,
+  BAND_TYPE_HIGH_SHELF
+} GstIirEqualizerBandType;
+
+#define GST_TYPE_IIR_EQUALIZER_BAND_TYPE (gst_iir_equalizer_band_type_get_type ())
+static GType
+gst_iir_equalizer_band_type_get_type (void)
+{
+  GST_DEBUG ("gst_iir_equalizer_band_type_get_type");
+  static GType gtype = 0;
+
+  if (gtype == 0) {
+    static const GEnumValue values[] = {
+      {BAND_TYPE_PEAK, "Peak filter (default for inner bands)", "peak"},
+      {BAND_TYPE_LOW_SHELF, "Low shelf filter (default for first band)",
+          "low-shelf"},
+      {BAND_TYPE_HIGH_SHELF, "High shelf filter (default for last band)",
+          "high-shelf"},
+      {0, NULL, NULL}
+    };
+
+    gtype = g_enum_register_static ("GstIirEqualizerBandType", values);
+  }
+  return gtype;
+}
+
+
+typedef struct _GstIirEqualizerBandClass GstIirEqualizerBandClass;
+
+#define GST_TYPE_IIR_EQUALIZER_BAND \
+  (gst_iir_equalizer_band_get_type())
+#define GST_IIR_EQUALIZER_BAND(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IIR_EQUALIZER_BAND,GstIirEqualizerBand))
+#define GST_IIR_EQUALIZER_BAND_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IIR_EQUALIZER_BAND,GstIirEqualizerBandClass))
+#define GST_IS_IIR_EQUALIZER_BAND(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_IIR_EQUALIZER_BAND))
+#define GST_IS_IIR_EQUALIZER_BAND_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_IIR_EQUALIZER_BAND))
+
+struct _GstIirEqualizerBand
+{
+  GstObject object;
+
+  /*< private > */
+  /* center frequency and gain */
+  gdouble freq;
+  gdouble gain;
+  gdouble width;
+  GstIirEqualizerBandType type;
+
+  /* second order iir filter */
+  gdouble b1, b2;               /* IIR coefficients for outputs */
+  gdouble a0, a1, a2;           /* IIR coefficients for inputs */
+};
+
+struct _GstIirEqualizerBandClass
+{
+  GstObjectClass parent_class;
+};
+
+static GType gst_iir_equalizer_band_get_type (void);
+
+static void
+gst_iir_equalizer_band_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GST_DEBUG ("gst_iir_equalizer_band_set_property");
+  GstIirEqualizerBand *band = GST_IIR_EQUALIZER_BAND (object);
+  Gstaudioeq *audioeq = GST_AUDIOEQ (gst_object_get_parent (GST_OBJECT (band)));
+  GstIirEqualizer *equ = &audioeq->equ;
+
+  switch (prop_id) {
+    case PROP_GAIN:{
+      gdouble gain;
+
+      gain = g_value_get_double (value);
+      GST_DEBUG_OBJECT (band, "gain = %lf -> %lf", band->gain, gain);
+      if (gain != band->gain) {
+        BANDS_LOCK (equ);
+        equ->need_new_coefficients = TRUE;
+        band->gain = gain;
+        BANDS_UNLOCK (equ);
+        GST_DEBUG_OBJECT (band, "changed gain = %lf ", band->gain);
+      }
+      break;
+    }
+    case PROP_FREQ:{
+      gdouble freq;
+
+      freq = g_value_get_double (value);
+      GST_DEBUG_OBJECT (band, "freq = %lf -> %lf", band->freq, freq);
+      if (freq != band->freq) {
+        BANDS_LOCK (equ);
+        equ->need_new_coefficients = TRUE;
+        band->freq = freq;
+        BANDS_UNLOCK (equ);
+        GST_DEBUG_OBJECT (band, "changed freq = %lf ", band->freq);
+      }
+      break;
+    }
+    case PROP_BANDWIDTH:{
+      gdouble width;
+
+      width = g_value_get_double (value);
+      GST_DEBUG_OBJECT (band, "width = %lf -> %lf", band->width, width);
+      if (width != band->width) {
+        BANDS_LOCK (equ);
+        equ->need_new_coefficients = TRUE;
+        band->width = width;
+        BANDS_UNLOCK (equ);
+        GST_DEBUG_OBJECT (band, "changed width = %lf ", band->width);
+      }
+      break;
+    }
+    case PROP_TYPE:{
+      GstIirEqualizerBandType type;
+
+      type = g_value_get_enum (value);
+      GST_DEBUG_OBJECT (band, "type = %d -> %d", band->type, type);
+      if (type != band->type) {
+        BANDS_LOCK (equ);
+        equ->need_new_coefficients = TRUE;
+        band->type = type;
+        BANDS_UNLOCK (equ);
+        GST_DEBUG_OBJECT (band, "changed type = %d ", band->type);
+      }
+      break;
+    }
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+
+  gst_object_unref (audioeq);
+}
+
+static void
+gst_iir_equalizer_band_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GST_DEBUG ("gst_iir_equalizer_band_get_property");
+  GstIirEqualizerBand *band = GST_IIR_EQUALIZER_BAND (object);
+
+  switch (prop_id) {
+    case PROP_GAIN:
+      g_value_set_double (value, band->gain);
+      break;
+    case PROP_FREQ:
+      g_value_set_double (value, band->freq);
+      break;
+    case PROP_BANDWIDTH:
+      g_value_set_double (value, band->width);
+      break;
+    case PROP_TYPE:
+      g_value_set_enum (value, band->type);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_iir_equalizer_band_class_init (GstIirEqualizerBandClass * klass)
+{
+  GST_DEBUG ("gst_iir_equalizer_band_class_init");
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  gobject_class->set_property = gst_iir_equalizer_band_set_property;
+  gobject_class->get_property = gst_iir_equalizer_band_get_property;
+
+  g_object_class_install_property (gobject_class, PROP_GAIN,
+      g_param_spec_double ("gain", "gain",
+          "gain for the frequency band ranging from -12.0 dB to +12.0 dB",
+          -12.0, 12.0, 0.0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
+
+  g_object_class_install_property (gobject_class, PROP_FREQ,
+      g_param_spec_double ("freq", "freq",
+          "center frequency of the band",
+          0.0, 100000.0, 0.0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
+
+  g_object_class_install_property (gobject_class, PROP_BANDWIDTH,
+      g_param_spec_double ("bandwidth", "bandwidth",
+          "difference between bandedges in Hz",
+          0.0, 100000.0, 1.0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
+
+  g_object_class_install_property (gobject_class, PROP_TYPE,
+      g_param_spec_enum ("type", "Type",
+          "Filter type", GST_TYPE_IIR_EQUALIZER_BAND_TYPE,
+          BAND_TYPE_PEAK,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
+}
+
+static void
+gst_iir_equalizer_band_init (GstIirEqualizerBand * band,
+    GstIirEqualizerBandClass * klass)
+{
+  GST_DEBUG ("gst_iir_equalizer_band_init");
+  band->freq = 0.0;
+  band->gain = 0.0;
+  band->width = 1.0;
+  band->type = BAND_TYPE_PEAK;
+}
+
+static GType
+gst_iir_equalizer_band_get_type (void)
+{
+  GST_DEBUG ("gst_iir_equalizer_band_get_type");
+  static GType type = 0;
+
+  if (G_UNLIKELY (!type)) {
+    const GTypeInfo type_info = {
+      sizeof (GstIirEqualizerBandClass),
+      NULL,
+      NULL,
+      (GClassInitFunc) gst_iir_equalizer_band_class_init,
+      NULL,
+      NULL,
+      sizeof (GstIirEqualizerBand),
+      0,
+      (GInstanceInitFunc) gst_iir_equalizer_band_init,
+    };
+    type =
+        g_type_register_static (GST_TYPE_OBJECT, "GstIirEqualizerBand",
+        &type_info, 0);
+  }
+  return (type);
+}
+
+
+/* child proxy iface */
+static GstObject *
+gst_iir_equalizer_child_proxy_get_child_by_index (GstChildProxy * child_proxy,
+    guint index)
+{
+  GST_DEBUG ("gst_iir_equalizer_child_proxy_get_child_by_index");
+  Gstaudioeq *audioeq = GST_AUDIOEQ(child_proxy);
+  GstIirEqualizer *equ = &audioeq->equ;
+  GstObject *ret;
+
+  BANDS_LOCK (equ);
+  if (G_UNLIKELY (index >= equ->freq_band_count)) {
+    BANDS_UNLOCK (equ);
+    g_return_val_if_fail (index < equ->freq_band_count, NULL);
+  }
+
+  ret = gst_object_ref (equ->bands[index]);
+  BANDS_UNLOCK (equ);
+
+  GST_LOG_OBJECT (equ, "return child[%d] %" GST_PTR_FORMAT, index, ret);
+  return ret;
+}
+
+static guint
+gst_iir_equalizer_child_proxy_get_children_count (GstChildProxy * child_proxy)
+{
+  GST_DEBUG ("gst_iir_equalizer_child_proxy_get_children_count");
+  Gstaudioeq *audioeq = GST_AUDIOEQ(child_proxy);
+  GstIirEqualizer *equ = &audioeq->equ;
+
+  GST_LOG ("we have %d children", equ->freq_band_count);
+  return equ->freq_band_count;
+}
+
+static void
+gst_iir_equalizer_child_proxy_interface_init (gpointer g_iface,
+    gpointer iface_data)
+{
+  GstChildProxyInterface *iface = g_iface;
+
+  GST_DEBUG ("initializing iface");
+
+  iface->get_child_by_index = gst_iir_equalizer_child_proxy_get_child_by_index;
+  iface->get_children_count = gst_iir_equalizer_child_proxy_get_children_count;
+}
+static void
+gst_iir_equalizer_class_init (GstIirEqualizerClass * klass)
+{
+  GST_DEBUG ("gst_iir_equalizer_class_init");
+}
+
+static void
+gst_iir_equalizer_init (GstIirEqualizer * eq, GstIirEqualizerClass * g_class)
+{
+  GST_DEBUG ("gst_iir_equalizer_init");
+  eq->bands_lock = g_mutex_new ();
+  eq->need_new_coefficients = TRUE;
+}
+
+GType
+gst_iir_equalizer_get_type (void)
+{
+  GST_DEBUG ("gst_iir_equalizer_get_type");
+  static GType type = 0;
+
+  if (G_UNLIKELY (!type)) {
+    const GTypeInfo type_info = {
+      sizeof (GstIirEqualizerClass),
+      NULL,
+      NULL,
+      (GClassInitFunc) gst_iir_equalizer_class_init,
+      NULL,
+      NULL,
+      sizeof (GstIirEqualizer),
+      0,
+      (GInstanceInitFunc) gst_iir_equalizer_init,
+    };
+    type =
+        g_type_register_static (GST_TYPE_OBJECT, "GstIirEqualizer",
+        &type_info, 0);
+  }
+  return (type);
+}
+/* Filter taken from
+ *
+ * The Equivalence of Various Methods of Computing
+ * Biquad Coefficients for Audio Parametric Equalizers
+ *
+ * by Robert Bristow-Johnson
+ *
+ * http://www.aes.org/e-lib/browse.cfm?elib=6326
+ * http://www.musicdsp.org/files/EQ-Coefficients.pdf
+ * http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt
+ *
+ * The bandwidth method that we use here is the preferred
+ * one from this article transformed from octaves to frequency
+ * in Hz.
+ */
+static inline gdouble
+arg_to_scale (gdouble arg)
+{
+  GST_DEBUG ("arg_to_scale");
+  return (pow (10.0, arg / 40.0));
+}
+
+static gdouble
+calculate_omega (gdouble freq, gint rate)
+{
+  GST_DEBUG ("calculate_omega");
+  gdouble omega;
+
+  if (freq / rate >= 0.5)
+    omega = G_PI;
+  else if (freq <= 0.0)
+    omega = 0.0;
+  else
+    omega = 2.0 * G_PI * (freq / rate);
+
+  return omega;
+}
+
+static gdouble
+calculate_bw (GstIirEqualizerBand * band, gint rate)
+{
+  GST_DEBUG ("calculate_bw");
+  gdouble bw = 0.0;
+
+  if (band->width / rate >= 0.5) {
+    /* If bandwidth == 0.5 the calculation below fails as tan(G_PI/2)
+     * is undefined. So set the bandwidth to a slightly smaller value.
+     */
+    bw = G_PI - 0.00000001;
+  } else if (band->width <= 0.0) {
+    /* If bandwidth == 0 this band won't change anything so set
+     * the coefficients accordingly. The coefficient calculation
+     * below would create coefficients that for some reason amplify
+     * the band.
+     */
+    band->a0 = 1.0;
+    band->a1 = 0.0;
+    band->a2 = 0.0;
+    band->b1 = 0.0;
+    band->b2 = 0.0;
+  } else {
+    bw = 2.0 * G_PI * (band->width / rate);
+  }
+  return bw;
+}
+
+static void
+setup_peak_filter (Gstaudioeq* audioeq, GstIirEqualizerBand * band)
+{
+  GST_DEBUG ("setup_peak_filter");
+  //g_return_if_fail (GST_AUDIO_FILTER (equ)->format.rate);
+
+  {
+    gdouble gain, omega, bw;
+    gdouble alpha, alpha1, alpha2, b0;
+
+    gain = arg_to_scale (band->gain);
+    omega = calculate_omega (band->freq, audioeq->samplerate);
+    bw = calculate_bw (band, audioeq->samplerate);
+    if (bw == 0.0)
+      goto out;
+
+    alpha = tan (bw / 2.0);
+
+    alpha1 = alpha * gain;
+    alpha2 = alpha / gain;
+
+    b0 = (1.0 + alpha2);
+
+    band->a0 = (1.0 + alpha1) / b0;
+    band->a1 = (-2.0 * cos (omega)) / b0;
+    band->a2 = (1.0 - alpha1) / b0;
+    band->b1 = (2.0 * cos (omega)) / b0;
+    band->b2 = -(1.0 - alpha2) / b0;
+
+  out:
+    GST_INFO
+        ("gain = %5.1f, width= %7.2f, freq = %7.2f, a0 = %7.5g, a1 = %7.5g, a2=%7.5g b1 = %7.5g, b2 = %7.5g",
+        band->gain, band->width, band->freq, band->a0, band->a1, band->a2,
+        band->b1, band->b2);
+  }
+}
+
+static void
+setup_low_shelf_filter (Gstaudioeq* audioeq, GstIirEqualizerBand * band)
+{
+  GST_DEBUG ("setup_low_shelf_filter");
+  //g_return_if_fail (GST_AUDIO_FILTER (equ)->format.rate);
+
+  {
+    gdouble gain, omega, bw;
+    gdouble alpha, delta, b0;
+    gdouble egp, egm;
+
+    gain = arg_to_scale (band->gain);
+    omega = calculate_omega (band->freq, audioeq->samplerate);
+    bw = calculate_bw (band, audioeq->samplerate);
+    if (bw == 0.0)
+      goto out;
+
+    egm = gain - 1.0;
+    egp = gain + 1.0;
+    alpha = tan (bw / 2.0);
+
+    delta = 2.0 * sqrt (gain) * alpha;
+    b0 = egp + egm * cos (omega) + delta;
+
+    band->a0 = ((egp - egm * cos (omega) + delta) * gain) / b0;
+    band->a1 = ((egm - egp * cos (omega)) * 2.0 * gain) / b0;
+    band->a2 = ((egp - egm * cos (omega) - delta) * gain) / b0;
+    band->b1 = ((egm + egp * cos (omega)) * 2.0) / b0;
+    band->b2 = -((egp + egm * cos (omega) - delta)) / b0;
+
+
+  out:
+    GST_INFO
+        ("gain = %5.1f, width= %7.2f, freq = %7.2f, a0 = %7.5g, a1 = %7.5g, a2=%7.5g b1 = %7.5g, b2 = %7.5g",
+        band->gain, band->width, band->freq, band->a0, band->a1, band->a2,
+        band->b1, band->b2);
+  }
+}
+
+static void
+setup_high_shelf_filter (Gstaudioeq* audioeq, GstIirEqualizerBand * band)
+{
+  GST_DEBUG ("setup_high_shelf_filter");
+  {
+    gdouble gain, omega, bw;
+    gdouble alpha, delta, b0;
+    gdouble egp, egm;
+
+    gain = arg_to_scale (band->gain);
+    omega = calculate_omega (band->freq, audioeq->samplerate);
+    bw = calculate_bw (band, audioeq->samplerate);
+    if (bw == 0.0)
+      goto out;
+
+    egm = gain - 1.0;
+    egp = gain + 1.0;
+    alpha = tan (bw / 2.0);
+
+    delta = 2.0 * sqrt (gain) * alpha;
+    b0 = egp - egm * cos (omega) + delta;
+
+    band->a0 = ((egp + egm * cos (omega) + delta) * gain) / b0;
+    band->a1 = ((egm + egp * cos (omega)) * -2.0 * gain) / b0;
+    band->a2 = ((egp + egm * cos (omega) - delta) * gain) / b0;
+    band->b1 = ((egm - egp * cos (omega)) * -2.0) / b0;
+    band->b2 = -((egp - egm * cos (omega) - delta)) / b0;
+
+
+  out:
+    GST_INFO
+        ("gain = %5.1f, width= %7.2f, freq = %7.2f, a0 = %7.5g, a1 = %7.5g, a2=%7.5g b1 = %7.5g, b2 = %7.5g",
+        band->gain, band->width, band->freq, band->a0, band->a1, band->a2,
+        band->b1, band->b2);
+  }
+}
+
+/* Must be called with bands_lock and transform lock! */
+static void
+set_passthrough (Gstaudioeq* audioeq)
+{
+  GST_DEBUG ("set_passthrough");
+  GstIirEqualizer* equ=&audioeq->equ;
+  gint i;
+  gboolean passthrough = TRUE;
+
+  for (i = 0; i < equ->freq_band_count; i++) {
+    passthrough = passthrough && (equ->bands[i]->gain == 0.0);
+  }
+
+  gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (audioeq), passthrough);
+  GST_DEBUG ("Passthrough mode: %d\n", passthrough);
+}
+
+/* Must be called with bands_lock and transform lock! */
+static void
+update_coefficients (Gstaudioeq* audioeq)
+{
+  GST_DEBUG ("update_coefficients");
+  GstIirEqualizer* equ=&audioeq->equ;
+  gint i, n = equ->freq_band_count;
+
+  for (i = 0; i < n; i++) {
+    if (equ->bands[i]->type == BAND_TYPE_PEAK)
+      setup_peak_filter (audioeq, equ->bands[i]);
+    else if (equ->bands[i]->type == BAND_TYPE_LOW_SHELF)
+      setup_low_shelf_filter (audioeq, equ->bands[i]);
+    else
+      setup_high_shelf_filter (audioeq, equ->bands[i]);
+  }
+
+  equ->need_new_coefficients = FALSE;
+}
+
+/* Must be called with transform lock! */
+static void
+alloc_history (GstIirEqualizer * equ)
+{
+  GST_DEBUG ("alloc_history");
+  /* free + alloc = no memcpy */
+  g_free (equ->history);
+  equ->history =
+      g_malloc0 (equ->history_size *  equ->audiofilter.format.channels *
+      equ->freq_band_count);
+}
+void
+gst_audioeq_band_set_property(Gstaudioeq * audioeq)
+{
+  GST_DEBUG ("gst_audioeq_band_set_property");
+  GstIirEqualizer *equ = &audioeq->equ;
+  gshort i ;
+  for ( i = 0; i < DEFAULT_CUSTOM_EQ_NUM; i++){
+     GST_DEBUG ("gain = %lf -> %d", equ->bands[i]->gain, audioeq->custom_eq[i] );
+     if (audioeq->custom_eq[i] != equ->bands[i]->gain) {
+        equ->bands[i]->gain = audioeq->custom_eq[i];
+        GST_DEBUG("changed gain = %lf ", equ->bands[i]->gain);
+        g_object_notify (G_OBJECT (equ->bands[i]), "gain");
+     }
+  }
+}
+
+void
+gst_iir_equalizer_compute_frequencies (Gstaudioeq * audioeq, guint new_count)
+{
+  GST_DEBUG ("gst_iir_equalizer_compute_frequencies");
+
+  GstIirEqualizer *equ = &audioeq->equ;
+  guint old_count, i;
+  gdouble freq0, freq1, step;
+  gchar name[20];
+  GST_DEBUG ("gst_iir_equalizer_compute_frequencies before calling equalizer object");
+  if (equ->freq_band_count == new_count)
+    return;
+
+  GST_DEBUG ("gst_iir_equalizer_compute_frequencies equalizer object");
+
+  BANDS_LOCK (equ);
+  GST_DEBUG ("gst_iir_equalizer_compute_frequencies 1");
+  if (G_UNLIKELY (equ->freq_band_count == new_count)) {
+    BANDS_UNLOCK (equ);
+    return;
+  }
+  GST_DEBUG ("gst_iir_equalizer_compute_frequencies 2");
+  old_count = equ->freq_band_count;
+  equ->freq_band_count = new_count;
+  GST_DEBUG ("bands %u -> %u", old_count, new_count);
+
+  if (old_count < new_count) {
+    /* add new bands */
+    equ->bands = g_realloc (equ->bands, sizeof (GstObject *) * new_count);
+    for (i = old_count; i < new_count; i++) {
+      equ->bands[i] = g_object_new (GST_TYPE_IIR_EQUALIZER_BAND, NULL);
+      /* otherwise they get names like 'iirequalizerband5' */
+      sprintf (name, "band%u", i);
+      gst_object_set_name (GST_OBJECT (equ->bands[i]), name);
+      GST_DEBUG ("adding band[%d]=%p", i, equ->bands[i]);
+
+      gst_object_set_parent (GST_OBJECT (equ->bands[i]), GST_OBJECT (audioeq));
+      gst_child_proxy_child_added (GST_OBJECT (audioeq),
+          GST_OBJECT (equ->bands[i]));
+    }
+  } else {
+    /* free unused bands */
+    for (i = new_count; i < old_count; i++) {
+      GST_DEBUG ("removing band[%d]=%p", i, equ->bands[i]);
+      gst_child_proxy_child_removed (GST_OBJECT (audioeq),
+          GST_OBJECT (equ->bands[i]));
+      gst_object_unparent (GST_OBJECT (equ->bands[i]));
+      equ->bands[i] = NULL;
+    }
+  }
+
+  alloc_history (equ);
+
+  /* set center frequencies and name band objects
+   * FIXME: arg! we can't change the name of parented objects :(
+   *   application should read band->freq to get the name
+   */
+
+  step = pow (HIGHEST_FREQ / LOWEST_FREQ, 1.0 / new_count);
+  freq0 = LOWEST_FREQ;
+  for (i = 0; i < new_count; i++) {
+    freq1 = freq0 * step;
+
+    if (i == 0)
+      equ->bands[i]->type = BAND_TYPE_LOW_SHELF;
+    else if (i == new_count - 1)
+      equ->bands[i]->type = BAND_TYPE_HIGH_SHELF;
+    else
+      equ->bands[i]->type = BAND_TYPE_PEAK;
+
+    equ->bands[i]->freq = freq0 + ((freq1 - freq0) / 2.0);
+    equ->bands[i]->width = freq1 - freq0;
+    GST_DEBUG ("band[%2d] = '%lf'", i, equ->bands[i]->freq);
+
+    g_object_notify (G_OBJECT (equ->bands[i]), "bandwidth");
+    g_object_notify (G_OBJECT (equ->bands[i]), "freq");
+    g_object_notify (G_OBJECT (equ->bands[i]), "type");
+
+    freq0 = freq1;
+  }
+
+  equ->need_new_coefficients = TRUE;
+
+  BANDS_UNLOCK (equ);
+}
+/* start of code that is type specific */
+
+#define CREATE_OPTIMIZED_FUNCTIONS_INT(TYPE,BIG_TYPE,MIN_VAL,MAX_VAL)   \
+typedef struct {                                                        \
+  BIG_TYPE x1, x2;          /* history of input values for a filter */  \
+  BIG_TYPE y1, y2;          /* history of output values for a filter */ \
+} SecondOrderHistory ## TYPE;                                           \
+                                                                        \
+static inline BIG_TYPE                                                  \
+one_step_ ## TYPE (GstIirEqualizerBand *filter,                         \
+    SecondOrderHistory ## TYPE *history, BIG_TYPE input)                \
+{                                                                       \
+  /* calculate output */                                                \
+  BIG_TYPE output = filter->a0 * input +                                \
+      filter->a1 * history->x1 + filter->a2 * history->x2 +             \
+      filter->b1 * history->y1 + filter->b2 * history->y2;              \
+  /* update history */                                                  \
+  history->y2 = history->y1;                                            \
+  history->y1 = output;                                                 \
+  history->x2 = history->x1;                                            \
+  history->x1 = input;                                                  \
+                                                                        \
+  return output;                                                        \
+}                                                                       \
+                                                                        \
+static const guint                                                      \
+history_size_ ## TYPE = sizeof (SecondOrderHistory ## TYPE);            \
+                                                                        \
+static void                                                             \
+gst_iir_equ_process_ ## TYPE (GstIirEqualizer *equ, guint8 *data,       \
+guint size, guint channels)                                             \
+{                                                                       \
+  guint frames = size / channels / sizeof (TYPE);                       \
+  guint i, c, f, nf = equ->freq_band_count;                             \
+  BIG_TYPE cur;                                                         \
+  GstIirEqualizerBand **filters = equ->bands;                           \
+                                                                        \
+  for (i = 0; i < frames; i++) {                                        \
+    SecondOrderHistory ## TYPE *history = equ->history;                 \
+    for (c = 0; c < channels; c++) {                                    \
+      cur = *((TYPE *) data);                                           \
+      for (f = 0; f < nf; f++) {                                        \
+        cur = one_step_ ## TYPE (filters[f], history, cur);             \
+        history++;                                                      \
+      }                                                                 \
+      cur = CLAMP (cur, MIN_VAL, MAX_VAL);                              \
+      *((TYPE *) data) = (TYPE) floor (cur);                            \
+      data += sizeof (TYPE);                                            \
+    }                                                                   \
+  }                                                                     \
+}
+
+#define CREATE_OPTIMIZED_FUNCTIONS(TYPE)                                \
+typedef struct {                                                        \
+  TYPE x1, x2;          /* history of input values for a filter */  \
+  TYPE y1, y2;          /* history of output values for a filter */ \
+} SecondOrderHistory ## TYPE;                                           \
+                                                                        \
+static inline TYPE                                                      \
+one_step_ ## TYPE (GstIirEqualizerBand *filter,                         \
+    SecondOrderHistory ## TYPE *history, TYPE input)                    \
+{                                                                       \
+  /* calculate output */                                                \
+  TYPE output = filter->a0 * input + filter->a1 * history->x1 +         \
+      filter->a2 * history->x2 + filter->b1 * history->y1 +             \
+      filter->b2 * history->y2;                                         \
+  /* update history */                                                  \
+  history->y2 = history->y1;                                            \
+  history->y1 = output;                                                 \
+  history->x2 = history->x1;                                            \
+  history->x1 = input;                                                  \
+                                                                        \
+  return output;                                                        \
+}                                                                       \
+                                                                        \
+static const guint                                                      \
+history_size_ ## TYPE = sizeof (SecondOrderHistory ## TYPE);            \
+                                                                        \
+static void                                                             \
+gst_iir_equ_process_ ## TYPE (GstIirEqualizer *equ, guint8 *data,       \
+guint size, guint channels)                                             \
+{                                                                       \
+  guint frames = size / channels / sizeof (TYPE);                       \
+  guint i, c, f, nf = equ->freq_band_count;                             \
+  TYPE cur;                                                             \
+  GstIirEqualizerBand **filters = equ->bands;                           \
+                                                                        \
+  for (i = 0; i < frames; i++) {                                        \
+    SecondOrderHistory ## TYPE *history = equ->history;                 \
+    for (c = 0; c < channels; c++) {                                    \
+      cur = *((TYPE *) data);                                           \
+      for (f = 0; f < nf; f++) {                                        \
+        cur = one_step_ ## TYPE (filters[f], history, cur);             \
+        history++;                                                      \
+      }                                                                 \
+      *((TYPE *) data) = (TYPE) cur;                                    \
+      data += sizeof (TYPE);                                            \
+    }                                                                   \
+  }                                                                     \
+}
+
+CREATE_OPTIMIZED_FUNCTIONS_INT (gint16, gfloat, -32768.0, 32767.0);
+CREATE_OPTIMIZED_FUNCTIONS (gfloat);
+CREATE_OPTIMIZED_FUNCTIONS (gdouble);
+
+#ifdef AUDIOEQ_REDUCE_MEMCPY
+static GstFlowReturn
+gst_audioeq_transform_ip (GstBaseTransform * base, GstBuffer * buf)
+{
+  GST_DEBUG ("gst_audioeq_transform_ip");
+  Gstaudioeq *audioeq = GST_AUDIOEQ(base);
+  GstIirEqualizer *equ = &audioeq->equ;
+
+  equ->history_size = history_size_gint16;
+  equ->process = gst_iir_equ_process_gint16;
+   g_free (equ->history);
+  equ->history = g_malloc0 (equ->history_size *  audioeq->channels * equ->freq_band_count);
+  GstClockTime timestamp;
+
+  if (G_UNLIKELY (audioeq->channels < 1 || equ->process == NULL)) {
+    GST_DEBUG ("gst_audioeq_transform_ip return GST_FLOW_NOT_NEGOTIATED;");
+    if (G_UNLIKELY (equ->process == NULL))
+    GST_DEBUG ("gst_audioeq_transform_ip equ->process ");
+    if (G_UNLIKELY (audioeq->channels < 1))
+    GST_DEBUG ("gst_audioeq_transform_ip audioeq->channels");
+    return GST_FLOW_NOT_NEGOTIATED;
+  }
+      GST_DEBUG ("gst_audioeq_transform_ip  BANDS_LOCK (equ);");
+  BANDS_LOCK (equ);
+  if (equ->need_new_coefficients) {
+    GST_DEBUG ("gst_audioeq_transform_ip  update_coefficients");
+    update_coefficients (audioeq);
+    set_passthrough (audioeq);
+  }
+  BANDS_UNLOCK (equ);
+
+  if (gst_base_transform_is_passthrough (base)) {
+    GST_DEBUG ("gst_audioeq_transform_ip gst_base_transform_is_passthrough return GST_FLOW_OK;");
+    return GST_FLOW_OK;
+  }
+  timestamp = GST_BUFFER_TIMESTAMP (buf);
+  timestamp =
+      gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
+
+  if (GST_CLOCK_TIME_IS_VALID (timestamp))
+    gst_object_sync_values (G_OBJECT (audioeq), timestamp);
+  GST_DEBUG ("  equ->process ++");
+  equ->process (equ, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf),
+      audioeq->channels);
+  GST_DEBUG ("  equ->process --");
+  GST_DEBUG ("gst_audioeq_transform_ip return GST_FLOW_OK;");
+  return GST_FLOW_OK;
+}
+#endif
+
+static gboolean
+gst_audioeq_set_caps (GstBaseTransform * base, GstCaps * incaps,
+       GstCaps * outcaps)
+{
+  GST_DEBUG ("gst_audioeq_set_caps");
+       Gstaudioeq *audioeq = GST_AUDIOEQ(base);
+       GstStructure *ins;
+       GstPad *pad;
+       gint samplerate;
+       gint channels;
+       gshort old_samplerate;
+       gshort old_channels;
+
+       pad = gst_element_get_static_pad(GST_ELEMENT(audioeq), "src");
+
+       /* forward-negotiate */
+       if(!gst_pad_set_caps(pad, incaps)) {
+               gst_object_unref(pad);
+               return FALSE;
+       }
+
+       /* negotiation succeeded, so now configure ourselves */
+       ins = gst_caps_get_structure(incaps, 0);
+
+       /* get samplerate from caps & convert */
+       old_samplerate = audioeq->samplerate;
+       old_channels = audioeq->channels;
+       gst_structure_get_int(ins, "rate", &samplerate);
+       switch (samplerate) {
+       case 48000:
+               audioeq->samplerate = SAMPLERATE_48000Hz;
+               break;
+       case 44100:
+               audioeq->samplerate = SAMPLERATE_44100Hz;
+               break;
+       case 32000:
+               audioeq->samplerate = SAMPLERATE_32000Hz;
+               break;
+       case 24000:
+               audioeq->samplerate = SAMPLERATE_24000Hz;
+               break;
+       case 22050:
+               audioeq->samplerate = SAMPLERATE_22050Hz;
+               break;
+       case 16000:
+               audioeq->samplerate = SAMPLERATE_16000Hz;
+               break;
+       case 12000:
+               audioeq->samplerate = SAMPLERATE_12000Hz;
+               break;
+       case 11025:
+               audioeq->samplerate = SAMPLERATE_11025Hz;
+               break;
+       case 8000:
+               audioeq->samplerate = SAMPLERATE_8000Hz;
+               break;
+       default:
+               if (samplerate < 8000) {
+                       audioeq->samplerate = SAMPLERATE_8000Hz;
+               } else if (samplerate > 48000) {
+                       audioeq->samplerate = SAMPLERATE_48000Hz;
+               }
+               break;
+       }
+       /* get number of channels from caps */
+       gst_structure_get_int(ins, "channels", &channels);
+       audioeq->channels = (gshort)channels;
+
+       if ((old_samplerate != audioeq->samplerate)
+               || (old_channels != audioeq->channels)) {
+               audioeq->need_update_filter = TRUE;
+       }
+
+       gst_object_unref (pad);
+
+       return TRUE;
+}
+
+static void
+gst_audioeq_set_property (GObject * object, guint prop_id,
+       const GValue * value, GParamSpec * pspec)
+{
+       GST_DEBUG ("gst_audioeq_set_property");
+       Gstaudioeq *audioeq = GST_AUDIOEQ (object);
+       GstIirEqualizer *equ = &audioeq->equ;
+       gshort *pointer;
+
+       switch (prop_id) {
+
+       case PROP_FILTER_ACTION:
+               audioeq->filter_action = g_value_get_uint(value);
+               BANDS_LOCK(equ);
+               equ->need_new_coefficients = TRUE;
+               BANDS_UNLOCK(equ);
+               break;
+
+       case PROP_CUSTOM_EQ:
+               pointer = g_value_get_pointer(value);
+               if (pointer) {
+                       memcpy(audioeq->custom_eq, pointer, sizeof(gint) * CUSTOM_EQ_BAND_MAX);
+                       if (audioeq->filter_action == FILTER_ADVANCED_SETTING) {
+                               BANDS_LOCK(equ);
+                               equ->need_new_coefficients = TRUE;
+                               gst_audioeq_band_set_property(audioeq);
+                               BANDS_UNLOCK(equ);
+                       }
+               }
+               break;
+
+       default:
+               break;
+       }
+       GST_DEBUG ("gst_audioeq_set_property need_update_filter %d", audioeq->need_update_filter);
+}
+
+static void
+gst_audioeq_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+{
+GST_DEBUG ("gst_audioeq_get_property");
+
+       Gstaudioeq *audioeq = GST_AUDIOEQ (object);
+       GstIirEqualizer *equ = &audioeq->equ;
+       gshort i;
+       gdouble widtharr[DEFAULT_CUSTOM_EQ_NUM],freqarr[DEFAULT_CUSTOM_EQ_NUM];
+
+       switch (prop_id) {
+       case PROP_FILTER_ACTION:
+               g_value_set_uint(value, audioeq->filter_action);
+               break;
+
+       case PROP_CUSTOM_EQ:
+               g_value_set_pointer(value, audioeq->custom_eq);
+               break;
+
+       case PROP_CUSTOM_EQ_NUM:
+               g_value_set_uint(value, DEFAULT_CUSTOM_EQ_NUM);
+               break;
+
+       case PROP_CUSTOM_EQ_FREQ:
+               for(i=0;i<DEFAULT_CUSTOM_EQ_NUM;i++) {
+                        freqarr[i] =   equ->bands[i]->freq;
+               }
+               g_value_set_pointer(value, &freqarr);
+               break;
+
+       case PROP_CUSTOM_EQ_WIDTH:
+               for(i=0;i<DEFAULT_CUSTOM_EQ_NUM;i++) {
+                        widtharr[i] =  equ->bands[i]->width;
+               }
+               g_value_set_pointer(value, &widtharr);
+               break;
+
+       default:
+               break;
+       }
+}
+
+static gboolean
+gst_iir_equalizer_setup (GstAudioFilter * audio, GstRingBufferSpec * fmt)
+{
+GST_DEBUG ("gst_iir_equalizer_setup");
+  GstIirEqualizer *equ = GST_IIR_EQUALIZER (audio);
+
+  switch (fmt->type) {
+    case GST_BUFTYPE_LINEAR:
+      switch (fmt->width) {
+        case 16:
+          equ->history_size = history_size_gint16;
+          equ->process = gst_iir_equ_process_gint16;
+          break;
+        default:
+          return FALSE;
+      }
+      break;
+    case GST_BUFTYPE_FLOAT:
+      switch (fmt->width) {
+        case 32:
+          equ->history_size = history_size_gfloat;
+          equ->process = gst_iir_equ_process_gfloat;
+          break;
+        case 64:
+          equ->history_size = history_size_gdouble;
+          equ->process = gst_iir_equ_process_gdouble;
+          break;
+        default:
+          return FALSE;
+      }
+      break;
+    default:
+      return FALSE;
+  }
+
+  alloc_history (equ);
+  return TRUE;
+}
+
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+       GST_DEBUG ("audioeq plugin_init ");
+       GST_DEBUG_CATEGORY_INIT(gst_audioeq_debug, "audioeq", 0, "Audio Equalizer Plugin");
+       return gst_element_register(plugin, "audioeq", GST_RANK_NONE, GST_TYPE_AUDIOEQ);
+}
+
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+       GST_VERSION_MINOR,
+       "audioeq",
+       "Audio Equalizer Plugin",
+       plugin_init,
+       VERSION,
+       "LGPL",
+       "gst-plugins-ext",
+       "https://www.tizen.org/")
diff --git a/audioeq/src/gstaudioeq.h b/audioeq/src/gstaudioeq.h
new file mode 100644 (file)
index 0000000..a2c3815
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * audioeq
+ *
+ * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Aditi Narula <aditi.n@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+
+#ifndef __GST_AUDIOEQ_H__
+#define __GST_AUDIOEQ_H__
+
+#include <stdio.h>
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+#include <gst/audio/gstaudiofilter.h>
+#include <gst/audio/gstringbuffer.h>
+#include <gst/controller/gstcontroller.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIOEQ \
+       (gst_audioeq_get_type())
+#define GST_AUDIOEQ(obj) \
+       (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIOEQ,Gstaudioeq))
+#define GST_audioeq_CLASS(klass) \
+       (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOEQ,GstaudioeqClass))
+#define GST_IS_AUDIOEQ(obj) \
+       (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIOEQ))
+#define GST_IS_AUDIOEQ_CLASS(klass) \
+       (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOEQ))
+#define GST_TYPE_IIR_EQUALIZER \
+  (gst_iir_equalizer_get_type())
+#define GST_IIR_EQUALIZER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IIR_EQUALIZER,GstIirEqualizer))
+#define GST_IIR_EQUALIZER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IIR_EQUALIZER,GstIirEqualizerClass))
+#define GST_IS_IIR_EQUALIZER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_IIR_EQUALIZER))
+#define GST_IS_IIR_EQUALIZER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_IIR_EQUALIZER))
+
+typedef struct _Gstaudioeq Gstaudioeq;
+typedef struct _GstaudioeqClass GstaudioeqClass;
+typedef struct _GstIirEqualizer GstIirEqualizer;
+typedef struct _GstIirEqualizerClass GstIirEqualizerClass;
+typedef struct _GstIirEqualizerBand GstIirEqualizerBand;
+
+#define CUSTOM_EQ_BAND_MAX                             9
+
+#define LOWEST_FREQ (20.0)
+#define HIGHEST_FREQ (20000.0)
+
+typedef void (*ProcessFunc) (GstIirEqualizer * eq, guint8 * data, guint size,
+    guint channels);
+
+struct _GstIirEqualizer
+{
+  GstAudioFilter audiofilter;
+
+  /*< private >*/
+
+  GMutex *bands_lock;
+  GstIirEqualizerBand **bands;
+
+  /* properties */
+  guint freq_band_count;
+  /* for each band and channel */
+  gpointer history;
+  guint history_size;
+
+  gboolean need_new_coefficients;
+
+  ProcessFunc process;
+};
+
+struct _GstIirEqualizerClass
+{
+  GstAudioFilterClass audiofilter_class;
+};
+
+
+
+struct _Gstaudioeq
+{
+       GstBaseTransform element;
+
+       guint           samplerate;
+       guint           channels;
+
+       /* properties */
+       guint           filter_action;
+       gint                    custom_eq[CUSTOM_EQ_BAND_MAX];
+       gboolean                need_update_filter;
+       GstIirEqualizer equ;
+};
+
+struct _GstaudioeqClass
+{
+       GstAudioFilterClass parent_class;
+};
+
+void gst_iir_equalizer_compute_frequencies (Gstaudioeq * audioeq, guint new_count);
+
+GType gst_iir_equalizer_get_type(void);
+
+GType gst_audioeq_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIOEQ_H__ */
+
diff --git a/audiotp/Makefile.am b/audiotp/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/audiotp/src/Makefile.am b/audiotp/src/Makefile.am
new file mode 100755 (executable)
index 0000000..436666c
--- /dev/null
@@ -0,0 +1,26 @@
+# plugindir is set in configure
+
+##############################################################################
+# change libgstplugin.la to something more suitable, e.g. libmysomething.la  #
+##############################################################################
+plugin_LTLIBRARIES = libgstaudiotp.la
+
+##############################################################################
+# for the next set of variables, rename the prefix if you renamed the .la,   #
+#  e.g. libgstplugin_la_SOURCES => libmysomething_la_SOURCES                 #
+#       libgstplugin_la_CFLAGS  => libmysomething_la_CFLAGS                  #
+#       libgstplugin_la_LIBADD  => libmysomething_la_LIBADD                  #
+#       libgstplugin_la_LDFLAGS => libmysomething_la_LDFLAGS                 #
+##############################################################################
+
+# sources used to compile this plug-in
+libgstaudiotp_la_SOURCES = gstaudiotp.c
+
+# flags used to compile this plugin
+# add other _CFLAGS and _LIBS as needed
+libgstaudiotp_la_CFLAGS = $(GST_CFLAGS)  $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS)
+libgstaudiotp_la_LIBADD = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS)  $(GST_BASE_LIBS)
+libgstaudiotp_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+# headers we need but don't want installed
+noinst_HEADERS = gstaudiotp.h
\ No newline at end of file
diff --git a/audiotp/src/gstaudiotp.c b/audiotp/src/gstaudiotp.c
new file mode 100644 (file)
index 0000000..1bdfe95
--- /dev/null
@@ -0,0 +1,605 @@
+/*
+ * audiotp
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstaudiotp.h"
+
+/* Plugin Detaills for gstreamer */
+static const GstElementDetails gst_audiotp_plugin_details = GST_ELEMENT_DETAILS (
+ "Audio timestamp reversal plugin",
+ "Utility/Audio",
+ "Reverses audio timestamps for reverse playback",
+ "Samsung Electronics <www.samsung.com>"
+ );
+
+/*** GSTREAMER PROTOTYPES *****************************************************/
+
+#define STATIC_CAPS \
+GST_STATIC_CAPS ( \
+  "audio/x-raw-float, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, MAX ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 64;" \
+  "audio/x-raw-float, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, MAX ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 32;" \
+  "audio/x-raw-int, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, MAX ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 32, " \
+    "depth = (int) [ 1, 32 ], " \
+    "signed = (boolean) { true, false }; " \
+  "audio/x-raw-int, "   \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, MAX ], "       \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "        \
+    "width = (int) 24, "        \
+    "depth = (int) [ 1, 24 ], " "signed = (boolean) { true, false }; "  \
+  "audio/x-raw-int, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, MAX ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 16, " \
+    "depth = (int) [ 1, 16 ], " \
+    "signed = (boolean) { true, false }; " \
+  "audio/x-raw-int, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, MAX ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 8, " \
+    "depth = (int) [ 1, 8 ], " \
+    "signed = (boolean) { true, false } " \
+)
+
+/* Element sink pad template */
+static GstStaticPadTemplate gst_audiotp_sink_template = GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ STATIC_CAPS);
+
+/* Element Source Pad template */
+static GstStaticPadTemplate gst_audiotp_src_template = GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ STATIC_CAPS);
+
+
+////////////////////////////////////////////////////////
+//        Gstreamer Base Prototype                    //
+////////////////////////////////////////////////////////
+
+GST_DEBUG_CATEGORY_STATIC(gst_audiotp_debug);
+#define GST_CAT_DEFAULT gst_audiotp_debug
+#define _do_init(bla) \
+ GST_DEBUG_CATEGORY_INIT(GST_CAT_DEFAULT, "audiotp", 0, "Audio trickplay plugin"); \
+ GST_DEBUG("audiotp is registered");
+
+GST_BOILERPLATE_FULL(Gstaudiotp, gst_audiotp, GstElement, GST_TYPE_ELEMENT, _do_init);
+
+static void gst_audiotp_base_init(gpointer klass);
+static void gst_audiotp_class_init(GstaudiotpClass *klass);
+static void gst_audiotp_init(Gstaudiotp *dec, GstaudiotpClass *klass);
+static GstFlowReturn gst_audiotp_chain(GstPad *pad, GstBuffer *buf);
+static GstStateChangeReturn gst_audiotp_change_state(GstElement *element, GstStateChange transition);
+static void gst_audiotp_finalize(GObject *object);
+static gboolean gst_audiotp_sink_event (GstPad *pad, GstEvent *event);
+static GstFlowReturn gst_audiotp_push_silent_frame (Gstaudiotp *audiotp, GstBuffer *MetaDataBuf);
+
+
+
+////////////////////////////////////////////////////////
+//        Gstreamer Base Functions                    //
+////////////////////////////////////////////////////////
+
+/**
+ **
+ **  Description: The element details and pad templates are registered with the plugin
+ **  In Params    : @ gclass instance of Element class
+ **  return    : None
+ **  Comments    : 1. Adding templates of source and sink pad to element
+ **           2. Setting element class deatils to element
+ **
+ */
+static void
+gst_audiotp_base_init(gpointer klass)
+{
+  GstElementClass *element_class = GST_ELEMENT_CLASS(klass);
+
+  gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&gst_audiotp_sink_template));
+  gst_element_class_add_pad_template(element_class, gst_static_pad_template_get(&gst_audiotp_src_template));
+  gst_element_class_set_details(element_class, &gst_audiotp_plugin_details);
+}
+
+
+/**
+ **
+ **  Description: Initialization of the Element Class
+ **  In Param    : @ gclass instance of Element class
+ **  return    : None
+ **  Comments    : 1. Overwriting base class virtual functions
+ **                2. Installing the properties of the element
+ **
+ */
+static void
+gst_audiotp_class_init(GstaudiotpClass *klass)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS(klass);
+  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+
+  parent_class = g_type_class_peek_parent(klass);
+
+  gobject_class->finalize = gst_audiotp_finalize;
+  gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_audiotp_change_state);
+}
+
+
+/**
+ **
+ **  Description: Initialization of the Element instance
+ **  In Params    : @ audio tp element instance
+ **           @ gclass instance of Element class
+ **  return    : None
+ **  Comments    : 1. Creating new source & sink pads using templates
+ **           2. Setting the callback functions to the pads
+ **          3. Local data initialization.
+ **
+ */
+static void
+gst_audiotp_init(Gstaudiotp *audiotp, GstaudiotpClass *klass)
+{
+
+  audiotp->sinkpad = gst_pad_new_from_static_template(&gst_audiotp_sink_template, "sink");
+  audiotp->srcpad = gst_pad_new_from_static_template(&gst_audiotp_src_template, "src");
+
+  gst_pad_set_chain_function (audiotp->sinkpad, GST_DEBUG_FUNCPTR(gst_audiotp_chain));
+  gst_pad_set_event_function (audiotp->sinkpad, GST_DEBUG_FUNCPTR(gst_audiotp_sink_event));
+
+  gst_pad_use_fixed_caps(audiotp->srcpad);
+
+  gst_element_add_pad(GST_ELEMENT(audiotp), audiotp->sinkpad);
+  gst_element_add_pad(GST_ELEMENT(audiotp), audiotp->srcpad);
+
+  audiotp->reverse = g_queue_new ();
+  audiotp->head_prev = GST_CLOCK_TIME_NONE;
+  audiotp->tail_prev = GST_CLOCK_TIME_NONE;
+
+}
+
+
+/**
+ **
+ **  Description: Finalization of the Element instance (object)
+ **  In Params    : @ audiotp element instance in the form of GObject
+ **  return    : None
+ **  Comments    : 1. Local data Deinitialization.
+ **
+ **
+ */
+static void
+gst_audiotp_finalize(GObject *object)
+{
+  Gstaudiotp *audiotp = GST_AUDIOTP(object);
+
+  while (!g_queue_is_empty (audiotp->reverse)) {
+    GstMiniObject *data = g_queue_pop_head (audiotp->reverse);
+    gst_mini_object_unref (data);
+  }
+  /* freeing dealy queue */
+  g_queue_free(audiotp->reverse);
+  audiotp->reverse = NULL;
+
+  G_OBJECT_CLASS(parent_class)->finalize(object);
+}
+
+
+/**
+ **
+ **  Description: Callback function when the element's state gets changed
+ **  In Params    : @ audiotp plugin element
+ **          @ type of state change
+ **  return    : status of the state change processing
+ **  Comments    :
+ **
+ **
+ */
+static GstStateChangeReturn
+gst_audiotp_change_state(GstElement *element, GstStateChange transition)
+{
+  GstStateChangeReturn res = GST_FLOW_ERROR;
+
+  switch (transition) {
+    case GST_STATE_CHANGE_NULL_TO_READY:
+      break;
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+      break;
+    default:
+      break;
+  }
+
+  res = parent_class->change_state(element, transition);
+  if ( res != GST_STATE_CHANGE_SUCCESS ) {
+    GST_ERROR ("change state error in parent class\n");
+    return GST_STATE_CHANGE_FAILURE;
+  }
+
+  switch (transition) {
+    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+      break;
+    case GST_STATE_CHANGE_READY_TO_NULL:
+      break;
+    default:
+      break;
+  }
+
+  return res;
+}
+
+
+/**
+ **
+ **  Description: Callback function when sinkpad gets an event
+ **  In Params    : @ Sinkpad on which the event arrives
+ **          @ event type
+ **  return    : TRUE/FALSE on success/failure of the event processing.
+ **  Comments    : 1. Process the event and push it to the source pad.
+ **
+ **
+ */
+static gboolean
+gst_audiotp_sink_event (GstPad *pad, GstEvent *event)
+{
+  Gstaudiotp *audiotp = NULL;
+  gboolean res = FALSE;
+
+  audiotp = GST_AUDIOTP(GST_PAD_PARENT(pad));
+
+  switch (GST_EVENT_TYPE(event)) {
+    /* Arrives whenever there is a jump in the normal playback. Ex:SEEK */
+    case GST_EVENT_NEWSEGMENT: {
+      GstFormat format;
+      gdouble rate, arate;
+      gint64 start, stop, time;
+      gboolean update;
+
+      GST_INFO_OBJECT (audiotp, "GST_EVENT_NEWSEGMENT");
+      gst_event_parse_new_segment_full(event, &update, &rate, &arate, &format, &start, &stop, &time);
+
+      if (format != GST_FORMAT_TIME) {
+        GST_ERROR("Format is not supported\n");
+        res = gst_pad_push_event(audiotp->srcpad, event);
+        goto done;
+      }
+
+      GST_INFO_OBJECT (audiotp, "update: %d, rate: %0.3f, arate: %0.3f\n", update, rate, arate);
+      GST_INFO_OBJECT (audiotp, "start : %" GST_TIME_FORMAT, GST_TIME_ARGS(start));
+      GST_INFO_OBJECT (audiotp, "stop  : %" GST_TIME_FORMAT, GST_TIME_ARGS(stop));
+      GST_INFO_OBJECT (audiotp, "time  : %" GST_TIME_FORMAT, GST_TIME_ARGS(time));
+
+      /* If we receive new_segment without FLUSH events, then we will push all the frame in queue */
+      while (!g_queue_is_empty (audiotp->reverse)) {
+           GstBuffer *MetaDataBuf;
+        GstFlowReturn ret = GST_FLOW_OK;
+               if(audiotp->is_reversed)
+          MetaDataBuf = g_queue_pop_head (audiotp->reverse);
+               else
+                 MetaDataBuf = g_queue_pop_tail (audiotp->reverse);
+        ret = gst_audiotp_push_silent_frame (audiotp, MetaDataBuf);
+        if (GST_FLOW_OK != ret)
+        {
+           GST_WARNING_OBJECT (audiotp, "pad_push returned = %s", gst_flow_get_name (ret));
+        }
+      }
+      gst_segment_set_newsegment_full(&audiotp->segment, update, rate, arate, format, start, stop, time);
+      res = gst_pad_push_event(audiotp->srcpad, event);
+      break;
+    }
+
+    /* Indication of the end of the stream */
+    case GST_EVENT_EOS: {
+      /* queue all buffer timestamps till we receive next discontinuity */
+      while (!g_queue_is_empty (audiotp->reverse)) {
+           GstBuffer *MetaDataBuf;
+        GstFlowReturn ret = GST_FLOW_OK;
+               if(audiotp->is_reversed)
+          MetaDataBuf = g_queue_pop_head (audiotp->reverse);
+               else
+                 MetaDataBuf = g_queue_pop_tail (audiotp->reverse);
+        ret = gst_audiotp_push_silent_frame (audiotp, MetaDataBuf);
+        if (GST_FLOW_OK != ret) {
+          GST_WARNING_OBJECT (audiotp, "pad_push returned = %s", gst_flow_get_name (ret));
+        }
+      }
+
+      res = gst_pad_push_event(audiotp->srcpad, event);
+      break;
+    }
+
+    /* Indication of the SEEK operation start */
+    case GST_EVENT_FLUSH_START: {
+      GST_INFO_OBJECT (audiotp, "GST_EVENT_FLUSH_START");
+      res = gst_pad_push_event(audiotp->srcpad, event);
+      break;
+    }
+
+    /* Indication of the SEEK operation stop */
+    case GST_EVENT_FLUSH_STOP: {
+      GST_INFO_OBJECT (audiotp, "GST_EVENT_FLUSH_STOP");
+      /* make sure that we empty the queue */
+      while (!g_queue_is_empty (audiotp->reverse)) {
+        GST_DEBUG_OBJECT (audiotp, "Flushing buffers in reverse queue....");
+        gst_buffer_unref(g_queue_pop_head (audiotp->reverse));
+      }
+
+      res = gst_pad_push_event(audiotp->srcpad, event);
+      break;
+    }
+
+    default: {
+      res = gst_pad_push_event(audiotp->srcpad, event);
+      break;
+    }
+  }
+
+  done:
+    return res;
+}
+
+
+/**
+ **
+ **  Description: Callback function when sinkpad gets a buffer (from the previous element)
+ **  In Params    : @ Sinkpad on which the buffer arrives
+ **          @ input buffer
+ **  return    : status of the buffer processing.
+ **  Comments    : 1. Handle the buffer discontinuity ( in terms of tmestamp)
+ **          2. Push or pop buffer based on discontinuity.
+ **
+ **
+ */
+static GstFlowReturn
+gst_audiotp_chain(GstPad *pad, GstBuffer *buf)
+{
+  Gstaudiotp *audiotp = GST_AUDIOTP(GST_PAD_PARENT(pad));
+  GstFlowReturn ret = GST_FLOW_OK;
+
+  if(buf == NULL) {
+    ret = GST_FLOW_ERROR;
+       goto error_exit;
+  }
+
+  GST_LOG_OBJECT (audiotp, "Input buffer : ts =%" GST_TIME_FORMAT ", dur=%" GST_TIME_FORMAT ", size=%d",
+         GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(buf)),
+         GST_TIME_ARGS(GST_BUFFER_DURATION(buf)),
+         GST_BUFFER_SIZE(buf), GST_BUFFER_IS_DISCONT (buf) ? " - discont" :"");
+
+  if (audiotp->segment.rate < 0.0) {
+    goto send_reverse;
+  }
+
+
+  /* Push the input data to the next element */
+  ret = gst_pad_push(audiotp->srcpad, buf);
+  if (ret != GST_FLOW_OK ) {
+   GST_WARNING("failed to push buffer %p. reason: %s", buf, gst_flow_get_name (ret));
+   buf = NULL;
+   goto error_exit;
+  }
+  return ret;
+
+send_reverse:
+  {
+    GstBuffer *MetaDataBuf = NULL;
+    GstClockTime headbuf_ts = GST_CLOCK_TIME_NONE;
+       GstClockTime tailbuf_ts = GST_CLOCK_TIME_NONE;
+
+    /* Discont buffers is mostly due to seek, when buffers of seeked timestamp gets pushed */
+    if (GST_BUFFER_IS_DISCONT(buf)) {
+      if(!g_queue_is_empty (audiotp->reverse)) {
+        GstBuffer *headbuf = (GstBuffer*) (audiotp->reverse->head->data);
+        GstBuffer *tailbuf = (GstBuffer*) (audiotp->reverse->tail->data);
+
+        headbuf_ts = GST_BUFFER_TIMESTAMP(headbuf);
+               tailbuf_ts = GST_BUFFER_TIMESTAMP(tailbuf);
+
+        GST_DEBUG_OBJECT(audiotp,"Headbuf ts =%" GST_TIME_FORMAT ", TailBuf ts =%" GST_TIME_FORMAT "",
+            GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(headbuf)),
+            GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(tailbuf)));
+
+        /* Check if the decoder is already having the reversal logic */
+        if(GST_BUFFER_TIMESTAMP(headbuf) > GST_BUFFER_TIMESTAMP(tailbuf)) {
+          GST_INFO_OBJECT (audiotp, "Buffers arrived in reverse order, audiotp NO NEED to reverse...");
+          audiotp->is_reversed = TRUE;
+        } else {
+          GST_INFO_OBJECT (audiotp, "Buffers arrived in forward order, audiotp NEED to reverse...");
+          audiotp->is_reversed = FALSE;
+        }
+      }
+
+      while (!g_queue_is_empty (audiotp->reverse)) {
+
+        if(audiotp->is_reversed)
+          MetaDataBuf = g_queue_pop_head (audiotp->reverse);
+        else
+          MetaDataBuf = g_queue_pop_tail (audiotp->reverse);
+
+        if (NULL == MetaDataBuf) {
+          GST_ERROR_OBJECT (audiotp, "NULL pointer...");
+          ret = GST_FLOW_ERROR;
+          goto error_exit;
+        }
+
+          /* If buffers arrive in forward order, compare the MetaDatabuf with
+               * previous head buffer timestamp.
+               * If buffers arrive in reverse order, compare the MetaDataBuf with
+               * previous tail buffer timestamp */
+        if((GST_BUFFER_TIMESTAMP(MetaDataBuf) < audiotp->head_prev && !audiotp->is_reversed)
+                               || (GST_BUFFER_TIMESTAMP(MetaDataBuf) < audiotp->tail_prev && audiotp->is_reversed)) {
+          ret = gst_audiotp_push_silent_frame (audiotp, MetaDataBuf);
+          if (MetaDataBuf) {
+            gst_buffer_unref (MetaDataBuf);
+            MetaDataBuf = NULL;
+          }
+
+          if (GST_FLOW_OK != ret) {
+            GST_WARNING_OBJECT (audiotp, "pad_push returned = %s", gst_flow_get_name (ret));
+            if (buf) {
+              gst_buffer_unref (buf);
+              buf = NULL;
+            }
+            return ret;
+          }
+        } else {
+          GST_DEBUG_OBJECT(audiotp, "Dropping the buffer out of segment with time-stamp %"GST_TIME_FORMAT,
+            GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(MetaDataBuf)));
+          if (MetaDataBuf) {
+            gst_buffer_unref (MetaDataBuf);
+            MetaDataBuf = NULL;
+          }
+        }
+      }
+
+      audiotp->head_prev = headbuf_ts;
+         audiotp->tail_prev = tailbuf_ts;
+    }
+
+    MetaDataBuf = gst_buffer_new ();
+    if (NULL == MetaDataBuf) {
+      GST_ERROR_OBJECT (audiotp, "Failed to create memory...");
+      ret = GST_FLOW_ERROR;
+      goto error_exit;
+    }
+
+    /* copy buffer timestamps & FLAGS to metadata buffer */
+    gst_buffer_copy_metadata (MetaDataBuf, buf, GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_CAPS);
+    GST_BUFFER_SIZE(MetaDataBuf) = GST_BUFFER_SIZE(buf);
+    GST_DEBUG_OBJECT (audiotp, "Pushing into reverse queue data of size: %d", GST_BUFFER_SIZE(MetaDataBuf));
+
+    /* queue all buffer timestamps till we receive next discontinuity */
+    g_queue_push_tail (audiotp->reverse, MetaDataBuf);
+    if (buf) {
+      gst_buffer_unref (buf);
+      buf = NULL;
+    }
+    return GST_FLOW_OK;
+  }
+
+#if 0
+/* May be useful in future */
+send_dummy:
+  {
+
+    /* Resetting the buffer data to zero */
+    memset(GST_BUFFER_DATA(buf), 0, GST_BUFFER_SIZE(buf));
+    gst_buffer_set_caps(buf, GST_PAD_CAPS(audiotp->srcpad));
+
+    ret = gst_pad_push(audiotp->srcpad, buf);
+    if (ret != GST_FLOW_OK) {
+     GST_ERROR("Failed to push buffer. reason: %s\n", gst_flow_get_name(ret));
+     buf = NULL;
+     goto error_exit;
+    }
+    return GST_FLOW_OK;
+  }
+#endif
+
+error_exit:
+
+  GST_WARNING_OBJECT(audiotp, "Returning from audiotp's chain with reason - %s", gst_flow_get_name (ret));
+  if (buf) {
+   gst_buffer_unref (buf);
+   buf = NULL;
+  }
+  return ret;
+}
+
+
+static GstFlowReturn
+gst_audiotp_push_silent_frame (Gstaudiotp *audiotp, GstBuffer *MetaDataBuf)
+{
+
+  GstBuffer *out = NULL;
+  GstFlowReturn ret = GST_FLOW_OK;
+
+  out = gst_buffer_new_and_alloc(GST_BUFFER_SIZE(MetaDataBuf));
+  if(out == NULL) {
+    GST_ERROR_OBJECT (audiotp, "Failed to allocate memory...");
+    return GST_FLOW_ERROR;
+  }
+
+  /* Memset the data of the out buffer so that silent frame is sent */
+  memset(GST_BUFFER_DATA(out), 0, GST_BUFFER_SIZE(out));
+
+  gst_buffer_copy_metadata (out, MetaDataBuf, GST_BUFFER_COPY_FLAGS);
+  GST_BUFFER_OFFSET (out) = GST_BUFFER_OFFSET_END (out) = 0;
+  GST_BUFFER_SIZE(out) = GST_BUFFER_SIZE(MetaDataBuf);
+  GST_BUFFER_TIMESTAMP(out) = GST_BUFFER_TIMESTAMP(MetaDataBuf);
+  GST_BUFFER_DURATION(out) = GST_BUFFER_DURATION(MetaDataBuf);
+
+  GST_LOG_OBJECT(audiotp, "Out buffer ts =%" GST_TIME_FORMAT ", dur=%" GST_TIME_FORMAT ", size=%d",
+       GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(out)),
+       GST_TIME_ARGS(GST_BUFFER_DURATION(out)),
+       GST_BUFFER_SIZE(out));
+
+  gst_buffer_set_caps(out, GST_PAD_CAPS(audiotp->srcpad));
+
+  ret = gst_pad_push(audiotp->srcpad, out);
+  if (ret != GST_FLOW_OK) {
+    GST_ERROR_OBJECT (audiotp, "Failed to push buffer. reason: %s\n", gst_flow_get_name(ret));
+    out = NULL;
+  }
+
+  return ret;
+}
+
+static gboolean
+gst_audiotp_plugin_init (GstPlugin *plugin)
+{
+  if (!gst_element_register (plugin, "audiotp", GST_RANK_PRIMARY, gst_audiotp_get_type())) {
+    return FALSE;
+  }
+  return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+                   GST_VERSION_MINOR,
+                   "audiotp",
+                   "Audio trickplay plugin",
+                   gst_audiotp_plugin_init,
+                   VERSION,
+                   "LGPL",
+                   "Samsung Electronics Co",
+                   "http://www.samsung.com")
diff --git a/audiotp/src/gstaudiotp.h b/audiotp/src/gstaudiotp.h
new file mode 100755 (executable)
index 0000000..0b3dc92
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * audiotp
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __GST_AUDIOTP_H__
+#define __GST_AUDIOTP_H__
+
+#include <gst/gst.h>
+#include <stdlib.h>
+#include <string.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AUDIOTP             (gst_audiotp_get_type())
+#define GST_AUDIOTP(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIOTP,Gstaudiotp))
+#define GST_AUDIOTP_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOTP,GstaudiotpClass))
+#define GST_AUDIOTP_GET_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS((klass),GST_TYPE_AUDIOTP,GstaudiotpClass))
+#define GST_IS_AUDIOTP(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIOTP))
+#define GST_IS_AUDIOTP_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOTP))
+#define GST_AUDIOTP_CAST(obj)        ((Gstaudiotp *)(obj))
+
+typedef struct _Gstaudiotp Gstaudiotp;
+typedef struct _GstaudiotpClass GstaudiotpClass;
+
+struct _Gstaudiotp
+{
+  GstElement element;
+  GstPad *sinkpad;
+  GstPad *srcpad;
+  GQueue *reverse; /* used in reverse trickplay */
+  GstSegment segment;
+
+  /* Flag to indicate the new buffer recieved is discountinued in
+  its time-stamp */
+  gboolean discont;
+  gboolean is_reversed;
+  GstClockTime head_prev;
+  GstClockTime tail_prev;
+};
+
+struct _GstaudiotpClass
+{
+  GstElementClass parent_class;
+};
+
+GType gst_audiotp_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_AUDIOTP_H__ */
\ No newline at end of file
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..d4c6d40
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+# you can either set the environment variables AUTOCONF and AUTOMAKE
+# to the right versions, or leave them unset and get the RedHat 7.3 defaults
+
+aclocal -I m4 -I common/m4
+libtoolize --copy --force
+autoheader
+autoconf
+automake --add-missing --copy --foreign
+
+echo "Now type 'make' to compile $package."
+
diff --git a/autoregen.sh b/autoregen.sh
new file mode 100755 (executable)
index 0000000..c67a299
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./autogen.sh  $@
diff --git a/avsystem/Makefile.am b/avsystem/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/avsystem/src/Makefile.am b/avsystem/src/Makefile.am
new file mode 100644 (file)
index 0000000..dd1576e
--- /dev/null
@@ -0,0 +1,60 @@
+
+# plugindir is set in configure
+
+plugin_LTLIBRARIES = libgstavsysaudiosrc.la
+
+# sources used to compile this plug-in
+libgstavsysaudiosrc_la_SOURCES = gstavsyssrc.c \
+                                 gstavsysaudiosrc.c
+
+libgstavsysaudiosrc_la_CFLAGS = $(GST_CFLAGS) \
+                           $(GST_BASE_CFLAGS) \
+                           $(AVSYSTEM_CFLAGS) \
+                           $(GST_VIDEO_FLAGS) \
+                           -I$(includedir)/mmf \
+                           $(MMTA_CFLAGS) \
+                           $(GST_AUDIO_CFLAGS) \
+                           $(VCONF_CFLAGS) \
+                           $(AVSYSAUDIO_CFLAGS)
+
+libgstavsysaudiosrc_la_LIBADD = $(GST_LIBS) \
+                           $(GST_BASE_LIBS) \
+                           $(DATACOMLIB_LIBS) \
+                           $(HTTPLIB_LIBS) \
+                           $(AVSYSTEM_LIBS) \
+                           $(GST_VIDEO_LIBS) \
+                           -lgstaudio-0.10 \
+                           $(MMTA_LIBS) \
+                           $(GST_AUDIO_LIBS) \
+                           -ldl \
+                           $(VCONF_LIBS) \
+                           $(AVSYSAUDIO_LIBS)
+
+libgstavsysaudiosrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+if IS_I386
+libgstavsysaudiosrc_la_CFLAGS += -DI386_SIMULATOR
+else
+endif
+
+plugin_LTLIBRARIES += libgstavsyssink.la
+
+## sources used to compile this plug-in
+libgstavsyssink_la_SOURCES = gstavsyssink.c \
+                        gstavsysmemsink.c
+
+libgstavsyssink_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(AVSYSVIDEO_CFLAGS) $(AVSYSTEM_CFLAGS) -I$(includedir)/mmf
+libgstavsyssink_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(DATACOMLIB_LIBS) $(HTTPLIB_LIBS) $(AVSYSVIDEO_LIBS) $(AVSYSTEM_LIBS) $(GST_VIDEO_LIBS) -lgstaudio-0.10 -ldl
+libgstavsyssink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+
+libgstavsyssink_la_SOURCES += gstavsysaudiosink.c
+libgstavsyssink_la_CFLAGS  += $(AVSYSAUDIO_CFLAGS)
+libgstavsyssink_la_LIBADD  += $(AVSYSAUDIO_LIBS)
+
+if IS_I386
+libgstavsyssink_la_CFLAGS += -DI386_SIMULATOR
+else
+endif
+
+
diff --git a/avsystem/src/gstavsysaudiosink.c b/avsystem/src/gstavsysaudiosink.c
new file mode 100644 (file)
index 0000000..bbf8e10
--- /dev/null
@@ -0,0 +1,872 @@
+/*
+ * avsystem
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+
+
+#include <gst/gst.h>
+#include <gst/gstutils.h>
+
+#include <string.h>
+
+#include "gstavsysaudiosink.h"
+
+#define _ALSA_DAPM_
+#define __REPLACE_RESET_WITH_CLOSE_AND_REOPEN__
+
+#define CONVERT_MUTE_VALUE(_mute) ((_mute) ? AVSYS_AUDIO_MUTE : AVSYS_AUDIO_UNMUTE)
+
+GST_DEBUG_CATEGORY_EXTERN (avsystem_sink_debug);
+#define GST_CAT_DEFAULT avsystem_sink_debug
+
+#define DEFAULT_USER_ROUTE     AVSYSAUDIOSINK_USERROUTE_AUTO
+#define DEFAULT_AUDIO_ROUTE    AVSYSAUDIOSINK_AUDIOROUTE_USE_EXTERNAL_SETTING
+#define DEFAULT_VOLUME_TYPE            AVSYS_AUDIO_VOLUME_TYPE_MEDIA
+#define DEFAULT_MEDIACALL_MODE AVSYS_AUDIO_ECHO_MODE_NONE
+#define DEFAULT_FADEUP_VOLUME  FALSE
+#define DEFAULT_AUDIO_MUTE     AVSYSAUDIOSINK_AUDIO_UNMUTE
+#define DEFAULT_AUDIO_LATENCY  AVSYSAUDIOSINK_LATENCY_MID
+
+
+//GST_DEBUG_CATEGORY_STATIC (gst_avsystemsink_debug);
+
+/* element factory information */
+static const GstElementDetails gst_avsysaudiosink_details =
+       GST_ELEMENT_DETAILS ("AV-system Audio OUT",
+                                               "Sink/Audio",
+                                               "Output to AV System",
+                                               "Samsung Electronics co., ltd");
+
+enum
+{
+       PROP_0,
+       PROP_AUDIO_MUTE,
+       PROP_AUDIO_VOLUME_TYPE,
+       PROP_AUDIO_PRIORITY,
+       PROP_AUDIO_FADEUPVOLUME,
+       PROP_AUDIO_ROUTE_POLICY,
+       PROP_AUDIO_USER_ROUTE,
+       PROP_AUDIO_LATENCY,
+       PROP_AUDIO_HANDLE,
+       PROP_AUDIO_CALLBACK
+};
+
+GType
+gst_avsysaudiosink_audio_mute_get_type (void)
+{
+       static GType avaudio_mute_type = 0;
+       static const GEnumValue avaudio_mute[] = {
+               {AVSYSAUDIOSINK_AUDIO_UNMUTE, "Unmute", "unmute"},
+               {AVSYSAUDIOSINK_AUDIO_MUTE, "Mute immediately", "mute"},
+               {AVSYSAUDIOSINK_AUDIO_MUTE_WITH_FADEDOWN_EFFECT, "Mute with fadedown effect", "fadedown"},
+               {0, NULL, NULL},
+       };
+
+       if (!avaudio_mute_type) {
+               avaudio_mute_type =
+                       g_enum_register_static ("GstAvsysAudioSinkAudioMute", avaudio_mute);
+       }
+       return avaudio_mute_type;
+}
+
+GType
+gst_avsysaudiosink_user_route_get_type (void)
+{
+       static GType user_route_type = 0;
+       static const GEnumValue user_route[] = {
+               {AVSYSAUDIOSINK_USERROUTE_AUTO, "Route automatically", "auto"},
+               {AVSYSAUDIOSINK_USERROUTE_PHONE, "Route to phone only", "phone"},
+               {0, NULL, NULL},
+       };
+
+       if (!user_route_type) {
+               user_route_type =
+                       g_enum_register_static ("GstAvsysAudioSinkUserRoutePolicy",user_route);
+       }
+       return user_route_type;
+}
+
+GType
+gst_avsysaudiosink_audio_route_get_type (void)
+{
+       static GType playback_audio_route_type = 0;
+       static const GEnumValue playback_audio_route[] = {
+               {AVSYSAUDIOSINK_AUDIOROUTE_USE_EXTERNAL_SETTING, "Use external sound path", "external"},
+               {AVSYSAUDIOSINK_AUDIOROUTE_PLAYBACK_NORMAL, "Auto change between speaker & earphone", "normal"},
+               {AVSYSAUDIOSINK_AUDIOROUTE_PLAYBACK_ALERT, "Play via both speaker & earphone", "alert"},
+               {AVSYSAUDIOSINK_AUDIOROUTE_PLAYBACK_HEADSET_ONLY, "Play via earphone only", "headset"},
+               {0, NULL, NULL},
+       };
+
+       if (!playback_audio_route_type) {
+               playback_audio_route_type =
+                       g_enum_register_static ("GstAvsysAudioSinkAudioRoutePolicy", playback_audio_route);
+       }
+       return playback_audio_route_type;
+}
+
+GType
+gst_avsysaudiosink_latency_get_type (void)
+{
+       static GType avsysaudio_latency_type = 0;
+       static const GEnumValue avsysaudio_latency[] = {
+               {AVSYSAUDIOSINK_LATENCY_LOW, "Low latency", "low"},
+               {AVSYSAUDIOSINK_LATENCY_MID, "Mid latency", "mid"},
+               {AVSYSAUDIOSINK_LATENCY_HIGH, "High latency", "high"},
+               {0, NULL, NULL},
+       };
+
+       if (!avsysaudio_latency_type) {
+               avsysaudio_latency_type =
+                       g_enum_register_static ("GstAvsysAudioSinkLatency", avsysaudio_latency);
+       }
+       return avsysaudio_latency_type;
+}
+
+static void gst_avsysaudiosink_init_interfaces (GType type);
+
+//#define GST_BOILERPLATE_FULL(type, type_as_function, parent_type, parent_type_macro, additional_initializations)
+
+GST_BOILERPLATE_FULL (GstAvsysAudioSink, gst_avsysaudiosink, GstAudioSink,
+                                         GST_TYPE_AUDIO_SINK, gst_avsysaudiosink_init_interfaces);
+
+
+static void gst_avsysaudiosink_finalise (GObject * object);
+static void gst_avsysaudiosink_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_avsysaudiosink_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
+#if 0  /*not use*/
+static GstCaps *gst_avsysaudiosink_getcaps (GstBaseSink * bsink);
+#endif
+
+static gboolean gst_avsysaudiosink_avsys_close(GstAvsysAudioSink *avsys_audio);
+static gboolean gst_avsysaudiosink_avsys_open(GstAvsysAudioSink *avsys_audio);
+
+static gboolean gst_avsysaudiosink_open (GstAudioSink * asink);
+static gboolean gst_avsysaudiosink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec);
+static gboolean gst_avsysaudiosink_unprepare (GstAudioSink * asink);
+static gboolean gst_avsysaudiosink_close (GstAudioSink * asink);
+static guint gst_avsysaudiosink_write (GstAudioSink * asink, gpointer data, guint length);
+static guint gst_avsysaudiosink_delay (GstAudioSink * asink);
+static void gst_avsysaudiosink_reset (GstAudioSink * asink);
+static gboolean avsysaudiosink_post_message(GstAvsysAudioSink* self,int errorcode);
+
+
+#define AVSYS_AUDIO_FACTORY_ENDIANNESS "LITTLE_ENDIAN"
+
+
+static GstStaticPadTemplate avsysaudiosink_sink_factory =
+       GST_STATIC_PAD_TEMPLATE ("sink",
+                                                        GST_PAD_SINK,
+                                                        GST_PAD_ALWAYS,
+                                                        GST_STATIC_CAPS ("audio/x-raw-int, "
+                                                                        "endianness = (int) { " AVSYS_AUDIO_FACTORY_ENDIANNESS " }, "
+                                                                        "signed = (boolean) { TRUE }, "
+                                                                        "width = (int) 16, "
+                                                                        "depth = (int) 16, "
+                                                                        "rate = (int) [ 1, MAX ], "
+                                                                        "channels = (int) [ 1, 6 ]; "
+                                                                        "audio/x-raw-int, "
+                                                                        "signed = (boolean) { FALSE }, "
+                                                                        "width = (int) 8, "
+                                                                        "depth = (int) 8, "
+                                                                        "rate = (int) [ 1, MAX ], "
+                                                                        "channels = (int) [ 1, 6 ] "
+                                                                )
+                                                        );
+/*
+static inline guint _time_to_sample(GstAvsysAudioSink * asink,  GstClockTime diff)
+{
+       guint result = 0;
+       result =(GST_TIME_AS_USECONDS(diff) * asink->audio_param.samplerate)/1000000;
+       return result;
+}
+*/
+
+static void
+gst_avsysaudiosink_finalise (GObject * object)
+{
+       GstAvsysAudioSink *sink = NULL;
+
+       sink = GST_AVSYS_AUDIO_SINK (object);
+       gst_avsysaudiosink_avsys_close(sink);
+       g_mutex_free (sink->avsys_audio_lock);
+       g_mutex_free (sink->avsys_audio_reset_lock);
+
+       G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_avsysaudiosink_init_interfaces (GType type)
+{
+       /* None */
+}
+
+static void
+gst_avsysaudiosink_base_init (gpointer g_class)
+{
+       GstElementClass *element_class = NULL;
+
+       element_class = GST_ELEMENT_CLASS (g_class);
+       gst_element_class_set_details (element_class, &gst_avsysaudiosink_details);
+       gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&avsysaudiosink_sink_factory));
+}
+
+static GstStateChangeReturn
+gst_avsyssudiosink_change_state (GstElement *element, GstStateChange transition);
+
+
+static void
+gst_avsysaudiosink_class_init (GstAvsysAudioSinkClass * klass)
+{
+       GObjectClass *gobject_class;
+       GstElementClass *gstelement_class;
+       GstBaseSinkClass *gstbasesink_class;
+       GstBaseAudioSinkClass *gstbaseaudiosink_class;
+       GstAudioSinkClass *gstaudiosink_class;
+
+       gobject_class = (GObjectClass *) klass;
+       gstelement_class = (GstElementClass *) klass;
+       gstbasesink_class = (GstBaseSinkClass *) klass;
+       gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
+       gstaudiosink_class = (GstAudioSinkClass *) klass;
+
+       parent_class = g_type_class_peek_parent (klass);
+       gstelement_class->change_state  = GST_DEBUG_FUNCPTR(gst_avsyssudiosink_change_state);
+
+       gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_finalise);
+       gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_get_property);
+       gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_set_property);
+
+       //      gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_getcaps);
+
+       gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_open);
+       gstaudiosink_class->prepare = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_prepare);
+       gstaudiosink_class->unprepare = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_unprepare);
+       gstaudiosink_class->close = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_close);
+       gstaudiosink_class->write = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_write);
+       gstaudiosink_class->delay = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_delay);
+       gstaudiosink_class->reset = GST_DEBUG_FUNCPTR (gst_avsysaudiosink_reset);
+
+       g_object_class_install_property (  gobject_class, PROP_AUDIO_VOLUME_TYPE,
+                       g_param_spec_int ("volumetype", "Avsystem Volume Type",
+                                       "Select avsystem audio software volume type", 0, G_MAXINT,
+                                       DEFAULT_VOLUME_TYPE, G_PARAM_READWRITE));
+
+       g_object_class_install_property (  gobject_class, PROP_AUDIO_PRIORITY,
+                       g_param_spec_int ("priority", "Avsystem Sound Priority", "Avsystem sound priority",
+                                       AVSYS_AUDIO_PRIORITY_NORMAL, AVSYS_AUDIO_PRIORITY_SOLO_WITH_TRANSITION_EFFECT,
+                                       AVSYS_AUDIO_PRIORITY_NORMAL, G_PARAM_READWRITE));
+
+       g_object_class_install_property (  gobject_class, PROP_AUDIO_HANDLE,
+                       g_param_spec_pointer("audio-handle", "Avsystem handle",
+                                       "Avsystem audio handle", 
+                                       G_PARAM_READWRITE));
+
+       g_object_class_install_property (  gobject_class, PROP_AUDIO_CALLBACK,
+                       g_param_spec_pointer("audio-callback", "Avsystem callback",
+                                       "Avsystem audio callback", 
+                                       G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_class, PROP_AUDIO_FADEUPVOLUME,
+                       g_param_spec_boolean ("fadeup", "Avsystem fadeup volume",
+                                       "Enable avsystem audio fadeup volume when pause to play",
+                                       DEFAULT_FADEUP_VOLUME, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_class ,PROP_AUDIO_MUTE,
+                       g_param_spec_enum("mute", "Avsystem mute",
+                                       "Avsystem audio mute",
+                                       GST_AVSYS_AUDIO_SINK_MUTE, DEFAULT_AUDIO_MUTE,
+                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS ));
+
+       g_object_class_install_property (gobject_class ,PROP_AUDIO_ROUTE_POLICY,
+                       g_param_spec_enum("audio-route", "Audio Route Policy",
+                                       "Audio route policy of system",
+                                       GST_AVSYS_AUDIO_SINK_AUDIO_ROUTE, DEFAULT_AUDIO_ROUTE,
+                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS ));
+       
+       g_object_class_install_property (gobject_class ,PROP_AUDIO_USER_ROUTE,
+                       g_param_spec_enum("user-route", "User Route Policy",
+                                       "User route policy",
+                                       GST_AVSYS_AUDIO_SINK_USER_ROUTE, DEFAULT_USER_ROUTE,
+                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS ));
+
+       g_object_class_install_property (gobject_class ,PROP_AUDIO_LATENCY,
+                       g_param_spec_enum("latency", "Audio Backend Latency",
+                                       "Audio backend latency",
+                                       GST_AVSYS_AUDIO_SINK_LATENCY_TYPE, DEFAULT_AUDIO_LATENCY,
+                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS ));
+}
+
+static void
+gst_avsysaudiosink_set_property (GObject * object, guint prop_id,
+                                                        const GValue * value, GParamSpec * pspec)
+{
+       GstAvsysAudioSink *sink = NULL;
+       int nvalue = 0;
+       gboolean nbool = FALSE;
+
+       sink = GST_AVSYS_AUDIO_SINK (object);
+
+       switch (prop_id) {
+       case PROP_AUDIO_HANDLE:
+               sink->cbHandle = g_value_get_pointer(value);
+               break;
+       case PROP_AUDIO_CALLBACK:
+               sink->audio_stream_cb = g_value_get_pointer(value);
+               break;
+       case PROP_AUDIO_VOLUME_TYPE:
+               nvalue = g_value_get_int(value);
+               sink->volume_type = nvalue;
+               if (sink->audio_handle != (avsys_handle_t)-1) {
+                       avsys_audio_update_volume_config(sink->audio_handle, sink->volume_type);
+               }
+               break;
+       case PROP_AUDIO_PRIORITY:
+               nvalue = g_value_get_int(value);
+               sink->sound_priority = nvalue;
+               break;
+       case PROP_AUDIO_MUTE:
+               nvalue = g_value_get_enum(value);
+               if (sink->audio_handle != (avsys_handle_t)-1) {
+                       if(AVSYS_SUCCESS(avsys_audio_set_mute_fadedown(sink->audio_handle)))
+                               sink->mute = nvalue;
+               } else {
+                       sink->mute = nvalue;
+               }
+               break;
+       case PROP_AUDIO_FADEUPVOLUME:
+               nbool = g_value_get_boolean(value);
+               sink->use_fadeup_volume = nbool;
+               break;
+       case PROP_AUDIO_ROUTE_POLICY:
+               nvalue = g_value_get_enum(value);
+               sink->audio_route_policy = nvalue;
+               switch (sink->audio_route_policy) {
+               case AVSYSAUDIOSINK_AUDIOROUTE_USE_EXTERNAL_SETTING:
+                       GST_INFO_OBJECT(sink, "use external audio route setting");
+                       break;
+               default:
+                       g_print("AVSYSAUDIOSINK :: Unknown audio route option %d\n", sink->audio_route_policy);
+                       GST_ERROR_OBJECT(sink, "Unknown audio route option %d", sink->audio_route_policy);
+                       break;
+               }
+               break;
+       case PROP_AUDIO_USER_ROUTE:
+               nvalue = g_value_get_enum(value);
+               sink->user_route_policy = nvalue;
+               break;
+       case PROP_AUDIO_LATENCY:
+               nvalue = g_value_get_enum(value);
+               sink->latency = nvalue;
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gst_avsysaudiosink_get_property (GObject * object, guint prop_id,
+                                                        GValue * value, GParamSpec * pspec)
+{
+       GstAvsysAudioSink *sink = NULL;
+
+       sink = GST_AVSYS_AUDIO_SINK (object);
+
+       switch (prop_id) {
+       case PROP_AUDIO_VOLUME_TYPE:
+               g_value_set_int(value, sink->volume_type);
+               break;
+       case PROP_AUDIO_PRIORITY:
+               g_value_set_int(value, sink->sound_priority);
+               break;
+       case PROP_AUDIO_MUTE:
+               g_value_set_enum(value, sink->mute);
+               break;
+       case PROP_AUDIO_FADEUPVOLUME:
+               g_value_set_boolean(value, sink->use_fadeup_volume);
+               break;
+       case PROP_AUDIO_ROUTE_POLICY:
+               g_value_set_enum(value, sink->audio_route_policy);
+               break;
+       case PROP_AUDIO_USER_ROUTE:
+               g_value_set_enum(value, sink->user_route_policy);
+               break;
+       case PROP_AUDIO_LATENCY:
+               g_value_set_enum(value, sink->latency);
+               break;
+
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gst_avsysaudiosink_init (GstAvsysAudioSink * avsysaudiosink, GstAvsysAudioSinkClass * g_class)
+{
+       GST_DEBUG_OBJECT (avsysaudiosink, "initializing avsysaudiosink");
+
+       avsysaudiosink->audio_handle = (avsys_handle_t)-1;
+       avsysaudiosink->cached_caps = NULL;
+       avsysaudiosink->avsys_audio_lock = g_mutex_new ();
+       avsysaudiosink->avsys_audio_reset_lock = g_mutex_new ();
+       avsysaudiosink->volume_type = DEFAULT_VOLUME_TYPE;
+       avsysaudiosink->sound_priority = AVSYS_AUDIO_PRIORITY_NORMAL;
+       avsysaudiosink->mute = DEFAULT_AUDIO_MUTE;
+       avsysaudiosink->use_fadeup_volume = DEFAULT_FADEUP_VOLUME;
+       avsysaudiosink->latency = DEFAULT_AUDIO_LATENCY;
+       avsysaudiosink->audio_route_policy = DEFAULT_AUDIO_ROUTE;
+       avsysaudiosink->bytes_per_sample = 1;
+#if defined (LPCM_DUMP_SUPPORT)
+       avsysaudiosink->dumpFp = NULL;
+#endif
+
+}
+#if 0
+static GstCaps *
+gst_avsysaudiosink_getcaps (GstBaseSink * bsink)
+{
+    GstElementClass *element_class = NULL;
+    GstPadTemplate *pad_template = NULL;
+    GstAvsysAudioSink *sink = GST_AVSYS_AUDIO_SINK (bsink);
+    GstCaps *caps;
+
+//    debug_fenter();
+
+    sink = GST_AVSYS_AUDIO_SINK (bsink);
+    if (sink->audio_handle == -1)
+    {
+        GST_DEBUG_OBJECT (sink, "avsystem audio not open, using template caps");
+        return NULL;              /* base class will get template caps for us */
+    }
+
+    if (sink->cached_caps)
+    {
+        GST_LOG_OBJECT (sink, "Returning cached caps");
+        return gst_caps_ref (sink->cached_caps);
+    }
+
+    element_class = GST_ELEMENT_GET_CLASS (sink);
+    pad_template = gst_element_class_get_pad_template (element_class, "sink");
+    g_return_val_if_fail (pad_template != NULL, NULL);
+
+       // todo : get supported format.
+       //caps = gst_avsysaudio_probe_supported_formats (GST_OBJECT (sink), sink->,
+       //gst_pad_template_get_caps (pad_template));
+
+       //if (caps) {
+       //sink->cached_caps = gst_caps_ref (caps);
+       //}
+
+    GST_INFO_OBJECT (sink, "returning caps %" GST_PTR_FORMAT, caps);
+
+    return caps;
+}
+#endif
+
+static gboolean
+avsysaudiosink_parse_spec (GstAvsysAudioSink * avsys_audio, GstRingBufferSpec * spec)
+{
+       /* Check param */
+       if (spec->type != GST_BUFTYPE_LINEAR ||
+               spec->channels > 6 || spec->channels < 1 ||
+               !(spec->format == GST_S8 || spec->format == GST_S16_LE) )
+               return FALSE;
+
+       switch (spec->format) {
+       case GST_S8:
+               avsys_audio->audio_param.format = AVSYS_AUDIO_FORMAT_8BIT;
+               avsys_audio->bytes_per_sample = 1;
+               break;
+       case GST_S16_LE:
+               avsys_audio->audio_param.format = AVSYS_AUDIO_FORMAT_16BIT;
+               avsys_audio->bytes_per_sample = 2;
+               break;
+       default:
+               return FALSE;
+       }
+
+       /// set audio parameter for avsys audio open
+       switch (avsys_audio->latency) {
+       case AVSYSAUDIOSINK_LATENCY_LOW:
+               avsys_audio->audio_param.mode = AVSYS_AUDIO_MODE_OUTPUT_VIDEO;
+               break;
+       case AVSYSAUDIOSINK_LATENCY_MID:
+               avsys_audio->audio_param.mode = AVSYS_AUDIO_MODE_OUTPUT;
+               break;
+       case AVSYSAUDIOSINK_LATENCY_HIGH:
+               avsys_audio->audio_param.mode = AVSYS_AUDIO_MODE_OUTPUT_CLOCK;
+               break;
+       }
+
+       avsys_audio->audio_param.priority = 0;
+       avsys_audio->audio_param.samplerate = spec->rate;
+       avsys_audio->audio_param.channels = spec->channels;
+       avsys_audio->bytes_per_sample *= spec->channels;
+
+       /* set software volume table type */
+       avsys_audio->audio_param.vol_type = avsys_audio->volume_type;
+       avsys_audio->audio_param.priority = avsys_audio->sound_priority;
+       avsys_audio->audio_param.handle_route = avsys_audio->user_route_policy;
+
+       return TRUE;
+}
+
+static gboolean
+gst_avsysaudiosink_open (GstAudioSink * asink)
+{
+       return TRUE;
+}
+
+static gboolean
+gst_avsysaudiosink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
+{
+       GstAvsysAudioSink *avsys_audio = NULL;
+       guint   p_time = 0, b_time = 0;
+
+       avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+
+       // set avsys audio param
+       if (!avsysaudiosink_parse_spec (avsys_audio, spec))
+               goto spec_parse;
+
+       if (gst_avsysaudiosink_avsys_open(avsys_audio) == FALSE) {
+               GST_ERROR_OBJECT(avsys_audio, "gst_avsysaudiosink_avsys_open() failed");
+               return FALSE;
+       }
+
+       /* Ring buffer size */
+       if (AVSYS_STATE_SUCCESS ==
+               avsys_audio_get_period_buffer_time(avsys_audio->audio_handle, &p_time, &b_time)) {
+               if(p_time == 0 || b_time == 0)
+                       return FALSE;
+
+               spec->latency_time = (guint64)p_time;
+               spec->buffer_time = (guint64)b_time;
+       } else {
+               return FALSE;
+       }
+       spec->segsize = avsys_audio->avsys_size; /* '/16' see avsys_audio_open */
+       spec->segtotal = (b_time / p_time) + (((b_time % p_time)/p_time > 0.5) ? 1: 0);
+       //spec->segtotal+2;
+
+       GST_WARNING_OBJECT (avsys_audio, "latency time %u, buffer time %u, seg total %u\n",
+                       (unsigned int)(spec->latency_time/1000), (unsigned int)(spec->buffer_time/1000), spec->segtotal);
+       return TRUE;
+
+spec_parse:
+       {
+               GST_ELEMENT_ERROR (avsys_audio, RESOURCE, SETTINGS, (NULL),
+                                                  ("Setting of swparams failed: " ));
+               return FALSE;
+       }
+}
+
+static gboolean
+gst_avsysaudiosink_unprepare (GstAudioSink * asink)
+{
+       GstAvsysAudioSink       *avsys_audio = NULL;
+       gboolean                        result = TRUE;
+       avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+
+       if(!gst_avsysaudiosink_avsys_close(avsys_audio))
+       {
+               GST_ERROR_OBJECT(avsys_audio, "gst_avsysaudiosink_avsys_close() failed");
+               result = FALSE;
+       }
+
+       return result;
+}
+
+static gboolean
+gst_avsysaudiosink_close (GstAudioSink * asink)
+{
+       GstAvsysAudioSink *avsys_audio = NULL;
+
+       avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+       gst_caps_replace (&avsys_audio->cached_caps, NULL);
+
+       return TRUE;
+}
+
+
+/*
+ *   Underrun and suspend recovery
+ */
+
+static guint
+gst_avsysaudiosink_write (GstAudioSink * asink, gpointer data, guint length)
+{
+       GstAvsysAudioSink *avsys_audio = NULL;
+       gint    write_len = 0;
+
+       avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+       GST_AVSYS_AUDIO_SINK_LOCK (asink);
+
+       if (avsys_audio->audio_stream_cb == NULL) {
+       write_len = avsys_audio_write(avsys_audio->audio_handle, data, length);
+
+#if defined (LPCM_DUMP_SUPPORT)
+               fwrite(data, 1, write_len, avsys_audio->dumpFp); //This is for original data (no volume convert)
+#endif
+               if(write_len != length)
+               {
+                   goto write_error;
+               }
+
+               GST_AVSYS_AUDIO_SINK_UNLOCK (asink);
+
+               return write_len;
+write_error:
+               {
+                       GST_AVSYS_AUDIO_SINK_UNLOCK (asink);
+
+                       if(AVSYS_FAIL(write_len))
+                       {
+                               GST_ERROR_OBJECT(avsys_audio, "avsys_audio_write() failed with %d\n", write_len);
+                       }
+                       return length;              /* skip one period */
+               }
+       } else {
+               gboolean result;
+               result = avsys_audio->audio_stream_cb(data, length, avsys_audio->cbHandle);
+               if(!result)
+               {
+                       GST_ERROR_OBJECT(avsys_audio,"auido stream callback failed\n");
+               }
+               GST_AVSYS_AUDIO_SINK_UNLOCK (asink);
+               return length;
+       }
+}
+
+static guint
+gst_avsysaudiosink_delay (GstAudioSink * asink)
+{
+       GstAvsysAudioSink *avsys_audio = NULL;
+       int delay = 0;
+       guint retValue = 0;
+
+       avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+       GST_AVSYS_AUDIO_SINK_RESET_LOCK (asink);
+       if ((int)avsys_audio->audio_handle != -1) {
+               if (AVSYS_STATE_SUCCESS == avsys_audio_delay(avsys_audio->audio_handle, &delay)) {
+                       retValue = delay;
+               }
+       }
+       GST_AVSYS_AUDIO_SINK_RESET_UNLOCK (asink);
+       return retValue;
+}
+
+static void
+gst_avsysaudiosink_reset (GstAudioSink * asink)
+{
+       GstAvsysAudioSink *avsys_audio = NULL;
+       int avsys_result = AVSYS_STATE_SUCCESS;
+
+       GST_AVSYS_AUDIO_SINK_LOCK (asink);
+       avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+
+#if defined(__REPLACE_RESET_WITH_CLOSE_AND_REOPEN__)
+       GST_AVSYS_AUDIO_SINK_RESET_LOCK (asink);
+       avsys_result = avsys_audio_close (avsys_audio->audio_handle);
+       if(AVSYS_FAIL(avsys_result)) {
+               GST_ERROR_OBJECT (avsys_audio, "avsys_audio_close: internal error: ");
+       } else {
+               avsys_audio->audio_handle =(avsys_handle_t) -1;
+       }
+       GST_AVSYS_AUDIO_SINK_RESET_UNLOCK (asink);
+#else
+       if(AVSYS_STATE_SUCCESS != avsys_audio_reset(avsys_audio->audio_handle)) {
+               GST_ERROR_OBJECT (avsys_audio, "avsys-reset: internal error: ");
+       }
+#endif
+
+       GST_AVSYS_AUDIO_SINK_UNLOCK (asink);
+
+       return;
+}
+
+
+static gboolean
+gst_avsysaudiosink_avsys_open(GstAvsysAudioSink *avsys_audio)
+{
+       int avsys_result;
+
+       GST_AVSYS_AUDIO_SINK_LOCK(avsys_audio);
+       if (avsys_audio->audio_handle == (avsys_handle_t)-1) {
+
+               GST_LOG_OBJECT (avsys_audio, "avsys_audio_open() with user policy [%d] ",  avsys_audio->user_route_policy);
+
+               avsys_result = avsys_audio_open(&avsys_audio->audio_param, &avsys_audio->audio_handle, &avsys_audio->avsys_size);
+               if (avsys_result != AVSYS_STATE_SUCCESS) {
+                       GST_AVSYS_AUDIO_SINK_UNLOCK (avsys_audio);
+                       avsysaudiosink_post_message(avsys_audio, avsys_result);
+                       return FALSE;
+               }
+
+               GST_LOG_OBJECT (avsys_audio, "Opened av system ");
+
+               GST_AVSYS_AUDIO_SINK_UNLOCK (avsys_audio);
+       } else {
+               GST_WARNING_OBJECT(avsys_audio, "audio handle has already opened");
+               GST_AVSYS_AUDIO_SINK_UNLOCK (avsys_audio);
+               return FALSE;
+       }
+#if defined (LPCM_DUMP_SUPPORT)
+       if (avsys_audio->dumpFp == NULL) {
+               avsys_audio->dumpFp = fopen("/root/dump.lpcm","w");
+       }
+#endif
+       return TRUE;
+}
+
+static gboolean
+gst_avsysaudiosink_avsys_close(GstAvsysAudioSink *avsys_audio)
+{
+       int avsys_result = AVSYS_STATE_SUCCESS;
+
+       GST_AVSYS_AUDIO_SINK_LOCK (avsys_audio);
+
+       if (avsys_audio->audio_handle !=  (avsys_handle_t)-1 ) {
+               avsys_result = avsys_audio_close(avsys_audio->audio_handle);
+
+               if (AVSYS_FAIL(avsys_result))
+               {
+                       GST_ERROR_OBJECT(avsys_audio,
+                                       "avsys_audio_close() failed with 0x%x", avsys_result);
+                       GST_AVSYS_AUDIO_SINK_UNLOCK (avsys_audio);
+                       return FALSE;
+               } else {
+                       avsys_audio->audio_handle = (avsys_handle_t) -1;
+                       GST_INFO_OBJECT(avsys_audio, "avsys_audio_close() success");
+               }
+
+               GST_LOG_OBJECT (avsys_audio, "Closed av system ");
+       } else {
+               GST_WARNING_OBJECT(avsys_audio, "audio handle has already closed");
+       }
+
+       GST_AVSYS_AUDIO_SINK_UNLOCK (avsys_audio);
+#if defined (LPCM_DUMP_SUPPORT)
+       if(avsys_audio->dumpFp != NULL)
+       {
+               fclose(avsys_audio->dumpFp);
+               avsys_audio->dumpFp = NULL;
+       }
+#endif
+       return TRUE;
+}
+
+static GstStateChangeReturn
+gst_avsyssudiosink_change_state (GstElement *element, GstStateChange transition)
+{
+       GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+       GstAvsysAudioSink *avsys_audio = GST_AVSYS_AUDIO_SINK (element);
+
+       int avsys_result = AVSYS_STATE_SUCCESS;
+
+       switch (transition) {
+               case GST_STATE_CHANGE_NULL_TO_READY:
+                       break;
+               case GST_STATE_CHANGE_READY_TO_PAUSED:
+                       break;
+               case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+#if defined(_ALSA_DAPM_)
+                       switch(avsys_audio->audio_route_policy) {
+                       case AVSYSAUDIOSINK_AUDIOROUTE_USE_EXTERNAL_SETTING:
+                               GST_INFO_OBJECT(avsys_audio, "audio route uses external setting");
+                               break;
+                       default:
+                               GST_ERROR_OBJECT(avsys_audio, "Unknown audio route option %d\n", avsys_audio->audio_route_policy);
+                               break;
+                       }
+#endif
+#if defined(__REPLACE_RESET_WITH_CLOSE_AND_REOPEN__)
+                       if (avsys_audio->audio_handle == (avsys_handle_t)-1) {
+                               avsys_result = avsys_audio_open(&avsys_audio->audio_param, &avsys_audio->audio_handle, &avsys_audio->avsys_size);
+                               if (AVSYS_FAIL(avsys_result)) {
+                                       GST_ERROR_OBJECT (avsys_audio, "avsys_audio_open: internal error: ");
+                                       return GST_STATE_CHANGE_FAILURE;
+                               }
+                       }
+#endif
+
+                       if (avsys_audio->use_fadeup_volume) {
+                               GST_INFO_OBJECT(avsys_audio, "Set fadeup volume");
+                               avsys_audio_set_volume_fadeup(avsys_audio->audio_handle);
+                       }
+
+                       if(AVSYS_STATE_SUCCESS != avsys_audio_set_mute(avsys_audio->audio_handle, CONVERT_MUTE_VALUE(avsys_audio->mute)))
+                       {
+                               GST_ERROR_OBJECT(avsys_audio, "Set mute failed %d", CONVERT_MUTE_VALUE(avsys_audio->mute));
+                       }
+                       break;
+               default:
+                       break;
+       }
+       ret = GST_ELEMENT_CLASS(parent_class)->change_state (element, transition);
+       if (ret == GST_STATE_CHANGE_FAILURE) {
+               return ret;
+       }
+       switch (transition) {
+       case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+               break;
+       case GST_STATE_CHANGE_PAUSED_TO_READY:
+               break;
+       case GST_STATE_CHANGE_READY_TO_NULL:
+               break;
+       default:
+               break;
+       }
+       return ret;
+}
+
+
+static gboolean
+avsysaudiosink_post_message(GstAvsysAudioSink* self,int errorcode)
+{
+               GST_DEBUG("avsysaudiosink_post_message\n");
+               gboolean ret = TRUE;
+               GstMessage *Msg = NULL;
+               GQuark domain;
+               gboolean status = FALSE;
+               GError *error = NULL;
+               gint error_code;
+               /*
+               if(errorcode>0)
+                               error_code = errorcode;
+               else
+                               error_code = GST_STREAM_ERROR_TYPE_NOT_FOUND; */
+               error_code = GST_RESOURCE_ERROR_FAILED;
+               domain = gst_resource_error_quark();
+               error = g_error_new (domain, error_code, "AVSYSAUDIOSINK_RESOURCE_ERROR");
+               Msg = gst_message_new_error(GST_ELEMENT(self), error, "AVSYSAUDIOSINK_ERROR");
+               status = gst_element_post_message (GST_ELEMENT(self), Msg);
+               if (status == FALSE)
+               {
+                               GST_ERROR("Error in posting message on the bus ...\n");
+                               ret = FALSE;
+               }
+
+               return ret;
+}
diff --git a/avsystem/src/gstavsysaudiosink.h b/avsystem/src/gstavsysaudiosink.h
new file mode 100644 (file)
index 0000000..ae1c3f2
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * avsystem
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+
+#ifndef __GST_AVSYSAUDIOSINK_H__
+#define __GST_AVSYSAUDIOSINK_H__
+
+#include <gst/gst.h>
+#include <gst/audio/gstaudiosink.h>
+
+#include <avsys-audio.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AVSYS_AUDIO_SINK             (gst_avsysaudiosink_get_type())
+#define GST_AVSYS_AUDIO_SINK(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVSYS_AUDIO_SINK,GstAvsysAudioSink))
+#define GST_AVSYS_AUDIO_SINK_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVSYS_AUDIO_SINK,GstAvsysAudioSinkClass))
+#define GST_IS_AVSYS_AUDIO_SINK(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVSYS_AUDIO_SINK))
+#define GST_IS_AVSYS_AUDIO_SINK_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVSYS_AUDIO_SINK))
+//#define GST_AVSYS_AUDIO_SINK_CAST(obj)        ((GstAvsysAudioSink *) (obj))
+
+typedef struct _GstAvsysAudioSink      GstAvsysAudioSink;
+typedef struct _GstAvsysAudioSinkClass GstAvsysAudioSinkClass;
+
+#define GST_AVSYS_AUDIO_SINK_GET_LOCK(obj) (GST_AVSYS_AUDIO_SINK (obj)->avsys_audio_lock)
+#define GST_AVSYS_AUDIO_SINK_LOCK(obj)     (g_mutex_lock (GST_AVSYS_AUDIO_SINK_GET_LOCK(obj)))
+#define GST_AVSYS_AUDIO_SINK_UNLOCK(obj)   (g_mutex_unlock (GST_AVSYS_AUDIO_SINK_GET_LOCK(obj)))
+
+#define GST_AVSYS_AUDIO_SINK_GET_RESET_LOCK(obj) (GST_AVSYS_AUDIO_SINK (obj)->avsys_audio_reset_lock)
+#define GST_AVSYS_AUDIO_SINK_RESET_LOCK(obj)     (g_mutex_lock (GST_AVSYS_AUDIO_SINK_GET_RESET_LOCK(obj)))
+#define GST_AVSYS_AUDIO_SINK_RESET_UNLOCK(obj)   (g_mutex_unlock (GST_AVSYS_AUDIO_SINK_GET_RESET_LOCK(obj)))
+
+
+typedef enum  {
+       AVSYSAUDIOSINK_AUDIO_UNMUTE = 0,
+       AVSYSAUDIOSINK_AUDIO_MUTE,
+       AVSYSAUDIOSINK_AUDIO_MUTE_WITH_FADEDOWN_EFFECT,
+}GstAvsysAudioSinkAudioMute;
+
+
+typedef enum  {
+       AVSYSAUDIOSINK_AUDIOROUTE_USE_EXTERNAL_SETTING = -1,
+       AVSYSAUDIOSINK_AUDIOROUTE_PLAYBACK_NORMAL,
+       AVSYSAUDIOSINK_AUDIOROUTE_PLAYBACK_ALERT,
+       AVSYSAUDIOSINK_AUDIOROUTE_PLAYBACK_HEADSET_ONLY
+}GstAvsysAudioSinkAudioRoutePolicy;
+
+
+typedef enum  {
+       AVSYSAUDIOSINK_USERROUTE_AUTO = 0,
+       AVSYSAUDIOSINK_USERROUTE_PHONE  
+}GstAvsysAudioSinkUserRoutePolicy;
+
+typedef enum {
+       AVSYSAUDIOSINK_LATENCY_LOW = 0,
+       AVSYSAUDIOSINK_LATENCY_MID,
+       AVSYSAUDIOSINK_LATENCY_HIGH,
+}GstAvsysAudioSinkLatency;
+
+#define GST_AVSYS_AUDIO_SINK_USER_ROUTE                (gst_avsysaudiosink_user_route_get_type ())
+#define GST_AVSYS_AUDIO_SINK_AUDIO_ROUTE       (gst_avsysaudiosink_audio_route_get_type ())
+#define GST_AVSYS_AUDIO_SINK_MUTE                      (gst_avsysaudiosink_audio_mute_get_type())
+#define GST_AVSYS_AUDIO_SINK_LATENCY_TYPE      (gst_avsysaudiosink_latency_get_type ())
+
+//this define if for debugging
+//#define LPCM_DUMP_SUPPORT
+struct _GstAvsysAudioSink {
+    GstAudioSink                               sink;
+
+       avsys_handle_t                          audio_handle;
+       avsys_audio_param_t             audio_param;
+       gint                            avsys_size;
+       gint                                            mute;
+       gint                                            use_fadeup_volume;
+       gint                                            audio_route_policy;
+       gint                                            user_route_policy;
+       gint                                            latency;
+
+       GstCaps                                         *cached_caps;
+
+       GMutex                                          *avsys_audio_lock;
+       GMutex                                          *avsys_audio_reset_lock;
+       gint                                            volume_type;
+       gint                                            sound_priority;
+       gint                                            bytes_per_sample;
+
+       gpointer                         cbHandle;
+       gboolean (*audio_stream_cb) (void *stream, int stream_size, void *user_param);
+};
+
+
+struct _GstAvsysAudioSinkClass {
+       GstAudioSinkClass    parent_class;
+};
+
+GType gst_avsysaudiosink_get_type (void);
+GType gst_avsysaudiosink_audio_route_get_type (void);
+GType gst_avsysaudiosink_audio_mute_get_type(void);
+GType gst_avsysaudiosink_latency_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_AVSYSAUDIOSINK_H__ */
diff --git a/avsystem/src/gstavsysaudiosrc.c b/avsystem/src/gstavsysaudiosrc.c
new file mode 100644 (file)
index 0000000..3a4fdc0
--- /dev/null
@@ -0,0 +1,1005 @@
+/*
+ * avsystem
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <gst/gst.h>
+#include <gst/gstutils.h>
+//#include <mm_debug.h>
+
+#include <sys/time.h>  /*gettimeofday*/
+#include <unistd.h>
+
+#include "gstavsysaudiosrc.h"
+
+/**
+ * Define for Release
+ *
+ * _ENABLE_FAKE_READ:          enable fake read instead of avsys_audio_read(). (default: 0)
+ */
+#define        _ENABLE_FAKE_READ               0
+//#define      USE_GPT8
+
+
+#define _MIN_RATE              8000
+#define _MAX_RATE              48000
+#define _MIN_CHANNEL           1
+#define _MAX_CHANNEL           2
+
+
+#define DEFAULT_GPT8_FREQ 26
+
+#if _ENABLE_FAKE_READ
+static long g_delay_time;
+#endif
+
+#define DEFAULT_MEDIACALL_MODE AVSYS_AUDIO_ECHO_MODE_NONE
+#define DEFAULT_AUDIO_LATENCY  AVSYSAUDIOSRC_LATENCY_MID
+
+GST_DEBUG_CATEGORY_EXTERN (avsystem_src_debug);
+#define GST_CAT_DEFAULT avsystem_src_debug
+
+/* elementfactory information */
+static const GstElementDetails gst_avsysaudiosrc_details =
+       GST_ELEMENT_DETAILS ("AV system source",
+                                                "Source/Audio",
+                                                "Read from a AV system audio in",
+                                                "Samsung Electronics co., ltd.");
+
+
+enum {
+       PROP_0,
+#if 0
+#if !defined(I386_SIMULATOR)
+    PROP_AUDIO_MEDIA_CALL,
+#endif
+#endif
+    PROP_AUDIO_LATENCY,
+};
+
+enum {
+       CAPTURE_UNCORK = 0,
+       CAPTURE_CORK,
+};
+
+GType
+gst_avsysaudiosrc_audio_latency_get_type (void)
+{
+  static GType capture_audio_latency_type = 0;
+  static const GEnumValue capture_audio_latency[] = {
+    {AVSYSAUDIOSRC_LATENCY_LOW, "Set capture latency as low", "low"},
+    {AVSYSAUDIOSRC_LATENCY_MID, "Set capture latency as mid", "mid"},
+    {AVSYSAUDIOSRC_LATENCY_HIGH, "Set capture latency as high", "high"},
+    {0, NULL, NULL},
+  };
+
+  if (!capture_audio_latency_type) {
+         capture_audio_latency_type =
+        g_enum_register_static ("GstAvsysAudioSrcAudioLatency", capture_audio_latency);
+  }
+  return capture_audio_latency_type;
+}
+
+
+GST_BOILERPLATE (GstAvsysAudioSrc, gst_avsysaudiosrc, GstAudioSrc, GST_TYPE_AUDIO_SRC);
+
+#if _ENABLE_FAKE_READ
+static unsigned long   fake_delay (unsigned long usec);
+#endif
+
+static guint gst_avsysaudiosrc_delay (GstAudioSrc *asrc);
+
+static void            gst_avsysaudiosrc_finalize              (GObject * object);
+static void            gst_avsysaudiosrc_set_property  (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
+static void            gst_avsysaudiosrc_get_property  (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
+
+static GstCaps*        gst_avsysaudiosrc_getcaps       (GstBaseSrc * bsrc);
+
+static gboolean        gst_avsysaudiosrc_open          (GstAudioSrc * asrc);
+static gboolean        gst_avsysaudiosrc_prepare       (GstAudioSrc * asrc, GstRingBufferSpec * spec);
+static gboolean        gst_avsysaudiosrc_unprepare     (GstAudioSrc * asrc);
+static gboolean        gst_avsysaudiosrc_close         (GstAudioSrc * asrc);
+static guint           gst_avsysaudiosrc_read          (GstAudioSrc * asrc, gpointer data, guint length);
+static void            gst_avsysaudiosrc_reset         (GstAudioSrc * asrc);
+static gboolean        gst_avsysaudiosrc_avsys_close   (GstAvsysAudioSrc *src);
+static gboolean        gst_avsysaudiosrc_avsys_open    (GstAvsysAudioSrc *src);
+static gboolean        gst_avsysaudiosrc_avsys_cork    (GstAvsysAudioSrc *avsysaudiosrc, int cork);
+static gboolean        gst_avsysaudiosrc_avsys_start   (GstAvsysAudioSrc *src);
+static gboolean        gst_avsysaudiosrc_avsys_stop    (GstAvsysAudioSrc *src);
+#if defined(_USE_CAPS_)
+static GstCaps *gst_avsysaudiosrc_detect_rates (GstObject * obj, avsys_pcm_hw_params_t * hw_params, GstCaps * in_caps);
+static GstCaps *gst_avsysaudiosrc_detect_channels (GstObject * obj,avsys_pcm_hw_params_t * hw_params,  GstCaps * in_caps);
+static GstCaps *gst_avsysaudiosrc_detect_formats (GstObject * obj,avsys_pcm_hw_params_t * hw_params,  GstCaps * in_caps);
+static GstCaps *gst_avsysaudiosrc_probe_supported_formats (GstObject * obj, avsys_handle_t handle, const GstCaps * template_caps);
+#endif
+static GstStateChangeReturn gst_avsys_src_change_state (GstElement * element, GstStateChange transition) ;
+
+
+
+/* AvsysAudioSrc signals and args */
+enum {
+       LAST_SIGNAL
+};
+
+# define AVSYS_AUDIO_SRC_FACTORY_ENDIANNESS   "LITTLE_ENDIAN"
+
+static GstStaticPadTemplate avsysaudiosrc_src_factory =
+       GST_STATIC_PAD_TEMPLATE ("src",
+                                                               GST_PAD_SRC,
+                                                               GST_PAD_ALWAYS,
+                                                               GST_STATIC_CAPS (
+                                                                       "audio/x-raw-int, "
+                                                                       "endianness = (int) { " AVSYS_AUDIO_SRC_FACTORY_ENDIANNESS " }, "
+                             "signed = (boolean) { TRUE }, "
+                                                                       "width = (int) 16, "
+                                                                       "depth = (int) 16, "
+                             "rate = (int) [ 8000, 48000 ], "
+                             "channels = (int) [ 1, 2 ]; "
+                                                                       "audio/x-raw-int, "
+                             "signed = (boolean) { FALSE }, "
+                                                                       "width = (int) 8, "
+                                                                       "depth = (int) 8, "
+                             "rate = (int) [ 8000, 48000 ], "
+                             "channels = (int) [ 1, 2 ]")
+                                                       );
+
+static inline guint _time_to_sample(GstAvsysAudioSrc *avsyssrc,  GstClockTime diff)
+{
+       guint result = 0;
+       // sample rate : asrc->audio_param.samplerate
+       result =(GST_TIME_AS_USECONDS(diff) * avsyssrc->audio_param.samplerate)/1000000;
+       return result;
+}
+
+
+static void
+gst_avsysaudiosrc_finalize (GObject * object)
+{
+    GstAvsysAudioSrc *src = NULL;
+
+
+    src = GST_AVSYS_AUDIO_SRC (object);
+       g_mutex_free (src->avsysaudio_lock);
+
+       G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_avsysaudiosrc_base_init (gpointer g_class)
+{
+       GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+
+       gst_element_class_set_details (element_class, &gst_avsysaudiosrc_details);
+
+       gst_element_class_add_pad_template (element_class,
+                                                                               gst_static_pad_template_get (&avsysaudiosrc_src_factory));
+}
+
+static void
+gst_avsysaudiosrc_class_init (GstAvsysAudioSrcClass * klass)
+{
+       GObjectClass *gobject_class;
+       GstElementClass *gstelement_class;
+       GstBaseSrcClass *gstbasesrc_class;
+       GstBaseAudioSrcClass *gstbaseaudiosrc_class;
+       GstAudioSrcClass *gstaudiosrc_class;
+
+       gobject_class = (GObjectClass *) klass;
+       gstelement_class = (GstElementClass *) klass;
+       gstbasesrc_class = (GstBaseSrcClass *) klass;
+       gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass;
+       gstaudiosrc_class = (GstAudioSrcClass *) klass;
+
+       gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_avsys_src_change_state);
+
+    parent_class = g_type_class_peek_parent (klass);
+
+       gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_finalize);
+       gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_get_property);
+       gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_set_property);
+#if defined(_USE_CAPS_)
+       gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_getcaps);
+#endif
+       gstaudiosrc_class->open = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_open);
+       gstaudiosrc_class->prepare = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_prepare);
+       gstaudiosrc_class->unprepare = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_unprepare);
+       gstaudiosrc_class->close = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_close);
+       gstaudiosrc_class->read = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_read);
+       gstaudiosrc_class->delay = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_delay);
+       gstaudiosrc_class->reset = GST_DEBUG_FUNCPTR (gst_avsysaudiosrc_reset);
+
+       g_object_class_install_property (gobject_class ,PROP_AUDIO_LATENCY,
+                       g_param_spec_enum("latency", "Audio Latency",
+                                       "Audio latency",
+                                       GST_AVSYS_AUDIO_SRC_LATENCY, DEFAULT_AUDIO_LATENCY,
+                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS ));
+}
+
+
+
+/**
+ *@note useful range 0 - 1000000 microsecond
+ */
+#if _ENABLE_FAKE_READ
+static unsigned long
+fake_delay (unsigned long usec)
+{
+       struct timeval s_time;
+       struct timeval c_time;
+       long s_sec  = 0L;
+       long s_usec = 0L;
+       long c_sec  = 0L;
+       long c_usec = 0L;
+       long t_sec  = 0L;
+       long t_usec = 0L;
+       unsigned long total_usec = 0UL;
+       unsigned long t = 0UL;
+
+       if (usec == 0UL) {
+               usleep (0);
+               return 0;
+       }
+
+       /*get start time*/
+       if (gettimeofday ((struct timeval *)&s_time, NULL) == 0) {
+               s_sec  = s_time.tv_sec;
+               s_usec = s_time.tv_usec;
+       } else {
+               return 0;
+       }
+
+       for (;;) {
+               /*get current time*/
+               if (gettimeofday ((struct timeval *)&c_time, NULL) == 0) {
+                       c_sec  = c_time.tv_sec;
+                       c_usec = c_time.tv_usec;
+               } else {
+                       return 0;
+               }
+
+               /*get elasped sec*/
+               t_sec = c_sec - s_sec;
+
+               /*get elapsed usec*/
+               if ((s_usec) > (c_usec)) {
+                       t_usec = 1000000L - (s_usec) + (c_usec);
+                       t_sec--;
+               } else {
+                       t_usec = (c_usec) - (s_usec);
+               }
+
+               /*get total elapsed time*/
+               total_usec = (t_sec * 1000000UL) + t_usec;
+
+               t = usec - total_usec;
+
+               if (total_usec >= usec) {
+                       break;
+               } else {
+                       if (t > 10000UL) {
+                               /*this function does not work in precision*/
+                               usleep (1);
+                       }
+               }
+       }
+
+       return total_usec;
+}
+#endif
+
+static guint
+gst_avsysaudiosrc_delay (GstAudioSrc *asrc)
+{
+       GstAvsysAudioSrc        *avsys_audio = NULL;
+       int                                     delay;
+       guint                           retValue = 0;
+
+       avsys_audio = GST_AVSYS_AUDIO_SRC (asrc);
+       if(AVSYS_STATE_SUCCESS == avsys_audio_delay(avsys_audio->audio_handle, &delay))
+               retValue = delay;
+
+       return retValue;
+}
+
+
+
+static void
+gst_avsysaudiosrc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+    GstAvsysAudioSrc *src = NULL;
+//    gint                     getvalue = 0;
+       src = GST_AVSYS_AUDIO_SRC (object);
+
+       if (src->cached_caps == NULL)
+       {
+               switch (prop_id)
+               {
+        case PROP_AUDIO_LATENCY:
+               src->latency = g_value_get_enum(value);
+                       break;
+        default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+               }
+       }
+}
+
+static void
+gst_avsysaudiosrc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+{
+       GstAvsysAudioSrc *src;
+
+       src = GST_AVSYS_AUDIO_SRC (object);
+
+    switch (prop_id)
+    {
+       case PROP_AUDIO_LATENCY:
+               g_value_set_enum(value, src->latency);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gst_avsysaudiosrc_init (GstAvsysAudioSrc * avsysaudiosrc, GstAvsysAudioSrcClass * g_class)
+{
+       GST_DEBUG_OBJECT (avsysaudiosrc, "initializing");
+
+       avsysaudiosrc->cached_caps = NULL;
+       avsysaudiosrc->audio_handle = (avsys_handle_t)-1;
+       avsysaudiosrc->buffer_size = 0;
+       avsysaudiosrc->avsysaudio_lock = g_mutex_new ();
+       avsysaudiosrc->latency = DEFAULT_AUDIO_LATENCY;
+}
+
+#if defined(_USE_CAPS_)
+static GstCaps *
+gst_avsysaudiosrc_getcaps (GstBaseSrc * bsrc)
+{
+    GstElementClass *element_class;
+    GstPadTemplate *pad_template;
+       GstAvsysAudioSrc *src;
+    GstCaps *caps = NULL;
+
+       src = GST_AVSYS_AUDIO_SRC (bsrc);
+
+    if(src->audio_handle==(avsys_handle_t)-1){
+       GST_DEBUG_OBJECT(src,"device not open, using template caps");
+       return NULL;
+    }
+
+    if (src->cached_caps)
+       {
+               GST_LOG_OBJECT (src, "Returning cached caps");
+            return gst_caps_ref(src->cached_caps);
+       }
+       element_class = GST_ELEMENT_GET_CLASS (src);
+       pad_template = gst_element_class_get_pad_template (element_class, "src");
+       g_return_val_if_fail (pad_template != NULL, NULL);
+
+       caps = gst_avsysaudiosrc_probe_supported_formats (GST_OBJECT (src), src->audio_handle,
+                                                                                                       gst_pad_template_get_caps (pad_template));
+
+       if (caps) {
+               src->cached_caps = gst_caps_ref (caps);
+       }
+
+       GST_INFO_OBJECT (src, "returning caps %" GST_PTR_FORMAT, caps);
+
+       return caps;
+}
+#endif
+static gboolean
+gst_avsysaudiosrc_open (GstAudioSrc * asrc)
+{
+       return TRUE;
+}
+
+static gboolean
+avsysaudiosrc_parse_spec (GstAvsysAudioSrc *avsys_audio, GstRingBufferSpec * spec)
+{
+    /* Check param */
+    if (spec->type != GST_BUFTYPE_LINEAR ||
+        spec->channels > 2 || spec->channels < 1 ||
+        !(spec->format == GST_S8 || spec->format == GST_S16_LE) )
+        return FALSE;
+
+    switch(spec->format)
+    {
+    case GST_S8:
+        avsys_audio->audio_param.format = AVSYS_AUDIO_FORMAT_8BIT;
+        avsys_audio->bytes_per_sample = 1;
+        break;
+    case GST_S16_LE:
+        avsys_audio->audio_param.format = AVSYS_AUDIO_FORMAT_16BIT;
+        avsys_audio->bytes_per_sample = 2;
+        break;
+    default:
+       GST_DEBUG_OBJECT(avsys_audio, "Only support S8, S16LE format");
+        return FALSE;
+    }
+
+    // set audio parameter for avsys audio open
+
+       switch(avsys_audio->latency)
+       {
+       case AVSYSAUDIOSRC_LATENCY_LOW:
+               avsys_audio->audio_param.mode = AVSYS_AUDIO_MODE_INPUT_LOW_LATENCY;
+               break;
+       case AVSYSAUDIOSRC_LATENCY_MID:
+               avsys_audio->audio_param.mode = AVSYS_AUDIO_MODE_INPUT;
+               break;
+       case AVSYSAUDIOSRC_LATENCY_HIGH:
+               avsys_audio->audio_param.mode = AVSYS_AUDIO_MODE_INPUT_HIGH_LATENCY;
+               break;
+       default:
+               break;
+       }
+
+    avsys_audio->audio_param.priority = 0;
+    avsys_audio->audio_param.samplerate = spec->rate;
+    avsys_audio->audio_param.channels = spec->channels;
+
+    if(spec->channels == 2)
+       avsys_audio->bytes_per_sample *= 2;
+    else if(spec->channels > 2)
+    {
+       GST_ERROR_OBJECT(avsys_audio,"Unsupported channel number %d", spec->channels);
+       return FALSE;
+    }
+
+    return TRUE;
+}
+
+static gboolean
+gst_avsysaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
+{
+    GstAvsysAudioSrc *avsysaudiosrc = NULL;
+       guint   p_time = 0, b_time = 0;
+
+       avsysaudiosrc = GST_AVSYS_AUDIO_SRC (asrc);
+
+    if (!avsysaudiosrc_parse_spec(avsysaudiosrc, spec))
+    {
+       GST_ERROR("avsysaudiosrc_parse_spec failed");
+        return FALSE;
+    }
+
+       /*open avsys audio*/
+    if (!gst_avsysaudiosrc_avsys_open (avsysaudiosrc))
+    {
+       GST_ERROR("gst_avsysaudiosrc_avsys_open failed");
+        return FALSE;
+    }
+
+    /* Ring buffer size */
+    if (AVSYS_STATE_SUCCESS ==
+       avsys_audio_get_period_buffer_time(avsysaudiosrc->audio_handle, &p_time, &b_time))
+    {
+       if(p_time == 0 || b_time == 0)
+               return FALSE;
+
+       spec->latency_time = (guint64)p_time;
+       spec->buffer_time = (guint64)b_time;
+       }
+       else
+       {
+        return FALSE;
+       }
+       spec->segsize = avsysaudiosrc->buffer_size;
+       spec->segtotal = (b_time / p_time) + (((b_time % p_time)/p_time > 0.5) ? 1: 0);
+       spec->segtotal += 2;
+
+     GST_INFO_OBJECT(avsysaudiosrc, "audio buffer spec : latency_time(%llu), buffer_time(%llu), segtotal(%d), segsize(%d)\n",
+                                                       spec->latency_time, spec->buffer_time, spec->segtotal, spec->segsize);
+
+
+    return TRUE;
+}
+
+static gboolean
+gst_avsysaudiosrc_unprepare (GstAudioSrc * asrc)
+{
+    GstAvsysAudioSrc *avsysaudiosrc = NULL;
+    gboolean ret = TRUE;
+
+    avsysaudiosrc = GST_AVSYS_AUDIO_SRC (asrc);
+
+       /*close*/
+    GST_AVSYS_AUDIO_SRC_LOCK (avsysaudiosrc);
+
+    if(!gst_avsysaudiosrc_avsys_close(avsysaudiosrc))
+    {
+       GST_ERROR_OBJECT(avsysaudiosrc, "gst_avsysaudiosrc_avsys_close failed");
+       ret = FALSE;
+    }
+    GST_AVSYS_AUDIO_SRC_UNLOCK (asrc);
+
+
+
+       return ret;
+}
+
+static gboolean
+gst_avsysaudiosrc_close (GstAudioSrc * asrc)
+{
+    GstAvsysAudioSrc *avsysaudiosrc = NULL;
+
+    avsysaudiosrc = GST_AVSYS_AUDIO_SRC (asrc);
+       gst_caps_replace (&avsysaudiosrc->cached_caps, NULL);
+
+       return TRUE;
+}
+
+static void
+gst_avsysaudiosrc_reset (GstAudioSrc * asrc)
+{
+       GstAvsysAudioSrc *avsys_audio = NULL;
+
+    avsys_audio = GST_AVSYS_AUDIO_SRC (asrc);
+    GST_AVSYS_AUDIO_SRC_LOCK (asrc);
+
+    if(AVSYS_STATE_SUCCESS != avsys_audio_reset(avsys_audio->audio_handle))
+    {
+       GST_ERROR_OBJECT (avsys_audio, "avsys-reset: internal error: ");
+    }
+
+    GST_AVSYS_AUDIO_SRC_UNLOCK (asrc);
+
+    return;
+}
+
+
+static GstStateChangeReturn
+gst_avsys_src_change_state (GstElement * element, GstStateChange transition)
+{
+       GstAvsysAudioSrc *avsys = NULL;
+       GstStateChangeReturn ret ;
+
+       avsys = GST_AVSYS_AUDIO_SRC (element);
+       GST_DEBUG("gst_avsys_src_change_state");
+
+       switch (transition)
+       {
+               case GST_STATE_CHANGE_NULL_TO_READY:
+               {
+                       GST_DEBUG ("GST_STATE_CHANGE_NULL_TO_READY\n") ;
+                       break ;
+               }
+               case GST_STATE_CHANGE_READY_TO_PAUSED:
+               {
+                       GST_DEBUG ("GST_STATE_CHANGE_READY_TO_PAUSED\n") ;
+                       break ;
+               }
+               case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+               {
+                       GST_DEBUG ("GST_STATE_CHANGE_PAUSED_TO_PLAYING\n") ;
+                       /* Capture Start */
+                       if (!gst_avsysaudiosrc_avsys_start (avsys)) {
+                               GST_ERROR("gst_avsysaudiosrc_avsys_start failed");
+                       }
+                       break ;
+               }
+               default:
+                       break ;
+       }
+
+       ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+       GST_DEBUG ("After parent_class->change_state...\n") ;
+       switch (transition)
+       {
+               case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+               {
+                       GST_DEBUG ("GST_STATE_CHANGE_PLAYING_TO_PAUSED\n") ;
+                       /* Capture Stop */
+                       if (!gst_avsysaudiosrc_avsys_stop (avsys)) {
+                               GST_ERROR("gst_avsysaudiosrc_avsys_stop failed");
+                       }
+                       break ;
+               }
+               case GST_STATE_CHANGE_PAUSED_TO_READY:
+               {
+                       GST_DEBUG ("GST_STATE_CHANGE_PAUSED_TO_READY\n") ;
+                       break ;
+               }
+               case GST_STATE_CHANGE_READY_TO_NULL:
+               {
+                       GST_DEBUG ("GST_STATE_CHANGE_READY_TO_NULL\n") ;
+                       break ;
+               }
+               default:
+                       break ;
+       }
+
+       return ret;
+}
+
+
+
+static guint
+gst_avsysaudiosrc_read (GstAudioSrc * asrc, gpointer data, guint length)
+{
+    GstAvsysAudioSrc   *avsysaudiosrc = NULL;
+       gint                            readed = 0;
+       gpointer                        ptr = NULL;
+       guint                           used_length = 0;
+
+       avsysaudiosrc = GST_AVSYS_AUDIO_SRC (asrc);
+
+       ptr = data;
+
+    GST_AVSYS_AUDIO_SRC_LOCK (avsysaudiosrc);
+#if _ENABLE_FAKE_READ
+       readed = avsysaudiosrc->buffer_size;
+       memset (ptr, 10, avsysaudiosrc->buffer_size);   /*maybe can't hear*/
+       fake_delay (1000000UL / g_delay_time);
+#else
+       ptr = data;
+       readed = avsys_audio_read (avsysaudiosrc->audio_handle, ptr, length);
+       if (readed < 0)
+               goto _READ_ERROR;
+#endif //_ENABLE_FAKE_READ
+       GST_AVSYS_AUDIO_SRC_UNLOCK (avsysaudiosrc);
+
+       return readed;
+
+_READ_ERROR:
+       {
+               GST_AVSYS_AUDIO_SRC_UNLOCK (asrc);
+               return length;  /* skip one period */
+       }
+}
+
+static gboolean
+gst_avsysaudiosrc_avsys_cork (GstAvsysAudioSrc *avsysaudiosrc, int cork)
+{
+       int avsys_result = avsys_audio_cork (avsysaudiosrc->audio_handle, cork);
+       if (avsys_result != AVSYS_STATE_SUCCESS) {
+               GST_ERROR_OBJECT(avsysaudiosrc, "avsys_audio_cork() error. [0x%x]\n", avsys_result);
+               return FALSE;
+       }
+       return TRUE;
+}
+
+static gboolean
+gst_avsysaudiosrc_avsys_start (GstAvsysAudioSrc *avsysaudiosrc)
+{
+       gboolean result;
+
+       GST_AVSYS_AUDIO_SRC_LOCK (avsysaudiosrc);
+       result = gst_avsysaudiosrc_avsys_cork(avsysaudiosrc, CAPTURE_UNCORK);
+       GST_AVSYS_AUDIO_SRC_UNLOCK (avsysaudiosrc);
+
+       return result;
+}
+
+static gboolean
+gst_avsysaudiosrc_avsys_stop (GstAvsysAudioSrc *avsysaudiosrc)
+{
+       gboolean result;
+
+       GST_AVSYS_AUDIO_SRC_LOCK (avsysaudiosrc);
+       result = gst_avsysaudiosrc_avsys_cork(avsysaudiosrc, CAPTURE_CORK);
+       GST_AVSYS_AUDIO_SRC_UNLOCK (avsysaudiosrc);
+
+       return result;
+}
+
+static gboolean
+gst_avsysaudiosrc_avsys_open (GstAvsysAudioSrc *avsysaudiosrc)
+{
+       int avsys_result = 0;
+
+       GST_AVSYS_AUDIO_SRC_LOCK (avsysaudiosrc);
+
+       avsys_result = avsys_audio_open(&avsysaudiosrc->audio_param, &avsysaudiosrc->audio_handle, &avsysaudiosrc->buffer_size);
+
+       if (avsys_result != AVSYS_STATE_SUCCESS) {
+               GST_ERROR_OBJECT(avsysaudiosrc, "avsys_audio_open() error. [0x%x]\n", avsys_result);
+               GST_AVSYS_AUDIO_SRC_UNLOCK (avsysaudiosrc);
+               return FALSE;
+       }
+
+#if _ENABLE_FAKE_READ
+       g_delay_time = (unsigned long)((avsysaudiosrc->samplerate * (avsysaudiosrc->format / 8) * avsysaudiosrc->channels) / avsysaudiosrc->buffer_size);
+#endif
+
+       GST_AVSYS_AUDIO_SRC_UNLOCK (avsysaudiosrc);
+       return TRUE;
+}
+
+static gboolean
+gst_avsysaudiosrc_avsys_close(GstAvsysAudioSrc *src)
+{
+       int ret;
+
+    if (src->audio_handle != (avsys_handle_t)-1)
+    {
+               /*close avsys audio*/
+               ret = avsys_audio_close (src->audio_handle);
+        if (AVSYS_FAIL(ret))
+        {
+               GST_ERROR_OBJECT(src, "avsys_audio_close() error 0x%x", ret);
+                       return FALSE;
+               }
+        src->audio_handle = (avsys_handle_t)-1;
+        GST_DEBUG_OBJECT(src, "AVsys audio handle closed");
+       }
+    else
+    {
+       GST_WARNING_OBJECT(src,"avsys audio handle has already closed");
+    }
+
+       return TRUE;
+}
+#if defined(_USE_CAPS_)
+static GstCaps *
+gst_avsysaudiosrc_detect_rates(GstObject *obj,
+               avsys_pcm_hw_params_t *hw_params, GstCaps *in_caps)
+{
+       GstCaps *caps;
+       guint min, max;
+       gint err, dir, min_rate, max_rate, i;
+
+       GST_LOG_OBJECT(obj, "probing sample rates ...");
+
+       if ((err = avsys_pcm_hw_params_get_rate_min(hw_params, &min, &dir)) < 0)
+               goto min_rate_err;
+
+       if ((err = avsys_pcm_hw_params_get_rate_max(hw_params, &max, &dir)) < 0)
+               goto max_rate_err;
+
+       min_rate = min;
+       max_rate = max;
+
+       if (min_rate < _MIN_RATE)
+               min_rate = _MIN_RATE; /* random 'sensible minimum' */
+
+       if (max_rate <= 0)
+               max_rate = _MAX_RATE; /* or maybe just use 192400 or so? */
+       else if (max_rate > 0 && max_rate < _MIN_RATE)
+               max_rate = MAX (_MIN_RATE, min_rate);
+
+       GST_DEBUG_OBJECT(obj, "Min. rate = %u (%d)", min_rate, min);
+       GST_DEBUG_OBJECT(obj, "Max. rate = %u (%d)", max_rate, max);
+
+       caps = gst_caps_make_writable(in_caps);
+
+       for (i = 0; i < gst_caps_get_size(caps); ++i)
+       {
+               GstStructure *s;
+
+               s = gst_caps_get_structure(caps, i);
+               if (min_rate == max_rate)
+               {
+                       gst_structure_set(s, "rate", G_TYPE_INT, min_rate, NULL);
+               }
+               else
+               {
+                       gst_structure_set(s, "rate", GST_TYPE_INT_RANGE, min_rate,
+                                       max_rate, NULL);
+               }
+       }
+
+       return caps;
+       /* ERRORS */
+       min_rate_err:
+       {
+               GST_ERROR_OBJECT(obj, "failed to query minimum sample rate");
+               gst_caps_unref(in_caps);
+               return NULL;
+       }
+       max_rate_err:
+       {
+               GST_ERROR_OBJECT(obj, "failed to query maximum sample rate");
+               gst_caps_unref(in_caps);
+               return NULL;
+       }
+}
+
+
+static GstCaps *
+gst_avsysaudiosrc_detect_formats(GstObject * obj,
+               avsys_pcm_hw_params_t * hw_params, GstCaps * in_caps)
+{
+       avsys_pcm_format_mask_t *mask;
+       GstStructure *s;
+       GstCaps *caps;
+       gint i;
+
+       avsys_pcm_format_mask_malloc(&mask);
+       avsys_pcm_hw_params_get_format_mask(hw_params, mask);
+
+       caps = gst_caps_new_empty();
+
+       for (i = 0; i < gst_caps_get_size(in_caps); ++i)
+       {
+               GstStructure *scopy;
+               //gint w;
+               gint width = 0, depth = 0;
+               gint sndformat;
+
+               s = gst_caps_get_structure(in_caps, i);
+               if (!gst_structure_has_name(s, "audio/x-raw-int"))
+               {
+                       GST_WARNING_OBJECT(obj, "skipping non-int format");
+                       continue;
+               }
+               if (!gst_structure_get_int(s, "width", &width)
+                               || !gst_structure_get_int(s, "depth", &depth))
+                       continue;
+
+               GST_DEBUG_OBJECT(obj, "width = %d height = %d", width, depth);
+               if (width == 8)
+                       sndformat = 0;//SND_PCM_FORMAT_S8
+               else
+                       //width==16
+                       sndformat = 2; //SND_PCM_FORMAT_S16_LE
+               if (avsys_pcm_format_mask_test(mask, sndformat))
+               { //must be implemented
+                       /* template contains { true, false } or just one, leave it as it is */
+                       scopy = gst_structure_copy(s);
+
+               }
+               else
+               {
+                       scopy = NULL;
+               }
+               if (scopy)
+               {
+                       /* TODO: proper endianness detection, for now it's CPU endianness only */
+                       gst_structure_set(scopy, "signed", G_TYPE_BOOLEAN, TRUE, NULL);
+                       gst_structure_set(scopy, "endianness", G_TYPE_INT, G_BYTE_ORDER,
+                                       NULL);
+                       gst_caps_append_structure(caps, scopy);
+               }
+
+       }
+
+       avsys_pcm_format_mask_free(mask);
+       gst_caps_unref(in_caps);
+       return caps;
+}
+
+
+static GstCaps *
+gst_avsysaudiosrc_detect_channels(GstObject * obj,
+               avsys_pcm_hw_params_t * hw_params, GstCaps * in_caps)
+{
+       GstCaps *caps;
+       guint min, max;
+       gint err, min_channel, max_channel, i;
+//     gint dir;
+
+       GST_LOG_OBJECT(obj, "probing sample rates ...");
+
+       if ((err = avsys_pcm_hw_params_get_channels_min(hw_params, &min)) < 0)
+               goto min_chan_err;
+
+       if ((err = avsys_pcm_hw_params_get_channels_max(hw_params, &max)) < 0)
+               goto max_chan_err;
+
+       min_channel = min;
+       max_channel = max;
+
+       if (min_channel < _MIN_CHANNEL)
+               min_channel = _MIN_CHANNEL; /* random 'sensible minimum' */
+
+       if (max_channel <= 0)
+               max_channel = _MAX_CHANNEL; /* or maybe just use 192400 or so? */
+       else if (max_channel > 0 && max_channel < _MIN_CHANNEL)
+               max_channel = MAX (_MAX_CHANNEL, min_channel);
+
+       GST_DEBUG_OBJECT(obj, "Min. channel = %u (%d)", min_channel, min);
+       GST_DEBUG_OBJECT(obj, "Max. channel = %u (%d)", max_channel, max);
+
+       caps = gst_caps_make_writable(in_caps);
+
+       for (i = 0; i < gst_caps_get_size(caps); ++i)
+       {
+               GstStructure *s;
+
+               s = gst_caps_get_structure(caps, i);
+               if (min_channel == max_channel)
+               {
+                       gst_structure_set(s, "channels", G_TYPE_INT, _MIN_CHANNEL, NULL);
+               }
+               else
+               {
+                       gst_structure_set(s, "channels", GST_TYPE_INT_RANGE, min_channel,
+                                       max_channel, NULL);
+               }
+       }
+
+       return caps;
+
+       /* ERRORS */
+       min_chan_err:
+       {
+               GST_ERROR_OBJECT(obj, "failed to query minimum sample rate");
+               gst_caps_unref(in_caps);
+               return NULL;
+       }
+       max_chan_err:
+       {
+               GST_ERROR_OBJECT(obj, "failed to query maximum sample rate:");
+               gst_caps_unref(in_caps);
+               return NULL;
+       }
+}
+
+/*
+ * gst_avsys_probe_supported_formats:
+ *
+ * Takes the template caps and returns the subset which is actually
+ * supported by this device.
+ *
+ */
+
+static GstCaps *
+gst_avsysaudiosrc_probe_supported_formats(GstObject * obj,
+               avsys_handle_t handle, const GstCaps * template_caps)
+{
+
+       avsys_pcm_hw_params_t *hw_params;
+       GstCaps *caps;
+       gint err;
+
+       avsys_pcm_hw_params_malloc(&hw_params);
+       if ((err = avsys_pcm_hw_params_any(handle, hw_params)) < 0)
+               goto error;
+
+       caps = gst_caps_copy(template_caps);
+
+       if (!(caps = gst_avsysaudiosrc_detect_formats(obj, hw_params, caps)))
+               goto subroutine_error;
+
+       if (!(caps = gst_avsysaudiosrc_detect_rates(obj, hw_params, caps)))
+               goto subroutine_error;
+
+       if (!(caps = gst_avsysaudiosrc_detect_channels(obj, hw_params, caps)))
+               goto subroutine_error;
+
+       avsys_pcm_hw_params_free(hw_params);
+       return caps;
+
+       /* ERRORS */
+       error:
+       {
+               GST_ERROR_OBJECT(obj, "failed to query formats");
+               return NULL;
+       }
+       subroutine_error:
+       {
+               GST_ERROR_OBJECT(obj, "failed to query formats");
+               return NULL;
+       }
+}
+#endif
diff --git a/avsystem/src/gstavsysaudiosrc.h b/avsystem/src/gstavsysaudiosrc.h
new file mode 100644 (file)
index 0000000..4031e04
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * avsystem
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __GST_AVSYS_AUDIO_SRC_H__
+#define __GST_AVSYS_AUDIO_SRC_H__
+
+//#undef  _MMCAMCORDER_MERGE_TEMP 
+
+#include <gst/audio/gstaudiosrc.h>
+#include <glib.h>
+
+#include <avsys-audio.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AVSYS_AUDIO_SRC            (gst_avsysaudiosrc_get_type())
+#define GST_AVSYS_AUDIO_SRC(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVSYS_AUDIO_SRC,GstAvsysAudioSrc))
+#define GST_AVSYS_AUDIO_SRC_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVSYS_AUDIO_SRC,GstAvsysAudioSrcClass))
+#define GST_IS_AVSYS_AUDIO_SRC(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVSYS_AUDIO_SRC))
+#define GST_IS_AVSYS_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVSYS_AUDIO_SRC))
+#define GST_AVSYS_AUDIO_SRC_CAST(obj)       ((GstAvsysAudioSrc *)(obj))
+
+#define GST_AVSYS_AUDIO_SRC_GET_LOCK(obj)  (GST_AVSYS_AUDIO_SRC_CAST (obj)->avsysaudio_lock)
+#define GST_AVSYS_AUDIO_SRC_LOCK(obj)      (g_mutex_lock (GST_AVSYS_AUDIO_SRC_GET_LOCK (obj)))
+#define GST_AVSYS_AUDIO_SRC_UNLOCK(obj)    (g_mutex_unlock (GST_AVSYS_AUDIO_SRC_GET_LOCK (obj)))
+
+typedef struct _GstAvsysAudioSrc GstAvsysAudioSrc;
+typedef struct _GstAvsysAudioSrcClass GstAvsysAudioSrcClass;
+
+typedef enum {
+       AVSYSAUDIOSRC_LATENCY_LOW = 0,
+       AVSYSAUDIOSRC_LATENCY_MID,
+       AVSYSAUDIOSRC_LATENCY_HIGH,
+}GstAvsysAudioSrcAudioLatency;
+
+#define GST_AVSYS_AUDIO_SRC_LATENCY    (gst_avsysaudiosrc_audio_latency_get_type())
+
+
+
+/**
+ * GstAvsysAudioSrc:
+ *
+ * Opaque data structure
+ */
+struct _GstAvsysAudioSrc {
+       GstAudioSrc                                     src;
+
+       avsys_handle_t                          audio_handle;
+       avsys_audio_param_t             audio_param;
+
+       gint                                            buffer_size;
+       GstCaps                                         *cached_caps;
+       GMutex                                          *avsysaudio_lock;
+
+       gint                                            media_call;
+       gint                                            bytes_per_sample;
+       gint                                            latency;
+
+};
+
+struct _GstAvsysAudioSrcClass {
+       GstAudioSrcClass parent_class;
+};
+
+
+GType gst_avsysaudiosrc_get_type (void);
+GType gst_avsysaudiosrc_audio_latency_get_type(void);
+
+G_END_DECLS
+
+#endif /* __GST_AVSYS_AUDIO_SRC_H__ */
diff --git a/avsystem/src/gstavsysmemsink.c b/avsystem/src/gstavsysmemsink.c
new file mode 100644 (file)
index 0000000..a47ceaa
--- /dev/null
@@ -0,0 +1,750 @@
+/*
+ * avsystem
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+
+#if defined(_MM_PROJECT_FLOATER) || defined(_MM_PROJECT_PROTECTOR) || defined(_MM_PROJECT_VOLANS)
+#define VERSION "0.10.19" // sec
+#define PACKAGE "gstreamer"
+#elif defined(_MM_PROJECT_ADORA)
+#define VERSION "0.10.9" // mavell
+#define PACKAGE "gstreamer"
+#else
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "gstavsysmemsink.h"
+
+#define debug_enter g_print
+#define debug_leave g_print
+#define debug_fenter() g_print("enter: %s\n",__FUNCTION__)
+#define debug_fleave() g_print("leave: %s\n",__FUNCTION__)
+#define debug_msg g_print
+#define debug_verbose g_print
+#define debug_warning g_print
+#define debug_error g_print
+
+#define GST_CAT_DEFAULT avsysmemsink_debug
+
+#define DISABLE_YUV_FORMAT_ON_SINK_CAPS
+
+GST_DEBUG_CATEGORY_STATIC (avsysmemsink_debug);
+
+enum 
+{
+    SIGNAL_VIDEO_STREAM,
+    LAST_SIGNAL
+};
+
+enum 
+{
+       PROP_0,
+       PROP_WIDTH,
+       PROP_HEIGHT,
+       PROP_ROTATE,
+};
+
+static GstStaticPadTemplate sink_factory =
+       GST_STATIC_PAD_TEMPLATE ("sink",
+               GST_PAD_SINK, GST_PAD_ALWAYS,
+               GST_STATIC_CAPS (
+#ifndef DISABLE_YUV_FORMAT_ON_SINK_CAPS
+                       "video/x-raw-yuv, "
+                       "format = (fourcc){YV12}, "
+                       "framerate = (fraction) [ 0, MAX ], "
+                       "width = (int) [ 1, MAX ], "
+                       "height = (int) [ 1, MAX ]; "
+                       "video/x-raw-yuv, "
+                       "format = (fourcc){I420}, "
+                       "framerate = (fraction) [ 0, MAX ], "
+                       "width = (int) [ 1, MAX ], "
+                       "height = (int) [ 1, MAX ]; "
+                       "video/x-raw-rgb, "
+                       "bpp = (int)32, "
+                       "depth = (int)24; "
+#else /* BGRA */
+                       "video/x-raw-rgb, "
+                       "bpp = (int)32, "
+                       "endianness = (int)4321, "
+                       "red_mask = (int)65280, "
+                       "green_mask = (int)16711680, "
+                       "blue_mask = (int)-16777216, "
+                       "alpha_mask = (int)255, "
+                       "width = (int) [ 1, MAX ], "
+                       "height = (int) [ 1, MAX ], "
+                       "framerate = (fraction) [ 0, MAX ]; "
+#endif
+               )
+       );
+
+static GstElementDetails AvsysMemSink_details = {
+            "AV-system Stream callback",
+            "Sink/Video", 
+            "Stream sink for AV-System GStreamer Plug-in", 
+            ""
+};
+
+static guint gst_avsysmemsink_signals[LAST_SIGNAL] = { 0 };
+
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_int(v)      g_value_get_int (v)
+#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
+#else /* !G_ENABLE_DEBUG */
+#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
+#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+
+#define     GET_PIXEL(buf, x, y, stride)  (*((unsigned char*)(buf) + (x) + (y)*(stride)))
+
+#define     GET_RED(Y,U,V)     ((9535 * (Y - 16) + 13074 * (V - 128)) >> 13)
+#define     GET_GREEN(Y,U,V)  ((9535 * (Y - 16) - 6660 * (V - 128) - 3203 * (U - 128)) >> 13 )
+#define     GET_BLUE(Y,U,V)   ((9535 * (Y - 16) + 16531 * (U - 128)) >> 13 )
+
+#define     UCLIP(a) (((a)<0)?0:((a)>255)?255:(a))
+
+
+static void
+yuv420toargb(unsigned char *src, unsigned char *dst, int width, int height)
+{
+    int h,w;
+    int y=0,u=0,v=0;
+    int a=0,r=0,g=0,b=0;
+    
+    unsigned char* pixel;
+
+    int index=0;
+
+    unsigned char      *pY;
+    unsigned char      *pU;
+    unsigned char      *pV;
+
+    GST_DEBUG ("converting yuv420 to argb");
+
+    pY = src ;
+    pU = src + (width * height) ;
+    pV = src + (width * height) + (width * height /4) ;
+
+    a = 255;
+
+    for(h = 0 ; h < height; h++)
+    {
+        for(w = 0 ; w < width; w++)
+        {
+            y = GET_PIXEL(pY,w,h,width);
+            u = GET_PIXEL(pU,w/2,h/2,width/2);
+            v = GET_PIXEL(pV,w/2,h/2,width/2);
+
+            r = GET_RED(y,u,v);
+            g = GET_GREEN(y,u,v);
+            b = GET_BLUE(y,u,v);
+
+            r = UCLIP(r);
+            g = UCLIP(g);
+            b = UCLIP(b);
+
+            index = (w + (h* width)) * 4;
+            dst[index] = r;
+            dst[index+1] = g;
+            dst[index+2] = b;
+            dst[index+3] = a;
+        }
+    }
+}
+
+static void
+rotate_pure(unsigned char *src, unsigned char *dst, int width,int height,int angle,int bpp)
+{
+
+    int     size;
+    int     new_x,new_y;
+    int     org_x,org_y;
+    int     dst_width;
+    int     src_idx, dst_idx;
+    
+    size = width * height * bpp;
+    
+    if(angle == 0)
+    {
+        memcpy(dst,src,size);
+        return;
+    }
+
+    for(org_y =0; org_y < height; org_y++)
+    {
+        for(org_x = 0; org_x < width ; org_x++)
+        {
+            if(angle == 90)
+            {
+                new_x = height - org_y;
+                new_y = org_x;
+
+                dst_width = height;
+            }
+            else if(angle == 180)
+            {
+                new_x = width - org_x;
+                new_y = height - org_y;
+                dst_width = width;
+            }
+            else if(angle == 270)
+            {
+                new_x = org_y;
+                new_y = width - org_x;
+                dst_width = height;
+            }
+            else
+            {
+                g_print("Not support Rotate : %d\n",angle);
+                return;
+            }
+
+            src_idx = org_x + (org_y * width);
+            dst_idx = new_x + (new_y * dst_width);
+
+            memcpy(dst + (dst_idx*bpp), src+(src_idx *bpp),bpp);
+        }
+    }
+    
+}
+
+static void
+resize_pure(unsigned char *src, unsigned char *dst, int src_width, int src_height, int dst_width,int dst_height, int bpp)
+{
+    float      xFactor,yFactor;
+
+    float              org_fx,org_fy;
+    int                org_x,org_y;
+
+    int                x,y;
+
+    int                src_index,dst_index;
+
+    unsigned short *pshortSrc;
+    unsigned short *pshortDst;
+
+    if(bpp == 2)
+    {
+        pshortSrc = (unsigned short*)src;
+        pshortDst = (unsigned short*)dst;
+    }
+
+    xFactor = (float)((dst_width<<16) / src_width);
+    yFactor = (float)((dst_height<<16) / src_height);
+
+    for(y = 0; y < dst_height; y++)
+    {
+        for(x = 0; x < dst_width; x++)
+        {
+            org_fx = (float)((x<<16)/xFactor);
+            org_fy = (float)((y<<16)/yFactor);
+
+            org_x = (int)(org_fx);
+            org_y = (int)(org_fy);
+
+            src_index = org_x + (org_y * src_width);
+            dst_index = x + (y*dst_width);
+
+            memcpy(dst+(dst_index *bpp ),src+(src_index *bpp),bpp);
+        }
+    }
+}
+
+/* BOOLEAN:POINTER,INT,INT (avsysvideosink.c:1) */
+void
+gst_avsysmemsink_BOOLEAN__POINTER_INT_INT (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 gboolean (*GMarshalFunc_BOOLEAN__POINTER_INT_INT) (gpointer     data1,
+                                                                gpointer     arg_1,
+                                                                gint         arg_2,
+                                                                gint         arg_3,
+                                                                gpointer     data2);
+    register GMarshalFunc_BOOLEAN__POINTER_INT_INT callback;
+    register GCClosure *cc = (GCClosure*) closure;
+    register gpointer data1, data2;
+
+    gboolean v_return;
+
+    g_return_if_fail (return_value != NULL);
+    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_BOOLEAN__POINTER_INT_INT) (marshal_data ? marshal_data : cc->callback);
+
+    v_return = callback (data1,
+                        g_marshal_value_peek_pointer (param_values + 1),
+                        g_marshal_value_peek_int (param_values + 2),
+                        g_marshal_value_peek_int (param_values + 3),
+                        data2);
+
+    g_value_set_boolean (return_value, v_return);
+}
+
+static void gst_avsysmemsink_init_interfaces (GType type);
+
+
+GST_BOILERPLATE_FULL (GstAvsysMemSink, gst_avsysmemsink, GstVideoSink, GST_TYPE_VIDEO_SINK, gst_avsysmemsink_init_interfaces);
+
+
+static void 
+gst_avsysmemsink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+       GstAvsysMemSink *AvsysMemSink = GST_AVSYS_MEM_SINK (object);
+       switch (prop_id) {
+               case PROP_0:
+                       break;
+               case PROP_WIDTH:
+               if(AvsysMemSink->dst_width != g_value_get_int (value))
+               {
+                               AvsysMemSink->dst_width = g_value_get_int (value);
+                    AvsysMemSink->dst_changed = 1;
+               }
+                       break;
+               case PROP_HEIGHT:
+                       if(AvsysMemSink->dst_height != g_value_get_int (value))
+                       {
+                               AvsysMemSink->dst_height = g_value_get_int (value);
+                    AvsysMemSink->dst_changed = 1;
+                       }
+                       break;
+          case PROP_ROTATE:
+               if(AvsysMemSink->rotate != g_value_get_int(value))
+               {
+                   AvsysMemSink->rotate = g_value_get_int(value);
+                   AvsysMemSink->dst_changed = 1;
+               }
+               break;
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                       g_print ("invalid property id\n");
+                       break;
+       };
+}
+
+static void 
+gst_avsysmemsink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+       GstAvsysMemSink *AvsysMemSink = GST_AVSYS_MEM_SINK (object);
+
+       switch (prop_id) {
+               case PROP_0:
+                       break;
+               case PROP_WIDTH:
+                       g_value_set_int (value, AvsysMemSink->dst_width);
+                       break;
+               case PROP_HEIGHT:
+                       g_value_set_int (value, AvsysMemSink->dst_height);
+                       break;
+          case PROP_ROTATE:
+               g_value_set_int (value, AvsysMemSink->rotate);
+               break;
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                       debug_warning ("invalid property id\n");
+                       break;
+       }
+}
+
+static void
+free_buffer(GstAvsysMemSink *AvsysMemSink)
+{
+    if(AvsysMemSink->con_buf)
+        free(AvsysMemSink->con_buf);
+
+    if(AvsysMemSink->rot_buf)
+        free(AvsysMemSink->rot_buf);
+
+    if(AvsysMemSink->rsz_buf)
+        free(AvsysMemSink->rsz_buf);
+
+    AvsysMemSink->con_buf = NULL;
+    AvsysMemSink->rot_buf = NULL;
+    AvsysMemSink->rsz_buf = NULL;
+
+}
+static GstStateChangeReturn 
+gst_avsysmemsink_change_state (GstElement *element, GstStateChange transition)
+{
+       GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+       GstAvsysMemSink *AvsysMemSink = GST_AVSYS_MEM_SINK (element);
+       switch (transition) {
+               case GST_STATE_CHANGE_NULL_TO_READY:
+                       debug_msg ("GST AVSYS DISPLAY SINK: NULL -> READY\n");
+                       break;
+               case GST_STATE_CHANGE_READY_TO_PAUSED:
+                       debug_msg ("GST AVSYS DISPLAY SINK: READY -> PAUSED\n");
+                       break;
+               case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+                       debug_msg ("GST AVSYS DISPLAY SINK: PAUSED -> PLAYING\n");
+                       break;
+               default:
+                       break;
+       }
+
+       ret = GST_ELEMENT_CLASS(parent_class)->change_state (element, transition);
+       if (ret == GST_STATE_CHANGE_FAILURE) {
+               return ret;
+       }
+
+       switch (transition) {
+               case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+                       debug_msg ("GST AVSYS MEM SINK: PLAYING -> PAUSED\n");
+                       break;
+               case GST_STATE_CHANGE_PAUSED_TO_READY:
+                       debug_msg ("GST AVSYS MEM SINK: PAUSED -> READY\n");
+               free_buffer(AvsysMemSink);        
+                       break;
+               case GST_STATE_CHANGE_READY_TO_NULL:
+                       debug_msg ("GST AVSYS MEM SINK: READY -> NULL\n");
+                       break;
+               default:
+                       break;
+       }
+
+       return ret;
+
+
+}
+
+
+static gboolean
+gst_avsysmemsink_set_caps (GstBaseSink * bs, GstCaps * caps)
+{
+    GstAvsysMemSink *s = GST_AVSYS_MEM_SINK (bs);
+    GstStructure *structure;
+    gint width = 0;
+    gint height = 0;
+
+    if (caps != NULL)
+    {
+        guint32 fourcc;
+        char *name = NULL;
+        int bpp = 0, depth = 0;
+
+        structure = gst_caps_get_structure (caps, 0);
+
+        /**/
+        name = (char *) gst_structure_get_name (structure);
+        GST_DEBUG_OBJECT (s, "CAPS NAME: %s", name);
+
+               if (gst_structure_has_name (structure, "video/x-raw-rgb"))
+               {
+                       s->is_rgb = TRUE;
+               }
+               else if (gst_structure_has_name (structure, "video/x-raw-yuv")) 
+               {
+                       s->is_rgb = FALSE;
+               }
+
+        /* get source size */
+        gst_structure_get_int (structure, "height", &height);
+        gst_structure_get_int (structure, "width", &width);
+
+        if (gst_structure_get_fourcc (structure, "format", &fourcc)) 
+        {
+            switch (fourcc) 
+            {
+                case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
+                    debug_warning("set format AVSYS_VIDEO_FORMAT_UYVY\n");
+                    break;
+                case GST_MAKE_FOURCC ('Y', 'V', '1', '6'):
+                case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
+                    debug_warning("set format AVSYS_VIDEO_FORMAT_YUV422\n");
+                    break;
+                case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
+                    debug_warning("set format AVSYS_VIDEO_FORMAT_YUV420\n");
+                    break;
+                case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
+                    debug_warning("set format AVSYS_VIDEO_FORMAT_RGB565\n");
+                    break;
+                default:
+                    debug_warning("set default format AVSYS_VIDEO_FORMAT_RGB565\n");
+                    break;
+            }
+        }
+
+        if( s->src_width != width || 
+            s->src_height != height) 
+        {
+            debug_warning ("DISPLAY: Video Source Changed! [%d x %d] -> [%d x %d]\n",
+                                    s->src_width, s->src_height, width, height);
+            s->src_changed = TRUE;
+        }
+
+        s->src_width = width;
+        s->src_height = height;
+
+        if(s->dst_width ==0)
+        {
+            s->dst_width = width;
+            s->dst_changed = 1;
+        }
+
+        if(s->dst_height == 0)
+        {
+            s->dst_height = height;
+            s->dst_changed = 1;            
+        }
+        debug_msg ("SRC CAPS: width:%d, height:%d \n", width, height);
+    } 
+    else 
+    {
+        debug_warning ("caps is NULL.\n");
+    }
+
+    debug_fleave ();
+
+    return TRUE;
+}
+
+static GstFlowReturn
+gst_avsysmemsink_preroll (GstBaseSink * bsink, GstBuffer * buf)
+{
+       GstAvsysMemSink *AvsysMemSink = GST_AVSYS_MEM_SINK (bsink);
+
+       AvsysMemSink->src_length = GST_BUFFER_SIZE (buf);
+       debug_msg ("SRC LENGTH: %d\n", AvsysMemSink->src_length);
+
+       return GST_FLOW_OK;
+}
+
+static GstFlowReturn
+gst_avsysmemsink_show_frame (GstBaseSink * bsink, GstBuffer * buf)
+{
+       GstAvsysMemSink *s = GST_AVSYS_MEM_SINK (bsink);
+       gboolean res = FALSE;
+       int f_size;
+       f_size = GST_BUFFER_SIZE (buf);
+       unsigned char       *dst_buf;
+
+       if ( ! s->is_rgb )
+       {
+           GST_DEBUG_OBJECT (s, "src format is not rgb");
+           if (s->dst_changed == TRUE)
+           {
+               if(s->con_buf)
+               {
+                   free(s->con_buf);
+                   s->con_buf = NULL;
+               }
+
+               if(s->rot_buf)
+               {
+                   free(s->rot_buf);
+                   s->rot_buf = NULL;
+               }
+
+               if(s->rsz_buf)
+               {
+                   free(s->rsz_buf);
+                   s->rsz_buf = NULL;
+               }
+
+               s->con_buf = malloc(s->src_width * s->src_height * 4);
+               if(s->rotate != 0)
+               {
+                   s->rot_buf = malloc(s->src_width * s->src_height * 4);
+               }
+
+               s->rsz_buf = malloc(s->dst_width * s->dst_height *4);
+               
+               s->dst_changed = FALSE;
+           } 
+
+           yuv420toargb(GST_BUFFER_DATA (buf),s->con_buf,s->src_width, s->src_height);
+           if(s->rotate != 0)
+           {
+               rotate_pure(s->con_buf,s->rot_buf,s->src_width, s->src_height,s->rotate,4);
+               if(s->rotate == 90 || s->rotate == 270)
+               {
+                   resize_pure(s->rot_buf,s->rsz_buf,s->src_height,s->src_width,
+                               s->dst_width, s->dst_height,4);
+               }
+               else
+               {
+                   resize_pure(s->rot_buf,s->rsz_buf,s->src_width,s->src_height,
+                               s->dst_width, s->dst_height,4);
+               }
+           }
+           else
+           {
+               resize_pure(s->con_buf,s->rsz_buf,s->src_width,s->src_height,
+                               s->dst_width, s->dst_height,4);
+           }
+
+           /* emit signal for video-stream */
+           g_signal_emit (s,gst_avsysmemsink_signals[SIGNAL_VIDEO_STREAM],
+                           0,s->rsz_buf,
+                           s->dst_width,s->dst_height,
+                           &res);
+       }
+       else
+       {
+               GST_DEBUG_OBJECT (s, "src format is rgb");
+
+               /* NOTE : video can be resized by convert plugin's set caps on running time. 
+                * So, it should notice it to application through callback func.
+                */
+                g_signal_emit (s, gst_avsysmemsink_signals[SIGNAL_VIDEO_STREAM],
+                                   0, GST_BUFFER_DATA (buf),
+                                   s->src_width, s->src_height,
+                                   &res);
+        }
+        GST_DEBUG_OBJECT (s, "g_signal_emit : src_width=%d, src_height=%d, GST_BUFFER_SIZE=%d", s->src_width,s->src_height,GST_BUFFER_SIZE(buf));
+
+    /*check video stream callback result.*/
+    if (res) 
+    {
+        //debug_verbose("Video stream is called.\n");
+        return GST_FLOW_OK;
+    }
+
+    return GST_FLOW_OK;
+}
+
+static void
+gst_avsysmemsink_init_interfaces (GType type)
+{
+       /*void*/
+}
+
+
+static void 
+gst_avsysmemsink_base_init (gpointer klass)
+{
+       GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+       gst_element_class_add_pad_template (element_class, 
+                                gst_static_pad_template_get (&sink_factory));
+       gst_element_class_set_details (element_class, &AvsysMemSink_details);
+}
+
+static void 
+gst_avsysmemsink_class_init (GstAvsysMemSinkClass *klass)
+{
+       GObjectClass *gobject_class  = (GObjectClass*) klass;
+       GstElementClass *gstelement_class = (GstElementClass*) klass;
+       GstBaseSinkClass *gstbasesink_class = (GstBaseSinkClass *) klass;
+
+    
+       parent_class = g_type_class_peek_parent (klass);
+
+       gobject_class->set_property = gst_avsysmemsink_set_property;
+       gobject_class->get_property = gst_avsysmemsink_get_property;
+
+
+       g_object_class_install_property (gobject_class, PROP_WIDTH,
+                                                                               g_param_spec_int ("width",
+                                                                                                       "Width",
+                                                                                                       "Width of display",
+                                                                                                       0, G_MAXINT, 176,
+                                                                                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+
+       g_object_class_install_property (gobject_class, PROP_HEIGHT,
+                                                                               g_param_spec_int ("height",
+                                                                                                       "Height",
+                                                                                                       "Height of display",
+                                                                                                       0, G_MAXINT, 144,
+                                                                                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+       g_object_class_install_property (gobject_class, PROP_ROTATE,
+                                                                               g_param_spec_int ("rotate",
+                                                                                                       "Rotate",
+                                                                                                       "Rotate of display",
+                                                                                                       0, G_MAXINT, 0,
+                                                                                                       G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+
+       /**
+       * GstAvsysVideoSink::video-stream:
+       */
+       gst_avsysmemsink_signals[SIGNAL_VIDEO_STREAM] = g_signal_new (
+                                                       "video-stream",
+                                                       G_TYPE_FROM_CLASS (klass),
+                                                       G_SIGNAL_RUN_LAST,
+                                                       0,
+                                                       NULL,
+                                                       NULL,
+                                                       gst_avsysmemsink_BOOLEAN__POINTER_INT_INT,
+                                                       G_TYPE_BOOLEAN,
+                                                       3,
+                                                       G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT);
+
+    gstelement_class->change_state = gst_avsysmemsink_change_state;
+
+    gstbasesink_class->set_caps = gst_avsysmemsink_set_caps;
+    gstbasesink_class->preroll = GST_DEBUG_FUNCPTR (gst_avsysmemsink_preroll);
+    gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_avsysmemsink_show_frame);
+
+    
+    GST_DEBUG_CATEGORY_INIT (avsysmemsink_debug, 
+                            "avsysmemsink",
+                            0,
+                            "AV system based GStreamer Plug-in");
+}
+
+
+static void 
+gst_avsysmemsink_init (GstAvsysMemSink *AvsysMemSink, GstAvsysMemSinkClass *klass)
+{
+    /*private*/
+    AvsysMemSink->src_width = 0;
+    AvsysMemSink->src_height = 0;
+
+    AvsysMemSink->src_changed = 0;
+
+    /*property*/
+    AvsysMemSink->dst_width = 0;
+    AvsysMemSink->dst_height = 0;
+
+    AvsysMemSink->dst_changed = 0;
+
+    AvsysMemSink->rotate = 0;
+
+    AvsysMemSink->con_buf = NULL;
+    AvsysMemSink->rot_buf = NULL;
+    AvsysMemSink->rsz_buf = NULL;
+
+       AvsysMemSink->is_rgb = FALSE;
+}
+
+
+/* EOF */
diff --git a/avsystem/src/gstavsysmemsink.h b/avsystem/src/gstavsysmemsink.h
new file mode 100644 (file)
index 0000000..bc28029
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * avsystem
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __GST_AVSYSMEMSINK_H__
+#define __GST_AVSYSMEMSINK_H__
+
+#include <gst/gst.h>
+#include <gst/video/gstvideosink.h>
+#include <gst/interfaces/xoverlay.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_AVSYS_MEM_SINK             (gst_avsysmemsink_get_type())
+#define GST_AVSYS_MEM_SINK(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVSYS_MEM_SINK, GstAvsysMemSink))
+#define GST_AVSYS_MEM_SINK_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVSYS_MEM_SINK, GstAvsysMemSinkClass))
+#define GST_IS_AVSYS_MEM_SINK(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVSYS_MEM_SINK))
+#define GST_IS_AVSYS_MEM_SINK_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVSYS_MEM_SINK))
+
+
+typedef struct _GstAvsysMemSink      GstAvsysMemSink;
+typedef struct _GstAvsysMemSinkClass GstAvsysMemSinkClass;
+
+struct _GstAvsysMemSink
+{
+    GstVideoSink        videosink;
+
+    int                 src_width;
+    int                 src_height;
+
+    int                 src_changed;
+    int                 src_length;
+
+
+    int                 dst_width;
+    int                 dst_height;
+
+    int                 dst_length;
+    int                 dst_changed;
+
+    unsigned char       *con_buf;
+    unsigned char       *rot_buf;
+    unsigned char       *rsz_buf;
+
+       int                 rotate;
+
+       int                             is_rgb;
+};
+
+struct _GstAvsysMemSinkClass
+{
+       GstVideoSinkClass parent_class;
+};
+
+GType gst_avsysmemsink_get_type (void);
+
+G_END_DECLS
+
+
+#endif /* __GST_AVSYSMEMSINK_H__ */
+
+/* EOF */
diff --git a/avsystem/src/gstavsyssink.c b/avsystem/src/gstavsyssink.c
new file mode 100644 (file)
index 0000000..a1ab29e
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * avsystem
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <gst/gst.h>
+#include "gstavsysaudiosink.h"
+#include "gstavsysmemsink.h"
+
+GST_DEBUG_CATEGORY (avsystem_sink_debug);
+
+static gboolean
+plugin_init (GstPlugin *plugin)
+{
+       gboolean error;
+       /*register the exact name you can find in the framework*/
+       error = gst_element_register (plugin, "avsysaudiosink",
+                                                                 GST_RANK_PRIMARY + 100,
+                                                                 GST_TYPE_AVSYS_AUDIO_SINK);
+
+       error = gst_element_register (plugin, "avsysmemsink",
+                                                                 GST_RANK_NONE,
+                                                                 GST_TYPE_AVSYS_MEM_SINK);
+
+       if (!error)
+               goto failed;
+
+       GST_DEBUG_CATEGORY_INIT (avsystem_sink_debug, "avsystemsink", 0, "avsystem sink plugins");
+       return TRUE;
+
+failed:
+
+       return FALSE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+               GST_VERSION_MINOR,
+               "avsyssink",
+               "AV system video/audio sink plug-in",
+               plugin_init,
+               PACKAGE_VERSION,
+               "LGPL",
+               "AV System Sink",
+               "http://www.samsung.com")
diff --git a/avsystem/src/gstavsyssrc.c b/avsystem/src/gstavsyssrc.c
new file mode 100644 (file)
index 0000000..adde8df
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * avsystem
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "gstavsysaudiosrc.h"
+
+GST_DEBUG_CATEGORY (avsystem_src_debug);
+
+static gboolean
+plugin_init (GstPlugin *plugin)
+{
+       gboolean error;
+       /*register the exact name you can find in the framework*/
+       error = gst_element_register (plugin, "avsysaudiosrc",
+                                                                 GST_RANK_NONE,
+                                                                 GST_TYPE_AVSYS_AUDIO_SRC);
+       if (!error)
+               goto failed;
+
+       GST_DEBUG_CATEGORY_INIT (avsystem_src_debug, "avsystemsrc", 0, "avsystem src plugins");
+       return TRUE;
+
+failed:
+
+       return FALSE;
+}
+
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+               GST_VERSION_MINOR,
+               "avsysaudiosrc",
+               "AV system audio source plug-in",
+               plugin_init,
+               PACKAGE_VERSION,
+               "LGPL",
+               "AV System Source",
+               "http://www.samsung.com")
+
diff --git a/common/ChangeLog b/common/ChangeLog
new file mode 100755 (executable)
index 0000000..72f093a
--- /dev/null
@@ -0,0 +1,1343 @@
+2008-03-07  Edward Hervey  <edward.hervey@collabora.co.uk>
+
+       * m4/gtk-doc.m4: (GTK_DOC_CHECK): 
+       The previous commit to this file by Stefan Kost mentionned checking for
+       SED, but NOT checking for gtkdoc-check (wth is that doing there ??).
+       Therefore, removing the check for gtkdoc-check
+
+2008-03-03  David Schleef  <ds@schleef.org>
+
+       * m4/ax_create_stdint_h.m4: Oops, checked in the wrong copy of
+         this file.  (Update from upstream)
+
+2008-03-03  David Schleef  <ds@schleef.org>
+
+       * m4/ax_create_stdint_h.m4:  Update from upstream.  Fixes a bug
+         compiling with MSVC.
+
+2008-03-03  Edward Hervey  <edward.hervey@collabora.co.uk>
+
+       * m4/pkg.m4:
+       Allow override of pkg-config results, as proposed by configure --help.
+       This is in fact just a backport from upstream pkg.m4.
+       Fixes #518892
+
+2008-03-03  Peter Kjellerstedt  <pkj@axis.com>
+
+       * ChangeLog:
+       Changelog surgery of my previous commit to add bugzilla reference.
+       * m4/gst-args.m4:
+       Add AG_GST_CHECK_PLUGIN and AG_GST_DISABLE_PLUGIN to make it easier
+       to include and exclude plug-ins without external references, i.e.,
+       plug-ins listed in GST_PLUGINS_SELECTED. (#498222)
+
+2008-03-03  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst.supp:
+       Add another glibc suppression.
+
+2008-02-29  Peter Kjellerstedt  <pkj@axis.com>
+
+       * m4/gst-feature.m4:
+       Make the comment before defines generated via AG_GST_CHECK_FEATURE
+       look nicer. (#498222)
+
+2008-02-26  Jan Schmidt  <jan.schmidt@sun.com>
+
+       * m4/Makefile.am:
+       * m4/as-gcc-inline-assembly.m4:
+       Add Dave Schleef's GCC inline assembly detection macro
+       for using in gst-plugins-good in the goom 2k4 plugin.
+
+2008-02-25  Andy Wingo  <wingo@pobox.com>
+
+       * gst-autogen.sh: Instead of only passing certain arguments to
+       configure, pass anything that we didn't handle. Much friendlier.
+       Fixes #34412.
+
+2008-02-23  Jan Schmidt  <Jan.Schmidt@sun.com>
+
+       * m4/gst-error.m4:
+       Store the detected compiler flags into ERROR_CFLAGS rather than
+       ERROR_CXXFLAGS, and use the macro that checks the C compiler, not
+       the C++ one.
+
+2008-02-23  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * m4/gst-error.m4:
+         Reflow checks for additional warning flags so they're not
+         nested, which fixes the result reporting in the configure
+         output.
+
+2008-02-22  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * m4/as-compiler-flag.m4:
+         Add AS_CXX_COMPILER_FLAG
+
+       * m4/gst-error.m4:
+         Add AG_GST_SET_ERROR_CXXFLAGS (Forte bits need testing)
+
+2008-02-22  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * gtk-doc-plugins.mak:
+         Add 'check-inspected-versions' target; this helps identify
+         files that should have been removed or where the version
+         number should (ideally) be updated before a release
+         (which doesn't happen automatically if the releaser doesn't
+         build that plugin locally). Not adding at a distcheck hook
+         yet though, because it's not really that important and would
+         probably also be a problem on buildbots.
+
+2008-02-22  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst.supp:
+       Add even more glibc 2.7 suppressions.
+
+2008-02-22  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst.supp:
+       Add another suppression for GLib caching some values after
+       the first call.
+
+2008-02-12  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       Patch by:
+         Tim Mooney <mooney at dogbert dot cc dot ndsu dot nodak dot edu>
+
+       * m4/gst-error.m4:
+       Use no%E_MACRO_REDEFINED on Solaris to prevent compiler warnings.
+       Fixes bug #515905.
+
+2008-02-11  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst.supp:
+       Add a few more glibc 2.7 suppressions to make the avisubtitle unit
+       test valgrind clean. Fixes bug #515703.
+
+2008-02-08  Stefan Kost  <ensonic@users.sf.net>
+
+       * ChangeLog:
+         Changelog surgery for last commit.
+
+2008-02-08  Stefan Kost  <ensonic@users.sf.net>
+
+       * m4/gtk-doc.m4:
+         Conditionally check for SED. Also sync a bit with upstream macro.
+
+2008-02-08  Stefan Kost  <ensonic@users.sf.net>
+
+       * gtk-doc-plugins.mak:
+       * gtk-doc.mak:
+         Use '$(SED)' instead of 'sed'. Don't use -i for in-place as its gnu
+         only, move to a temp file instead.
+
+2008-02-06  Stefan Kost  <ensonic@users.sf.net>
+
+       * gtk-doc-plugins.mak:
+       * gtk-doc.mak:
+        As our docs are versioned, we need to patch the index.sgml file to have
+        correct paths there, unless we also want to fork gtk-doc's xsl (which
+        we don't). This hopefully fixes xrefs between modules.
+
+2008-02-02  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * m4/gst-feature.m4:
+       Use printf instead of echo as "echo -e" isn't POSIX and doesn't work
+       with strict POSIX shells like tcsh or dash and also not every platform
+       has a /bin/echo that supports it.
+
+2008-01-24  Stefan Kost  <ensonic@users.sf.net>
+
+       * ChangeLog:
+         ChangeLog surgery.
+
+       * gstdoc-scangobj:
+         Sync the object scanner with gtk-doc fixes. Update args and hierarchy
+         files.
+
+2008-01-20  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * check.mak:
+       * coverage/lcov.mak:
+       * gtk-doc-plugins.mak:
+       * release.mak:
+       Use $(MAKE) instead of make to fix the build if GNU make is called
+       something else on the system.
+       
+       * m4/as-docbook.m4:
+       Fix path for docbook.xsl if we have no /etc/xml/catalog and add a
+       docbook-xsl search path for FreeBSD.
+
+2008-01-18  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst.supp:
+       Add a suppression for a glibc bug:
+       http://valgrind.org/docs/manual/faq.html#faq.exit_errors>
+
+2008-01-18  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst.supp:
+       Add some more glibc 2.7 suppressions and make the GLib suppressions
+       for the home/tmp/etc directory caching a bit more generic.
+
+2008-01-18  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst.supp:
+       Add some glibc 2.7 supressions as found on Debian/unstable.
+
+2008-01-14  Jan Schmidt  <jan.schmidt@sun.com>
+
+       * download-translations:
+       Apparently I have problems with leaving things commented out when
+       I edit shell scripts.
+
+2008-01-12  Jan Schmidt  <Jan.Schmidt@sun.com>
+
+       * download-translations:
+       Remove bash-isms
+
+2008-01-12  Jan Schmidt  <Jan.Schmidt@sun.com>
+
+       * check-exports:
+       Restore the cleanup rm of our tmp file which I didn't mean to leave 
+       commented out.
+
+2008-01-12  Jan Schmidt  <Jan.Schmidt@sun.com>
+
+       * check-exports:
+         Fixes to make check-export work on both Solaris and Linux
+
+       * m4/gst-error.m4:
+         Disable extra warning category (argument mismatch) as an error
+         on Forte, as it prevents the libcheck fail_if macros from compiling.
+
+       * win32.mak:
+         Substitute the GStreamer version so things will keep working in 0.11
+
+2008-01-11  Tim-Philipp Müller  <tim at centricular dot net>
+
+       Patch by: Peter Kjellerstedt <pkj axis com>
+
+       * m4/gst-glib2.m4:
+       * m4/gst-libxml2.m4:
+         Improve/fix output from configure if either glib-2.0 or
+         libxml2 are not installed (#498222).
+
+2008-01-09  Stefan Kost  <ensonic@users.sf.net>
+
+       * coverage/lcov.mak:
+         Update coverage make-rules: use them conditionaly, use libtool mode
+         and use lcov to cleanup.
+
+2007-12-18  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * glib-gen.mak:
+         Also use #include "header" instead of #include <header> for the
+         headers that were used to generate the source files for the same
+         reason as below.
+
+         Remove whitespace before #include.
+
+2007-12-18  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * glib-gen.mak:
+         Use #include "header" instead of #include <header> for the generated
+         enum C files as the file will always be in the same directory and
+         some compilers seem to be a bit strict about that unless . is added
+         to the include path.
+
+         Include all headers that were used to generate the source files in
+         the C file as they're used there.
+
+2007-12-17  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * win32.mak: (win32), (win32defs), (win32crlf):
+         Make check for CR LF in Visual C++ 6.0 project files
+         work, based on patch by David Schleef (#496722, #393626).
+       
+2007-12-17  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * Makefile.am:
+         Don't forget to dist the new win32.mak.
+
+2007-12-17  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * win32.mak: (win32), (win32defs):
+         Move common win32 Makefile foo into this new file.
+
+2007-12-15  Stefan Kost  <ensonic@users.sf.net>
+
+       * gtk-doc-plugins.mak:
+       * gtk-doc.mak:
+         We should have never forked this that much :/.
+
+2007-12-13  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * check-exports:
+         Fix build on the ppc64 build bot.
+
+2007-12-13  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * check-exports:
+         Suppress more unintentional exports (too much hassle to rename them,
+         since the win32 project files would need changing too).
+
+2007-12-12  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * Makefile.am:
+         check-exports should be disted.
+
+2007-12-12  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * check-exports:
+         Add quick'n'dirty script to check the exported symbols of a library
+         against the symbols in the corresponding .def file (#493983). Based
+         on script by Ole André Vadla RavnÃ¥s.
+
+2007-11-06  Jan Schmidt  <jan.schmidt@sun.com>
+
+       * gtk-doc-plugins.mak:
+       Fix distcheck by making sure the types files are treated like the
+       other gtkdoc-scangobj generated files.
+
+2007-09-21  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * m4/gst-args.m4:
+         Let the AG_GST_ARG_ENABLE_EXPERIMENTAL macro default to disable
+         building of experimental plugins. Nobody uses it yet and the
+         --enable--experimental stuff from gst-plugins-good defaults to
+         disable too.
+
+2007-09-06  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * gtk-doc-plugins.mak:
+         Just use the normal 'check' target and avoid a circular
+         dependency.
+
+2007-09-06  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * gtk-doc-plugins.mak:
+         Add rule to error out if .hierarchy file contains tabs.
+
+2007-08-20  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * download-translations:
+       * po.mak:
+         If there are new languages, they need to be added to po/LINGUAS.
+
+2007-08-20  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * download-translations:
+       * po.mak:
+         Fix up 'download-po' a bit, so that we find new translations
+         for languages that aren't in our po/LINGUAS file yet too.
+
+2007-07-16  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * gst.supp:
+       Add a suppression for GLib caching the tmp dir seen on an
+       Ubuntu Feisty system.
+
+2007-07-13  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * m4/gst-feature.m4:
+       If we want to use 'echo -e', call /bin/echo instead of the shell's
+       since -e is a bash extension, and our /bin/sh might not be being
+       provided by bash.
+
+2007-07-01  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * po.mak:
+         Translation project has moved.  Also, no idea how this used to
+         work given that we weren't downloading a .po file.
+
+2007-06-25  Stefan Kost  <ensonic@users.sf.net>
+
+       * gst-xmlinspect.py:
+       * plugins.xsl:
+         Also extract element caps for plugin-docs. Fixes parts of #117692.
+
+2007-06-21  Tim-Philipp Müller  <tim at centricular dot net>
+
+       Patch by: Andreas Schwab
+
+       * m4/gst-feature.m4:
+         Fix quoting (#449493).
+
+2007-06-10  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * m4/gst-parser.m4:
+       Only generate the parser if bison >= 1.875 _and_ flex >= 2.5.31 is
+       installed and use pre-generated sources otherwise. Fixes bug #444820.
+
+2007-05-11  Michael Smith <msmith@fluendo.com>
+
+       * gst.supp:
+         Suppression variant for our good friend the TLS leak, this time for
+         Ubuntu Feisty/x86.
+
+2007-05-09  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * gtk-doc-plugins.mak:
+         Fix make distcheck again; change some spaces to tabs in makefile.
+
+2007-04-29  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gtk-doc-plugins.mak (-module):
+         Error out when the html build step gives warnings, so they get
+         fixed properly.
+
+2007-04-23  Stefan Kost  <ensonic@users.sf.net>
+
+       * m4/gst-feature.m4:
+         Add macro AG_GST_PARSE_SUBSYSTEM_DISABLES that checks the defines in
+         the configuration header and AC_DEFINES the setings.
+
+2007-04-19  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       Patch by: Vincent Torri <vtorri at univ-evry dot fr>
+
+       * m4/gst-parser.m4:
+       Put the AC_MSG_RESULT output in brackets to get it properly written to
+       the terminal.
+
+2007-04-18  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * m4/gst-parser.m4:
+       Check for flex >= 2.5.31 and set GENERATE_PARSER if we have at least
+       that version. Otherwise use pre-generated parser sources as we can't
+       raise the required flex version. HAVE_MT_SAVE_FLEX is obsolete now
+       as we use a new enough flex version anyway. First part of #349180
+
+2007-04-10  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-check.m4:
+         Allow pre-setting the GST(PB)_TOOLS/PLUGINS_DIR variables to help
+         builds against older GStreamer.
+
+2007-03-25  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * m4/gst-parser.m4:
+       Fix the flex version check. It ignored the micro version before.
+
+2007-03-09  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * check.mak:
+       Use the same timeout when generating valgrind suppressions as 
+       running the valgrind test.
+
+       * gst.supp:
+       Add some more suppressions and stuff.
+
+2007-03-08  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * check.mak:
+       Make sure GSlice is disabled when building suppressions too.
+
+       * gst.supp:
+       Add around *850* lines of suppressions for one-time initialisations
+       inside libasound and gconf/bonobo/ORBit. I feel so dirty.
+
+2007-03-07  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * gst.supp:
+       add a suppression for this GConf flup on the FC5 buildbot.
+
+2007-03-06  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * gst.supp:
+       Make the suppression a little more generic, to catch the FC5 
+       backtrace too.
+
+2007-03-06  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * gst.supp:
+       Add a suppression for libcdio 0.76. It leaks an internal struct
+       when the CD-ROM device is not accessible.
+
+2007-02-28  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-arch.m4:
+         Move a line that was in the wrong macro
+
+2007-02-28  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst.m4:
+         Add
+       * m4/gst-arch.m4:
+       * m4/gst-args.m4:
+       * m4/gst-check.m4:
+       * m4/gst-debuginfo.m4:
+       * m4/gst-default.m4:
+       * m4/gst-doc.m4:
+       * m4/gst-error.m4:
+       * m4/gst-feature.m4:
+       * m4/gst-function.m4:
+       * m4/gst-gettext.m4:
+       * m4/gst-glib2.m4:
+       * m4/gst-libxml2.m4:
+       * m4/gst-parser.m4:
+       * m4/gst-plugin-docs.m4:
+       * m4/gst-plugindir.m4:
+       * m4/gst-valgrind.m4:
+       * m4/gst-x11.m4:
+         Convert all macros to use AG_GST style so we can properly warn
+         when they're missing if configure.ac calls AG_GST_INIT
+         Will require update in all GStreamer modules.
+
+2007-02-11  Stefan Kost  <ensonic@users.sf.net>
+
+       * m4/gst-args.m4:
+         Remove 'enable' from configure switch description as this leads to 
+         confusing lines like "disable enable builing ...".
+       * m4/gst-feature.m4:
+         Fix comment to sound less horrible.
+
+2007-02-07  Tim-Philipp Müller  <tim at centricular dot net>
+
+       Patch by: Will Newton  <will.newton gmail com>
+
+       * m4/gst-check.m4:
+         Use $PKG_CONFIG rather than pkg-config directly, the one in our path
+         might not be the one we want, like when cross-compiling. Also, other
+         macros such as PKG_CHECK_MODULES use $PKG_CONFIG, so we should
+         probably too just for consistency. Fixes #405288.
+
+2007-01-08  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * m4/gst-parser.m4:
+         Need to use double square brackets again so m4 doesn't remove them
+         (fixes #378931).
+
+       * m4/gst-args.m4:
+         Use double square brackets here as well, for the same reason.
+
+2007-01-05  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * m4/gst-parser.m4:
+         Use 'sed' rather than 'tr' to strip trailing letters from version
+         numbers, since 'tr' might not be available and we know sed is
+         (#378931).
+
+2006-10-21  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * check.mak:
+         Increase default timeout under valgrind, 60 is just too short and
+         some tests take a bit longer these days and not everyone has a
+         beefy machine.
+
+2006-09-29  Michael Smith  <msmith@fluendo.com>
+
+       * gst.supp:
+         More suppressions for edgy. 
+
+2006-09-28  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * m4/gst-glib2.m4:
+       Use gmodule-no-export-2.0.pc instead of gmodule-2.0.pc - we neither
+       want nor need --export-dynamic (which ends up making us export a bunch
+       of unneeded symbols)
+
+2006-09-14  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * gst.supp:
+         Some suppressions for the more recent ld.so in ubuntu edgy.
+
+2006-08-23  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * gst.supp:
+         Shorten function trail so the suppression works on
+         my ubuntu dapper system with core cvs as well.
+
+2006-07-28  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * gst.supp:
+       Extra suppressions from my Ubuntu x86_64 machine
+
+2006-07-24  Tim-Philipp Müller  <tim at centricular dot net>
+
+       Patch by: Frederic Peters <fpeters at entrouvert com>
+
+       * m4/gst-parser.m4:
+         Need to double square brackets in .m4 files. Should fix bison
+         version detection with version numbers like 1.23a (#348354).
+
+2006-07-24  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * check.mak:
+       Valgrind fails to find tests written in tests/check/ directly (rather
+       than a subdir) - because valgrind gets run with a filename that
+       doesn't contain a relative path, it goes searching /usr/bin instead.
+       Run with ./.... to make things work either way.
+
+       * gtk-doc-plugins.mak:
+       Add $(top_builddir)/src as a place to look for plugins
+       when building too, since that's where gst-template keeps things
+
+2006-07-23  Stefan Kost  <ensonic@users.sf.net>
+
+       Patch by: Frederic Peters <fpeters@entrouvert.com>
+
+       * m4/gst-parser.m4:
+         Fix bison detection (#348354)
+
+2006-07-21  Stefan Kost  <ensonic@users.sf.net>
+
+       * m4/gst-parser.m4:
+         check for bison and flex
+
+2006-07-13  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-plugin-docs.m4:
+         remove the configure argument for enabling plugin doc build;
+         having gtk-doc enabled and pyxml present is enough of a trigger
+
+2006-07-03  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * coverage/lcov.mak:
+         fix up rules to work with gst-python as well
+         run "make lcov" to test and generate the reports
+         run "make lcov-reset" to redo it after that
+
+2006-07-02  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * Makefile.am:
+       * check.mak:
+         add an inspect target that inspects every element feature,
+         so we can have that added for coverage
+       * coverage/lcov.mak:
+         add support for lcov
+
+2006-07-02  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-args.m4:
+         when building with gcov, reset CFLAGS and friends to O0
+
+2006-07-02  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-args.m4:
+         Find the gcov that matches the gcc version
+         Only allow gcov if we use gcc
+
+2006-07-02  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * Makefile.am:
+       * coverage/coverage-report-entry.pl:
+       * coverage/coverage-report.pl:
+       * coverage/coverage-report.xsl:
+         copy coverage reporting files from dbus
+
+2006-07-01  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-args.m4:
+         libtool strips gcov's -f flags, so libgcov does not get
+         linked in.  Setting GCOV_LIBS with -lgcov fixes libtool's
+         stripping
+         also show what pkg-config-path we set
+
+2006-06-22  Tim-Philipp Müller  <tim at centricular dot net>
+
+       Patch by: Peter Kjellerstedt <pkj at axis com>
+
+       * m4/gst-feature.m4:
+         Show list of plugins without external dependencies that
+         will not be built as well (#344136).
+
+2006-06-15  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * m4/gst-plugin-docs.m4:
+         add GST_PLUGIN_DOCS, which checks for everything needed
+         to build the plugin docs (namely gtk-doc and pyxml); also
+         adds a new --enable-plugin-docs configure switch; will
+         set ENABLE_PLUGIN_DOCS conditional for use in Makefile.am
+         files (see #344039).
+
+2006-06-11  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-check.m4:
+         add GST_PKG_CHECK_MODULES, which in the normal case of checking
+         for a dependency lib for a plug-in only needs two arguments
+         to do the right thing.
+       * m4/gst-feature.m4:
+         clean up output a little of feature checking; also deal with
+         non-plug-in feature checks
+       * m4/Makefile.am:
+       * m4/gst-gstreamer.m4:
+         remove this file; it's a useless check
+
+2006-06-06  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-arch.m4:
+         add PPC64 so we can have separate structure sizes for it
+
+2006-06-05  Edward Hervey  <edward@fluendo.com>
+
+       * gtk-doc.mak:
+       Check for the proper .devhelp2 file to remove.
+
+2006-05-31  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gtk-doc.mak:
+         allow a magic variable to suppress errors from docbuilding
+
+2006-05-30  Thomas Vander Stichele  <thomas (at) apestaart (dot) org>
+
+       * gtk-doc.mak:
+         error out if gtkdoc-mktmpl finds unused declarations
+
+2006-05-28  Edward Hervey  <edward@fluendo.com>
+
+       * gst.supp:
+       Reverting previous commit.  That's good to know, Edward, but why ?
+       
+2006-05-28  Edward Hervey  <edward@fluendo.com>
+
+       * gst.supp:
+       Added suppresion for memleak in g_option_context_parse on fc5-64
+
+2006-05-19  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-check.m4:
+         set GSTPB_PLUGINS_DIR just like GST_PLUGINS_DIR
+
+2006-05-18  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * check.mak:
+         Fix 'make help' in check directories, it should be
+         'valgrind.gen-suppressions' not 'valgrind-gen-suppressions'
+         (not changing target to match help string on purpose to keep
+         scripts etc. functional).
+
+2006-05-18  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       Patch by: Peter Kjellerstedt
+
+       * m4/gst-arch.m4:
+         add support for CRIS and CRISv32.
+
+2006-05-17  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * m4/gst-args.m4:
+       Fix the macros for command-line supplied package and origin names
+       so they don't end up being configure as "" (Fixes #341479)
+
+2006-05-14  Jan Schmidt <thaytan@mad.scientist.com>
+
+       * gtk-doc.mak:
+       Add uninstall rule to remove .devhelp2 files.
+
+2006-05-09  Edward Hervey  <edward@fluendo.com>
+
+       * gst.supp: 
+         Add suppression for GSlice version of
+         g_type_init calloc leak
+
+2006-04-05  Michael Smith  <msmith@fluendo.com>
+
+       * gst.supp:
+         Delete a bogus suppression for the registry code.
+         Generalise a suppression for a glib bug (see #337404)
+
+2006-04-04  Michael Smith <msmith@fluendo.com>
+
+       * gst.supp:
+         Add a leak suppression: the existing glibc-doesn't-free-TLS one
+         wasn't triggering here.
+
+2006-04-04  Michael Smith <msmith@fluendo.com>
+
+       * gst.supp:
+         Add some minimally-neccesary suppressions for my x86/dapper system.
+
+2006-04-01  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * plugins.xsl:
+         Do not display an origin link if origin does not start with http
+         See #323798
+
+2006-04-01  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-args.m4:
+       * m4/gst-feature.m4:
+         add more macros
+       * m4/gst-x11.m4:
+         X11-related checks
+
+2006-04-01  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/as-version.m4:
+         newer version
+       * m4/gst-args.m4:
+       * m4/gst-doc.m4:
+         update and add other macros to be shared across projects
+
+2006-03-24  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst.supp:
+         add a suppression for g_parse_debug_string
+
+2006-03-23  Stefan Kost  <ensonic@users.sf.net>
+
+       * gstdoc-scangobj:
+         sync fully with gtkdoc-0.15
+
+2006-03-23  Stefan Kost  <ensonic@users.sf.net>
+
+       * gstdoc-scangobj:
+       * gtk-doc.mak:
+         sync a little with gtk-doc mainline
+
+2006-03-17  Wim Taymans  <wim@fluendo.com>
+
+       * gst.supp:
+         add another clone suppression
+         change all glibc suppressions to match 2.3.*
+
+2006-03-09  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/check.m4:
+         fix test so it actually works when the normal check is used
+         over debian's/ubuntu's
+
+2006-03-08  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * check.mak:
+       Set G_SLICE=always-malloc when valgrinding tests
+       (closes #333272)
+
+2006-02-21  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * m4/gst-glib2.m4:
+       Fix debug output when the GLib version prerequisite is not found
+
+2006-02-13  Andy Wingo  <wingo@pobox.com>
+
+       * m4/check.m4: Hack around Debian/Ubuntu's broken installation of
+       the PIC version of check as libcheck_pic.a. Should work with
+       cross-compilation too. Grr.
+
+2006-02-06  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-default.m4:
+         switch to auto* sinks for defaults
+
+2006-02-02  Wim Taymans  <wim@fluendo.com>
+
+       * check.mak:
+         add a .valgrind.gen-suppressions target to aid in generating
+         suppressions
+       * gst.supp:
+         add more repressions from my debian glibc as of today
+
+2006-02-02  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gtk-doc-plugins.mak:
+         only add srcdir/gst if it exists
+
+2006-01-30  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * release.mak:
+         don't complain about disted enums in win32
+
+2006-01-20  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-check.m4:
+         AC_SUBST CFLAGS and LIBS
+         do a non-command because something is stripping out our AC_SUBST
+
+2006-01-20  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-args.m4:
+       * m4/gst-valgrind.m4:
+         properly give a "no" result manually when providing a
+         not-found action to fix configure output
+
+2006-01-20  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/pkg.m4:
+         update with a more recent version
+
+2006-01-07  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gettext.patch:
+         make Makefile depend on LINGUAS, so rebuilds work when adding
+         a language
+
+2006-01-03  Michael Smith  <msmith@fluendo.com>
+
+       * check.mak:
+         Clarify error message from valgrind test runs.
+
+2005-12-16  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-arch.m4:
+         define HOST_CPU
+
+2005-11-29  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check.mak:
+         add a valgrind-forever target for tests
+
+2005-11-28  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check.mak:
+         when a "make test.check" run fails, make it rerun the test with       
+         at least debug level 2
+
+2005-11-14  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/Makefile.am:
+       * m4/gst-check.m4:
+         fix check for base plugins
+       * m4/gst-default.m4:
+         add m4 to set default elements
+
+2005-10-18  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-check.m4:
+         check for tools correctly
+
+2005-10-18  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gtk-doc.mak:
+         only enable breaking on new API when make distcheck passes,
+         not before
+
+2005-10-18  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-check.m4:
+         Resurrect Julien's dead body and wipe his mind clean
+
+2005-10-18  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-check.m4:
+         Kill Julien
+
+2005-10-17  Julien MOUTTE  <julien@moutte.net>
+
+       * m4/gst-check.m4: I know Thomas will kill me but this 
+       ifelse statement seems incorrect as it is always setting
+       required to "yes". With this one it seems to work. Fixes
+       build of gst-plugins-base on my setup where gstreamer-check
+       is definitely not present/required.
+
+2005-10-18  Stefan Kost  <ensonic@users.sf.net>
+
+       * gtk-doc.mak:
+         make build break on new api that has not been added to the
+         sections file
+
+2005-10-17  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-glib2.m4:
+       * m4/Makefile.am:
+       * m4/gst-check.m4:
+         add macro for easy checks for GStreamer libs
+
+2005-10-16  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-glib2.m4:
+         update, warn in error cases
+
+2005-10-16  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-error.m4:
+         add GST_SET_DEFAULT_LEVEL
+
+2005-10-16  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/Makefile.am:
+       * m4/gst-gettext.m4:
+         remove the AM_GNU_GETTEXT* calls, they need to be in configure.ac
+       * m4/gst-glib2.m4:
+         clean up and re-use in core soon
+       * m4/gst-plugindir.m4:
+         macro to set up PLUGINDIR and plugindir define/var
+
+2005-10-15  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/Makefile.am:
+       * m4/gst-gettext.m4:
+         add macro for setting up gettext
+
+2005-10-15  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-args.m4:
+         add some .m4's for argument checking that can be shared among modules
+
+2005-10-15  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/as-libtool.m4:
+         set _LT_LDFLAGS
+       * m4/gst-libxml2.m4:
+         document
+
+2005-10-15  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-arch.m4:
+         indent a little
+         add AC_REQUIRE
+       * m4/gst-error.m4:
+         clean up
+
+2005-10-12  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst-autogen.sh:
+         update version detection expression to catch stuff like
+         Libtool (libtool15) 1.5.0
+
+2005-10-11  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst.supp:
+         commit 6 new suppressions related to g_module_open; can these
+         really not be folded into one ?
+
+2005-10-11  Edward Hervey  <edward@fluendo.com>
+
+       * gst.supp: 
+       made the <g_type_init calloc 2> suppression more generic
+       Added pthread memleak suppresions
+       Added nss_parse_* memleak suppresion (used by g_option_context_parse)
+
+2005-10-11  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check.mak:
+         be more strict, more leak resolution
+       * gst.supp:
+         clean up the g_type_init suppressions
+
+2005-10-07  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/Makefile.am:
+       * m4/gst-valgrind.m4:
+         put the valgrind detection in an .m4
+
+2005-09-29  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check.mak:
+         add some more targets, like "help", but also more intensive tests
+
+2005-09-23  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gtk-doc.mak:
+         make certain doc warnings fatal so people maintain docs again
+
+2005-09-23  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * Makefile.am:
+       * gtk-doc-plugins.mak:
+       * scangobj-merge.py:
+         merge additions from the .signals.new and .args.new file in
+         the original ones, only updating if necessary
+
+2005-09-23  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst-xmlinspect.py:
+       * gstdoc-scangobj:
+       * gtk-doc-plugins.mak:
+         fix properly for new API; make update in plugins dir now works
+
+2005-09-20  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst-xmlinspect.py:
+       * gstdoc-scangobj:
+         some fixes for new API
+       * gtk-doc-plugins.mak:
+         set environment properly
+
+2005-09-17  David Schleef  <ds@schleef.org>
+
+       * gtk-doc-plugins.mak: Use new environment variables.
+
+2005-09-16  Michael Smith <msmith@fluendo.com>
+
+       * gstdoc-scangobj:
+         Make the scanobj code reflect registry/plugin API changes
+
+2005-09-15  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gtk-doc-plugins.mak:
+         split out scanobj step (which will be run by doc maintainer)
+         from scan step (which will be run on every build)
+         clean up some of the commands for make distcheck
+
+2005-09-15  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gtk-doc-plugins.mak:
+       * mangle-tmpl.py:
+         first stab at reorganizing the plugins build so we can maintain
+         element docs
+
+2005-09-14  David Schleef  <ds@schleef.org>
+
+       * as-libtool.mak: Remove
+       * m4/as-libtool.m4: The libtool bug that this worked around has
+         been fixed.
+       * m4/as-version.m4: Don't define GST_RELEASE, since it causes
+         config.h to be regenerated needlessly, and we don't use it.
+
+2005-09-14  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gtk-doc-plugins.mak:
+         error out on inspect failure
+
+2005-09-14  Michael Smith <msmith@fluendo.com>
+
+       * glib-gen.mak:
+         Don't call glib-mkenums with arguments that confuse/break MinGW,
+         fixes 316155.
+
+2005-09-03  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gtk-doc-plugins.mak:
+       * gtk-doc.mak:
+       * m4/gst-doc.m4:
+         separate out gtk-doc and docbook stuff
+         have two separate --enable configure flags
+
+2005-08-26  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check.mak:
+         add a .gdb target; rebuild registry for each target, otherwise
+         a code rebuild always triggers a reg rebuild, and it's just too
+         annoying
+       * gstdoc-scangobj:
+
+2005-08-21  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check.mak:
+         separate out REGISTRY_ENVIRONMENT; we want to use that from
+         our valgrind runs, but we also want TESTS_ENVIRONMENT to contain
+         everything that the first test, gst-register, needs
+
+2005-08-21  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check.mak:
+         parse output of valgrind and check for definitely lost, and error
+         out; somehow I was led to believe valgrind returns non-zero for
+         leaks, but I can't make it do that, so let's parse
+
+2005-08-20  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * check.mak:
+         for some weird reason valgrind does not report actual memleaks
+         if GST_PLUGIN_PATH is set to anything but the core gstreamer dir
+         while valgrind is running.  Since the registry is going to go
+         anyway, I don't want to waste any more time on this; I just run
+         valgrind without GST_PLUGIN_PATH set.  Since the registry loading
+         doesn't check if GST_PLUGIN_PATH got changed as a reason to rebuild
+         the registry, that's actually fine.
+
+2005-08-15  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * mangle-tmpl.py:
+         keep original Long_Description; only insert an include if it's
+         not already the first line in there
+       * plugins.xsl:
+         output more information for plugins, including an origin hyperlink
+
+2005-08-15  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst-xmlinspect.py:
+         a first stab at inspecting plugins and outputting an xml description
+       * gtk-doc-plugins.mak:
+         a gtk-doc using snippet for plugins documentation
+       * plugins.xsl:
+         a stylesheet to convert gst-xmlinspect.py output to docbook output
+         for inclusion in the gtk-doc stuff
+
+2005-07-20  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
+       * m4/gst-doc.m4:
+         s/pdf/eps/ in test for whether we output EPS images (#309379).
+
+2005-07-18  Andy Wingo  <wingo@pobox.com>
+
+       * m4/as-libtool-tags.m4: Ooh, backported from libtool 1.6. Much
+       better. Thanks, Paolo Bonzini!
+       
+       * m4/Makefile.am (EXTRA_DIST): 
+       * m4/as-libtool-tags.m4: New file, tries to disable some CXX and
+       fortran checks.
+
+2005-07-08  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-error.m4:
+         add macro to set ERROR_CFLAGS
+
+2005-06-30  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * gst-autogen.sh:
+         Remove the old autoregen.sh if it exists before recreating it,
+         to prevent confusing any shell process that might be reading it
+         currently.
+
+2005-06-29  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gtk-doc.m4:
+         added
+
+2005-06-03  Stefan Kost  <ensonic@users.sf.net>
+
+       * gst-autogen.sh: create autoregen.sh *before* shifting the options
+
+2005-05-17  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst-autogen.sh: only update autoregen.sh on actual runs
+
+2005-03-11  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/check.m4: m4 from the check unit test suite
+
+2004-12-14  David Schleef  <ds@schleef.org>
+
+       * m4/gst-arch.m4: remove MMX stuff, since it doesn't work and
+       isn't needed anywhere
+
+2004-12-08  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst-autogen.sh:
+         allow failure command to be run so we can clean upfrom autopoint
+
+2004-09-03  Zeeshan Ali Khattak <zeenix@gmail.com>
+       * m4/gst-feature.m4: Trying to correct the GST_CHECK_CONFIGPROG macro
+
+2004-07-21  Benjamin Otte  <otte@gnome.org>
+
+       * m4/.cvsignore: exciting updates for libtool m4 files
+
+2004-07-12  David Schleef  <ds@schleef.org>
+
+       * m4/as-objc.m4:  Add a macro to test for objective C
+
+2004-06-12  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-feature.m4:
+         not all of them support --plugin-libs, so redirect stderr
+
+2004-06-12  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/as-scrub-include.m4:
+         sync with upstream to 0.1.4.  Fixes #132440
+
+2004-06-07  Benjamin Otte  <otte@gnome.org>
+
+       * m4/gst-feature.m4:
+         write a big marker into configure output when checking next plugin
+         to allow easier parsing of why plugins are(n't) built.
+
+2004-06-01  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/as-compiler-flag.m4:
+       * m4/as-compiler.m4:
+       * m4/as-libtool.m4:
+       * m4/as-version.m4:
+         sync with upstream, change sticky options to -ko
+
+2004-05-24  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/as-scrub-include.m4: synced with upstream
+
+2004-05-03  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * po.mak:
+          snippet for updating .po files
+
+2004-03-18  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * Makefile.am:
+       * m4/Makefile.am:
+          integrate these with the dist
+
+2004-03-17  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * release.mak: add a release target
+
+2004-03-09  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       patch by: Stephane Loeuillet
+
+       * m4/ax_create_stdint_h.m4:
+          use head -n instead of head - (#136500)
+
+2004-03-05  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-doc.m4: don't build PS without dvips binary
+
+2004-02-22   Julio M. Merino Vidal <jmmv@menta.net>
+
+       reviewed by: Benjamin Otte  <otte@gnome.org>
+
+       * m4/as-docbook.m4:
+         don't use == operator with test(1) (fixes #135115)
+
+2004-02-16  Thomas Vander Stichele  <thomas at apestaart dot org>
+       * common/m4/gst-arch.m4: x86_64 is x86 too (clue from Fedora 2 test)
+
+2004-02-13  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-feature.m4:
+          remove AM_CONDITIONAL for the subsystem since automake 1.6.x
+          requires that call be in configure.ac
+
+2004-02-13  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-libxml2.m4:
+          take required version as argument, and default to 2.4.9 if not
+          specified
+
+2004-02-12  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/gst-feature.m4:
+          rename and fix up GST_CHECK_DISABLE_SUBSYSTEM
+
+2004-02-11  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * common/m4/as-ac-expand.m4:
+       * common/m4/as-auto-alt.m4:
+       * common/m4/as-compiler-flag.m4:
+       * common/m4/as-compiler.m4:
+       * common/m4/as-docbook.m4:
+       * common/m4/as-libtool.m4:
+       * common/m4/as-scrub-include.m4:
+       * common/m4/as-version.m4:
+       * common/m4/glib-gettext.m4:
+       * common/m4/gst-arch.m4:
+       * common/m4/gst-debuginfo.m4:
+       * common/m4/gst-doc.m4:
+       * common/m4/gst-feature.m4:
+       * common/m4/gst-function.m4:
+       * common/m4/gst-glib2.m4:
+       * common/m4/gst-gstreamer.m4:
+       * common/m4/gst-libxml2.m4:
+       * common/m4/gst-makecontext.m4:
+       * common/m4/gst-mcsc.m4:
+       * common/m4/pkg.m4:
+          fix underquoted macros as reported by automake 1.8.x (#133800)
+
+2004-02-11  Johan Dahlin  <johan@gnome.org>
+
+       * gst-autogen.sh: Use A-Z instead of A-z in sed expression to
+       avoid a warning
+
+2004-02-05  Thomas Vander Stichele  <thomas (at) apestaart (dot) org>
+
+       * m4/gst-doc.m4:
+          we use --output-format=xml and --ingnore-files options to
+          gtkdoc-mkdb, which got added between 0.9 and 1.0
+
+2004-02-04  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * m4/as-libtool.m4: remove AM_PROG_LIBTOOL so it can move back
+          to configure.ac to shut up libtoolize
+
+2004-02-03  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+        * glib-gen.mak: added; used to generate enums and marshal code
+
+2004-01-13  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+        * gettext.patch: added; used by autogen.sh to make sure
+          GETTEXT_PACKAGE is understood from po/Makefile.in.in -> po/Makefile.in
+
diff --git a/common/Makefile.am b/common/Makefile.am
new file mode 100644 (file)
index 0000000..cac4ff5
--- /dev/null
@@ -0,0 +1,16 @@
+SUBDIRS = m4
+
+EXTRA_DIST = \
+       ChangeLog \
+       gettext.patch \
+       glib-gen.mak gtk-doc.mak upload.mak release.mak win32.mak \
+       gst-autogen.sh \
+       check-exports \
+       c-to-xml.py gst-xmlinspect.py mangle-tmpl.py scangobj-merge.py \
+       gtk-doc-plugins.mak \
+       plugins.xsl gstdoc-scangobj \
+       gst.supp check.mak \
+       coverage/lcov.mak \
+       coverage/coverage-report.pl \
+       coverage/coverage-report.xsl \
+       coverage/coverage-report-entry.pl
diff --git a/common/c-to-xml.py b/common/c-to-xml.py
new file mode 100755 (executable)
index 0000000..8448fd2
--- /dev/null
@@ -0,0 +1,34 @@
+# -*- Mode: Python -*-
+# vi:si:et:sw=4:sts=4:ts=4
+
+"""
+Convert a C program to valid XML to be included in docbook
+"""
+
+import sys
+import os
+from xml.sax import saxutils
+
+def main():
+    if len(sys.argv) == 1:
+        sys.stderr.write("Please specify a source file to convert")
+        sys.exit(1)
+    source = sys.argv[1]
+
+    if not os.path.exists(source):
+        sys.stderr.write("%s does not exist.\n" % source)
+        sys.exit(1)
+
+    content = open(source, "r").read()
+
+    # print header
+    print '<?xml version="1.0"?>'
+    print '<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">'
+    print
+    print '<programlisting>'
+
+    # print content
+    print saxutils.escape(content).encode('UTF-8')
+    print '</programlisting>'
+        
+main()
diff --git a/common/check-exports b/common/check-exports
new file mode 100755 (executable)
index 0000000..16df41f
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+# check-exports
+#
+# quick'n'dirty script that retrieves the list of exported symbols of a given
+# library using 'nm', and compares that against the list of symbols-to-export
+# of our win32/common/libfoo.def files.
+
+if [ $# -ne 2 ]; then
+       echo "Usage: $0 library.def library.so"
+       exit 1
+fi
+
+def_path="$1"
+def_name="$(basename $def_path)"
+lib_path="$2"
+
+lib_result="`mktemp /tmp/defname.XXXXXX`"
+
+LC_ALL=C
+export LC_ALL
+
+# On Solaris, add -p to get the correct output format
+NMARGS=
+if nm -V 2>&1 |grep Solaris > /dev/null; then
+  NMARGS=-p
+fi
+
+# FIXME 0.11: in 0.11, we should change the export filter to only export
+# _gst_foo, but not __gst_foo (we can't change this now, since we added
+# __gst_debug_min and __gst_debug_enabled at some point and need to keep
+# ABI compatibility).  So below we special-case some symbols that shouldn't
+# really be exported, either because we're too lazy to rename them to something
+# that's not exported (like the _gst_parse_* stuff) or because we had them in
+# public headers at some point although they shouldn't be and so we need to
+# keep them exported now (like _gst_debug_init, 
+# __gst_element_factory_add_interface or
+# __gst_element_factory_add_static_pad_template).  We suppress them here to
+# make sure they're at least not exported in the windows msvc build (they
+# were never in the .def file, so they never got exported).
+# _end is special cased because for some reason it is reported as an exported
+# BSS symbol, unlike on linux where it's a local absolute symbol.
+nm $NMARGS $lib_path | awk \
+       '{
+               if ($3 !~ /^_gst_parse_yy/ && \
+                   $3 !~ /^_gst_[a-z]*_init/ && \
+                   $3 !~ /^_gst_parse_launch/ && \
+                   $3 !~ /^__gst_element_details_/ && \
+                   $3 !~ /^__gst_element_factory_add_/ && \
+                   $3 !~ /^gst_interfaces_marshal/ && \
+                   $3 ~ /^[_]*(gst_|Gst|GST_).*/)
+               {
+                       if ($2 ~ /^[BSDG]$/)
+                               print "\t" $3 " DATA"
+                       else if ($2 == "T")
+                               print "\t" $3
+               }
+        }' | sort | awk '{ if (NR == 1) print "EXPORTS"; print $0; }' \
+       > $lib_result
+
+diffoutput=`diff -u $def_path $lib_result`
+
+rm $lib_result
+
+if test "x$diffoutput" = "x"; then
+  exit 0;
+else
+  echo -n "$diffoutput" >&2
+  echo >&2
+  exit 1;
+fi
+
diff --git a/common/check.mak b/common/check.mak
new file mode 100755 (executable)
index 0000000..d31569f
--- /dev/null
@@ -0,0 +1,149 @@
+clean-local-check:
+       for i in `find . -name ".libs" -type d`; do \
+         rm -rf $$i; \
+       done
+
+if HAVE_VALGRIND
+# hangs spectacularly on some machines, so let's not do this by default yet
+check-valgrind:
+       $(MAKE) valgrind
+else
+check-valgrind:
+       @true
+endif
+
+LOOPS = 10
+
+# run any given test by running make test.check
+# if the test fails, run it again at at least debug level 2
+%.check: %
+       @$(TESTS_ENVIRONMENT)                                   \
+       CK_DEFAULT_TIMEOUT=20                                   \
+       $* ||                                                   \
+       $(TESTS_ENVIRONMENT)                                    \
+       GST_DEBUG=$$GST_DEBUG,*:2                               \
+       CK_DEFAULT_TIMEOUT=20                                   \
+       $*
+
+# run any given test in a loop
+%.torture: %
+       @for i in `seq 1 $(LOOPS)`; do                          \
+       $(TESTS_ENVIRONMENT)                                    \
+       CK_DEFAULT_TIMEOUT=20                                   \
+       $*; done
+
+# run any given test in an infinite loop
+%.forever: %
+       @while true; do                                         \
+       $(TESTS_ENVIRONMENT)                                    \
+       CK_DEFAULT_TIMEOUT=20                                   \
+       $* || break; done
+
+# valgrind any given test by running make test.valgrind
+%.valgrind: %
+       $(TESTS_ENVIRONMENT)                                    \
+       CK_DEFAULT_TIMEOUT=360                                  \
+       G_SLICE=always-malloc                                   \
+       libtool --mode=execute                                  \
+       $(VALGRIND_PATH) -q                                     \
+       $(foreach s,$(SUPPRESSIONS),--suppressions=$(s))        \
+       --tool=memcheck --leak-check=full --trace-children=yes  \
+       --leak-resolution=high --num-callers=20                 \
+       ./$* 2>&1 | tee valgrind.log
+       @if grep "==" valgrind.log > /dev/null 2>&1; then       \
+           rm valgrind.log;                                    \
+           exit 1;                                             \
+       fi
+       @rm valgrind.log
+       
+# valgrind any given test and generate suppressions for it
+%.valgrind.gen-suppressions: %
+       $(TESTS_ENVIRONMENT)                                    \
+       CK_DEFAULT_TIMEOUT=360                                  \
+       G_SLICE=always-malloc                                   \
+       libtool --mode=execute                                  \
+       $(VALGRIND_PATH) -q                                     \
+       $(foreach s,$(SUPPRESSIONS),--suppressions=$(s))        \
+       --tool=memcheck --leak-check=full --trace-children=yes  \
+       --leak-resolution=high --num-callers=20                 \
+       --gen-suppressions=all                                  \
+       ./$* 2>&1 | tee suppressions.log
+       
+# valgrind any given test until failure by running make test.valgrind-forever
+%.valgrind-forever: %
+       @while $(MAKE) $*.valgrind; do                          \
+         true; done
+
+# gdb any given test by running make test.gdb
+%.gdb: %
+       $(TESTS_ENVIRONMENT)                                    \
+       CK_FORK=no                                              \
+       libtool --mode=execute                                  \
+       gdb $*
+
+# torture tests
+torture: $(TESTS)
+       -rm test-registry.xml
+       @echo "Torturing tests ..."
+       for i in `seq 1 $(LOOPS)`; do                           \
+               $(MAKE) check ||                                        \
+               (echo "Failure after $$i runs"; exit 1) ||      \
+               exit 1;                                         \
+       done
+       @banner="All $(LOOPS) loops passed";                    \
+       dashes=`echo "$$banner" | sed s/./=/g`;                 \
+       echo $$dashes; echo $$banner; echo $$dashes
+
+# forever tests
+forever: $(TESTS)
+       -rm test-registry.xml
+       @echo "Forever tests ..."
+       while true; do                                          \
+               $(MAKE) check ||                                        \
+               (echo "Failure"; exit 1) ||                     \
+               exit 1;                                         \
+       done
+
+# valgrind all tests
+valgrind: $(TESTS)
+       @echo "Valgrinding tests ..."
+       @failed=0;                                                      \
+       for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do   \
+               $(MAKE) $$t.valgrind;                                   \
+               if test "$$?" -ne 0; then                               \
+                        echo "Valgrind error for test $$t";            \
+                       failed=`expr $$failed + 1`;                     \
+                       whicht="$$whicht $$t";                          \
+                fi;                                                    \
+       done;                                                           \
+       if test "$$failed" -ne 0; then                                  \
+               echo "$$failed tests had leaks or errors under valgrind:";      \
+               echo "$$whicht";                                        \
+               false;                                                  \
+       fi
+
+# inspect every plugin feature
+GST_INSPECT = $(GST_TOOLS_DIR)/gst-inspect-$(GST_MAJORMINOR)
+inspect:
+       @echo "Inspecting features ..."
+       for e in `$(TESTS_ENVIRONMENT) $(GST_INSPECT) | head -n -2      \
+         | cut -d: -f2`;                                               \
+         do echo Inspecting $$e;                                       \
+            $(GST_INSPECT) $$e > /dev/null 2>&1; done
+
+help:
+       @echo "make check                         -- run all checks"
+       @echo "make torture                       -- run all checks $(LOOPS) times"
+       @echo "make (dir)/(test).check            -- run the given check once"
+       @echo "make (dir)/(test).forever          -- run the given check forever"
+       @echo "make (dir)/(test).torture          -- run the given check $(LOOPS) times"
+       @echo
+       @echo "make (dir)/(test).gdb              -- start up gdb for the given test"
+       @echo
+       @echo "make valgrind                      -- valgrind all tests"
+       @echo "make (dir)/(test).valgrind         -- valgrind the given test"
+       @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
+       @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
+       @echo "                                               and save to suppressions.log"
+       @echo "make inspect                       -- inspect all plugin features"
+
diff --git a/common/coverage/coverage-report-entry.pl b/common/coverage/coverage-report-entry.pl
new file mode 100755 (executable)
index 0000000..8f653af
--- /dev/null
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2006 Daniel Berrange
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+print <<EOF;
+<html>
+<head>
+<title>Coverage report for $ARGV[0]</title>
+<style type="text/css">
+          span.perfect {
+            background: rgb(0,255,0);
+          }
+          span.terrible {
+            background: rgb(255,0,0);
+          }
+</style>
+</head>
+<body>
+<h1>Coverage report for $ARGV[0]</h1>
+
+<pre>
+EOF
+
+
+while (<>) {
+    s/&/&amp;/g;
+    s/</&lt;/g;
+    s/>/&gt;/g;
+
+    if (/^\s*function (\S+) called (\d+) returned \d+% blocks executed \d+%/) {
+       my $class = $2 > 0 ? "perfect" : "terrible";
+       $_ = "<span class=\"$class\" id=\"" . $1 . "\">$_</span>";
+    } elsif (/^\s*branch\s+\d+\s+taken\s+(\d+)%\s+.*$/) {
+       my $class = $1 > 0 ? "perfect" : "terrible";
+       $_ = "<span class=\"$class\">$_</span>";
+    } elsif (/^\s*branch\s+\d+\s+never executed.*$/) {
+       my $class = "terrible";
+       $_ = "<span class=\"$class\">$_</span>";
+    } elsif (/^\s*call\s+\d+\s+never executed.*$/) {
+       my $class = "terrible";
+       $_ = "<span class=\"$class\">$_</span>";
+    } elsif (/^\s*call\s+\d+\s+returned\s+(\d+)%.*$/) {
+       my $class = $1 > 0 ? "perfect" : "terrible";
+       $_ = "<span class=\"$class\">$_</span>";
+    }
+    
+
+    print;
+}
+
+print <<EOF;
+</pre>
+</body>
+</html>
+EOF
diff --git a/common/coverage/coverage-report.pl b/common/coverage/coverage-report.pl
new file mode 100755 (executable)
index 0000000..046bc37
--- /dev/null
@@ -0,0 +1,125 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2006 Daniel Berrange
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+use warnings;
+use strict;
+
+my %coverage = ( functions => {}, files => {} );
+
+my %filemap;
+
+my $type;
+my $name;
+
+my @functions;
+
+while (<>) {
+    if (/^Function '(.*)'\s*$/) {
+       $type = "function";
+       $name = $1;
+       $coverage{$type}->{$name} = {};
+       push @functions, $name;
+    } elsif (/^File '(.*?)'\s*$/) {
+       $type = "file";
+       $name = $1;
+       $coverage{$type}->{$name} = {};
+       
+       foreach my $func (@functions) {
+           $coverage{"function"}->{$func}->{file} = $name;
+       }
+       @functions = ();
+    } elsif (/^Lines executed:(.*)%\s*of\s*(\d+)\s*$/) {
+       $coverage{$type}->{$name}->{lines} = $2;
+       $coverage{$type}->{$name}->{linesCoverage} = $1;
+    } elsif (/^Branches executed:(.*)%\s*of\s*(\d+)\s*$/) {
+       $coverage{$type}->{$name}->{branches} = $2;
+       $coverage{$type}->{$name}->{branchesCoverage} = $1;
+    } elsif (/^Taken at least once:(.*)%\s*of\s*(\d+)\s*$/) {
+       $coverage{$type}->{$name}->{conds} = $2;
+       $coverage{$type}->{$name}->{condsCoverage} = $1;
+    } elsif (/^Calls executed:(.*)%\s*of\s*(\d+)\s*$/) {
+       $coverage{$type}->{$name}->{calls} = $2;
+       $coverage{$type}->{$name}->{callsCoverage} = $1;
+    } elsif (/^No branches$/) {
+       $coverage{$type}->{$name}->{branches} = 0;
+       $coverage{$type}->{$name}->{branchesCoverage} = "100.00";
+       $coverage{$type}->{$name}->{conds} = 0;
+       $coverage{$type}->{$name}->{condsCoverage} = "100.00";
+    } elsif (/^No calls$/) {
+       $coverage{$type}->{$name}->{calls} = 0;
+       $coverage{$type}->{$name}->{callsCoverage} = "100.00";
+    } elsif (/^\s*(.*):creating '(.*)'\s*$/) {
+       $filemap{$1} = $2;
+    } elsif (/^\s*$/) {
+       # nada
+    } else {
+       warn "Shit [$_]\n";
+    }
+}
+
+my %summary;
+foreach my $type ("function", "file") {
+    $summary{$type} = {};
+    foreach my $m ("lines", "branches", "conds", "calls") {
+       my $totalGot = 0;
+       my $totalMiss = 0;
+       my $count = 0;
+       foreach my $func (keys %{$coverage{function}}) {
+           $count++;
+           my $got = $coverage{function}->{$func}->{$m};
+           $totalGot += $got;
+           my $miss = $got * $coverage{function}->{$func}->{$m ."Coverage"} / 100;
+           $totalMiss += $miss;
+       }
+       $summary{$type}->{$m} = sprintf("%d", $totalGot);
+       $summary{$type}->{$m . "Coverage"} = sprintf("%.2f", $totalMiss / $totalGot * 100);
+    }
+}
+
+
+
+print "<coverage>\n";
+
+foreach my $type ("function", "file") {
+    printf "<%ss>\n", $type;
+    foreach my $name (sort { $a cmp $b } keys %{$coverage{$type}}) {
+       my $rec = $coverage{$type}->{$name};
+       printf "  <entry name=\"%s\" details=\"%s\">\n", $name, ($type eq "file" ? $filemap{$name} : $filemap{$rec->{file}});
+       printf "    <lines count=\"%s\" coverage=\"%s\"/>\n", $rec->{lines}, $rec->{linesCoverage};
+       if (exists $rec->{branches}) {
+           printf "    <branches count=\"%s\" coverage=\"%s\"/>\n", $rec->{branches}, $rec->{branchesCoverage};
+       }
+       if (exists $rec->{conds}) {
+           printf "    <conditions count=\"%s\" coverage=\"%s\"/>\n", $rec->{conds}, $rec->{condsCoverage};
+       }
+       if (exists $rec->{calls}) {
+           printf "    <calls count=\"%s\" coverage=\"%s\"/>\n", $rec->{calls}, $rec->{callsCoverage};
+       }
+       print  "  </entry>\n";
+    }
+    
+    printf "  <summary>\n";
+    printf "    <lines count=\"%s\" coverage=\"%s\"/>\n", $summary{$type}->{lines}, $summary{$type}->{linesCoverage};
+    printf "    <branches count=\"%s\" coverage=\"%s\"/>\n", $summary{$type}->{branches}, $summary{$type}->{branchesCoverage};
+    printf "    <conditions count=\"%s\" coverage=\"%s\"/>\n", $summary{$type}->{conds}, $summary{$type}->{condsCoverage};
+    printf "    <calls count=\"%s\" coverage=\"%s\"/>\n", $summary{$type}->{calls}, $summary{$type}->{callsCoverage};
+    printf  "  </summary>\n";
+    printf "</%ss>\n", $type;
+}
+
+print "</coverage>\n";
diff --git a/common/coverage/coverage-report.xsl b/common/coverage/coverage-report.xsl
new file mode 100755 (executable)
index 0000000..b19ebb6
--- /dev/null
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<!--\r
+#\r
+# Copyright (C) 2006 Daniel Berrange\r
+#\r
+# This program is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU General Public License as published by\r
+# the Free Software Foundation; either version 2 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+# GNU General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU General Public License\r
+# along with this program; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+-->\r
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
+                version="1.0">\r
+\r
+  <xsl:output method="html"/>\r
+\r
+  <xsl:template match="coverage">\r
+    <html>\r
+      <head>\r
+        <title>Coverage report</title>\r
+        <style type="text/css">\r
+          tbody tr.odd td.label {\r
+            border-top: 1px solid rgb(128,128,128);\r
+            border-bottom: 1px solid rgb(128,128,128);\r
+          }\r
+          tbody tr.odd td.label {\r
+            background: rgb(200,200,200);\r
+          }\r
+          \r
+          thead, tfoot {\r
+            background: rgb(60,60,60);\r
+            color: white;\r
+            font-weight: bold;\r
+          }\r
+\r
+          tr td.perfect {\r
+            background: rgb(0,255,0);\r
+            color: black;\r
+          }\r
+          tr td.excellant {\r
+            background: rgb(140,255,140);\r
+            color: black;\r
+          }\r
+          tr td.good {\r
+            background: rgb(160,255,0);\r
+            color: black;\r
+          }\r
+          tr td.poor {\r
+            background: rgb(255,160,0);\r
+            color: black;\r
+          }\r
+          tr td.bad {\r
+            background: rgb(255,140,140);\r
+            color: black;\r
+          }\r
+          tr td.terrible {\r
+            background: rgb(255,0,0);\r
+            color: black;\r
+          }\r
+        </style>\r
+      </head>\r
+      <body>\r
+        <h1>Coverage report</h1>\r
+        <xsl:apply-templates/>\r
+      </body>\r
+    </html>\r
+  </xsl:template>\r
+\r
+  <xsl:template match="functions">\r
+    <h2>Function coverage</h2>\r
+    <xsl:call-template name="content">\r
+      <xsl:with-param name="type" select="'function'"/>\r
+    </xsl:call-template>\r
+  </xsl:template>\r
+  \r
+\r
+  <xsl:template match="files">\r
+    <h2>File coverage</h2>\r
+    <xsl:call-template name="content">\r
+      <xsl:with-param name="type" select="'file'"/>\r
+    </xsl:call-template>\r
+  </xsl:template>\r
+\r
+  <xsl:template name="content">\r
+    <xsl:param name="type"/>\r
+    <table>\r
+      <thead>\r
+        <tr>\r
+          <th>Name</th>\r
+          <th>Lines</th>\r
+          <th>Branches</th>\r
+          <th>Conditions</th>\r
+          <th>Calls</th>\r
+        </tr>\r
+      </thead>\r
+      <tbody>\r
+        <xsl:for-each select="entry">\r
+          <xsl:call-template name="entry">\r
+            <xsl:with-param name="type" select="$type"/>\r
+            <xsl:with-param name="class">\r
+              <xsl:choose>\r
+                <xsl:when test="position() mod 2">\r
+                  <xsl:text>odd</xsl:text>\r
+                </xsl:when>\r
+                <xsl:otherwise>\r
+                  <xsl:text>even</xsl:text>\r
+                </xsl:otherwise>\r
+              </xsl:choose>\r
+            </xsl:with-param>\r
+          </xsl:call-template>\r
+        </xsl:for-each>\r
+      </tbody>\r
+      <tfoot>\r
+        <xsl:for-each select="summary">\r
+          <xsl:call-template name="entry">\r
+            <xsl:with-param name="type" select="'summary'"/>\r
+            <xsl:with-param name="class">\r
+              <xsl:choose>\r
+                <xsl:when test="position() mod 2">\r
+                  <xsl:text>odd</xsl:text>\r
+                </xsl:when>\r
+                <xsl:otherwise>\r
+                  <xsl:text>even</xsl:text>\r
+                </xsl:otherwise>\r
+              </xsl:choose>\r
+            </xsl:with-param>\r
+          </xsl:call-template>\r
+        </xsl:for-each>\r
+      </tfoot>\r
+    </table>\r
+  </xsl:template>\r
+  \r
+  <xsl:template name="entry">\r
+    <xsl:param name="type"/>\r
+    <xsl:param name="class"/>\r
+    <tr class="{$class}">\r
+      <xsl:choose>\r
+        <xsl:when test="$type = 'function'">\r
+          <td class="label"><a href="{@details}.html#{@name}"><xsl:value-of select="@name"/></a></td>\r
+        </xsl:when>\r
+        <xsl:when test="$type = 'file'">\r
+          <td class="label"><a href="{@details}.html"><xsl:value-of select="@name"/></a></td>\r
+        </xsl:when>\r
+        <xsl:otherwise>\r
+          <td class="label">Summary</td>\r
+        </xsl:otherwise>\r
+      </xsl:choose>\r
+\r
+      <xsl:if test="count(lines)">\r
+        <xsl:apply-templates select="lines"/>\r
+      </xsl:if>\r
+      <xsl:if test="not(count(lines))">\r
+        <xsl:call-template name="missing"/>\r
+      </xsl:if>\r
+\r
+      <xsl:if test="count(branches)">\r
+        <xsl:apply-templates select="branches"/>\r
+      </xsl:if>\r
+      <xsl:if test="not(count(branches))">\r
+        <xsl:call-template name="missing"/>\r
+      </xsl:if>\r
+\r
+      <xsl:if test="count(conditions)">\r
+        <xsl:apply-templates select="conditions"/>\r
+      </xsl:if>\r
+      <xsl:if test="not(count(conditions))">\r
+        <xsl:call-template name="missing"/>\r
+      </xsl:if>\r
+\r
+      <xsl:if test="count(calls)">\r
+        <xsl:apply-templates select="calls"/>\r
+      </xsl:if>\r
+      <xsl:if test="not(count(calls))">\r
+        <xsl:call-template name="missing"/>\r
+      </xsl:if>\r
+\r
+    </tr>\r
+  </xsl:template>\r
+  \r
+  <xsl:template match="lines">\r
+    <xsl:call-template name="row"/>\r
+  </xsl:template>\r
+\r
+  <xsl:template match="branches">\r
+    <xsl:call-template name="row"/>\r
+  </xsl:template>\r
+\r
+  <xsl:template match="conditions">\r
+    <xsl:call-template name="row"/>\r
+  </xsl:template>\r
+\r
+  <xsl:template match="calls">\r
+    <xsl:call-template name="row"/>\r
+  </xsl:template>\r
+\r
+  <xsl:template name="missing">\r
+    <td></td>\r
+  </xsl:template>\r
+\r
+  <xsl:template name="row">\r
+    <xsl:variable name="quality">\r
+      <xsl:choose>\r
+        <xsl:when test="@coverage = 100">\r
+          <xsl:text>perfect</xsl:text>\r
+        </xsl:when>\r
+        <xsl:when test="@coverage >= 80.0">\r
+          <xsl:text>excellant</xsl:text>\r
+        </xsl:when>\r
+        <xsl:when test="@coverage >= 60.0">\r
+          <xsl:text>good</xsl:text>\r
+        </xsl:when>\r
+        <xsl:when test="@coverage >= 40.0">\r
+          <xsl:text>poor</xsl:text>\r
+        </xsl:when>\r
+        <xsl:when test="@coverage >= 20.0">\r
+          <xsl:text>bad</xsl:text>\r
+        </xsl:when>\r
+        <xsl:otherwise>\r
+          <xsl:text>terrible</xsl:text>\r
+        </xsl:otherwise>\r
+      </xsl:choose>\r
+    </xsl:variable>\r
+    \r
+    <td class="{$quality}"><xsl:value-of select="@coverage"/>% of <xsl:value-of select="@count"/></td>\r
+  </xsl:template>\r
+\r
+</xsl:stylesheet>\r
diff --git a/common/coverage/lcov.mak b/common/coverage/lcov.mak
new file mode 100755 (executable)
index 0000000..0ca9456
--- /dev/null
@@ -0,0 +1,42 @@
+## .PHONY so it always rebuilds it
+.PHONY: lcov-reset lcov lcov-run lcov-report lcov-upload
+
+# run lcov from scratch, always
+lcov-reset:
+       $(MAKE) lcov-run
+       $(MAKE) lcov-report
+
+# run lcov from scratch if the dir is not there
+lcov:
+       $(MAKE) lcov-reset
+
+if GST_GCOV_ENABLED
+# reset run coverage tests
+lcov-run:
+       @-rm -rf lcov
+       lcov --directory . --zerocounters
+       -if test -d tests/check; then $(MAKE) -C tests/check inspect; fi
+       -$(MAKE) check
+
+# generate report based on current coverage data
+lcov-report:
+       mkdir lcov
+       lcov --compat-libtool --directory . --capture --output-file lcov/lcov.info
+       lcov -l lcov/lcov.info | grep -v "`cd $(top_srcdir) && pwd`" | cut -d: -f1 > lcov/remove
+       lcov -l lcov/lcov.info | grep "tests/check/" | cut -d: -f1 >> lcov/remove
+       lcov -r lcov/lcov.info `cat lcov/remove` > lcov/lcov.cleaned.info
+       rm lcov/remove
+       mv lcov/lcov.cleaned.info lcov/lcov.info
+       genhtml -t "$(PACKAGE_STRING)" -o lcov --num-spaces 2 lcov/lcov.info
+
+lcov-upload: lcov
+       rsync -rvz -e ssh --delete lcov/* gstreamer.freedesktop.org:/srv/gstreamer.freedesktop.org/www/data/coverage/lcov/$(PACKAGE)
+
+else
+lcov-run:
+       echo "Need to reconfigure with --enable-gcov"
+
+lcov-report:
+       echo "Need to reconfigure with --enable-gcov"
+endif
+
diff --git a/common/gettext.patch b/common/gettext.patch
new file mode 100755 (executable)
index 0000000..659718e
--- /dev/null
@@ -0,0 +1,23 @@
+--- po/Makefile.in.in.orig     2006-01-07 12:03:45.000000000 +0100
++++ po/Makefile.in.in  2006-01-07 12:04:23.000000000 +0100
+@@ -11,6 +11,9 @@
+ PACKAGE = @PACKAGE@
+ VERSION = @VERSION@
++# thomas: add GETTEXT_PACKAGE substitution as used in Makevars
++GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
++
+ SHELL = /bin/sh
+ @SET_MAKE@
+@@ -305,7 +308,9 @@
+ update-gmo: Makefile $(GMOFILES)
+       @:
+-Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
++# thomas: add LINGUAS as a dependency so that the Makefile gets rebuilt
++# properly when we add languages
++Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in LINGUAS
+       cd $(top_builddir) \
+         && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+              $(SHELL) ./config.status
diff --git a/common/glib-gen.mak b/common/glib-gen.mak
new file mode 100755 (executable)
index 0000000..f9027da
--- /dev/null
@@ -0,0 +1,44 @@
+# these are the variables your Makefile.am should set
+# the example is based on the colorbalance interface
+
+#glib_enum_headers=$(colorbalance_headers)
+#glib_enum_define=GST_COLOR_BALANCE
+#glib_enum_prefix=gst_color_balance
+
+enum_headers=$(foreach h,$(glib_enum_headers),\n\#include \"$(h)\")
+
+# these are all the rules generating the relevant files
+%-marshal.h: %-marshal.list
+       glib-genmarshal --header --prefix=$(glib_enum_prefix)_marshal $^ > $*-marshal.h.tmp
+       mv $*-marshal.h.tmp $*-marshal.h
+
+%-marshal.c: %-marshal.list
+       echo "#include \"$*-marshal.h\"" >> $*-marshal.c.tmp
+       glib-genmarshal --body --prefix=$(glib_enum_prefix)_marshal $^ >> $*-marshal.c.tmp
+       mv $*-marshal.c.tmp $*-marshal.c
+
+%-enumtypes.h: $(glib_enum_headers)
+       glib-mkenums \
+       --fhead "#ifndef __$(glib_enum_define)_ENUM_TYPES_H__\n#define __$(glib_enum_define)_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+       --fprod "\n/* enumerations from \"@filename@\" */\n" \
+       --vhead "GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n"         \
+       --ftail "G_END_DECLS\n\n#endif /* __$(glib_enum_define)_ENUM_TYPES_H__ */" \
+       $^ > $@
+
+%-enumtypes.c: $(glib_enum_headers)
+       @if test "x$(glib_enum_headers)" == "x"; then echo "ERROR: glib_enum_headers is empty, please fix Makefile"; exit 1; fi
+       glib-mkenums \
+       --fhead "#include \"$*-enumtypes.h\"\n$(enum_headers)" \
+       --fprod "\n/* enumerations from \"@filename@\" */" \
+       --vhead "GType\n@enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G@Type@Value values[] = {"     \
+       --vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+       --vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
+       $^ > $@
+
+# a hack rule to make sure .Plo files exist because they get include'd
+# from Makefile's
+.deps/%-marshal.Plo:
+       touch $@
+
+.deps/%-enumtypes.Plo:
+       touch $@
diff --git a/common/gst-autogen.sh b/common/gst-autogen.sh
new file mode 100755 (executable)
index 0000000..ae60f7e
--- /dev/null
@@ -0,0 +1,294 @@
+# a silly hack that generates autoregen.sh but it's handy
+# Remove the old autoregen.sh first to create a new file,
+# as the current one may be being read by the shell executing
+# this script.
+if [ -f "autoregen.sh" ]; then
+  rm autoregen.sh
+fi
+echo "#!/bin/sh" > autoregen.sh
+echo "./autogen.sh $@ \$@" >> autoregen.sh
+chmod +x autoregen.sh
+
+# helper functions for autogen.sh
+
+debug ()
+# print out a debug message if DEBUG is a defined variable
+{
+  if test ! -z "$DEBUG"
+  then
+    echo "DEBUG: $1"
+  fi
+}
+
+version_check ()
+# check the version of a package
+# first argument : package name (executable)
+# second argument : optional path where to look for it instead
+# third argument : source download url
+# rest of arguments : major, minor, micro version
+# all consecutive ones : suggestions for binaries to use
+# (if not specified in second argument)
+{
+  PACKAGE=$1
+  PKG_PATH=$2
+  URL=$3
+  MAJOR=$4
+  MINOR=$5
+  MICRO=$6
+
+  # for backwards compatibility, we let PKG_PATH=PACKAGE when PKG_PATH null
+  if test -z "$PKG_PATH"; then PKG_PATH=$PACKAGE; fi
+  debug "major $MAJOR minor $MINOR micro $MICRO"
+  VERSION=$MAJOR
+  if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi
+  if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi
+
+  debug "major $MAJOR minor $MINOR micro $MICRO"
+  
+  for SUGGESTION in $PKG_PATH; do 
+    COMMAND="$SUGGESTION"
+
+    # don't check if asked not to
+    test -z "$NOCHECK" && {
+      echo -n "  checking for $COMMAND >= $VERSION ... "
+    } || {
+      # we set a var with the same name as the package, but stripped of
+      # unwanted chars
+      VAR=`echo $PACKAGE | sed 's/-//g'`
+      debug "setting $VAR"
+      eval $VAR="$COMMAND"
+      return 0
+    }
+
+    debug "checking version with $COMMAND"
+    ($COMMAND --version) < /dev/null > /dev/null 2>&1 || 
+    {
+      echo "not found."
+      continue
+    }
+    # strip everything that's not a digit, then use cut to get the first field
+    pkg_version=`$COMMAND --version|head -n 1|sed 's/^.*)[^0-9]*//'|cut -d' ' -f1`
+    debug "pkg_version $pkg_version"
+    # remove any non-digit characters from the version numbers to permit numeric
+    # comparison
+    pkg_major=`echo $pkg_version | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
+    pkg_minor=`echo $pkg_version | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
+    pkg_micro=`echo $pkg_version | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
+    test -z "$pkg_major" && pkg_major=0
+    test -z "$pkg_minor" && pkg_minor=0
+    test -z "$pkg_micro" && pkg_micro=0
+    debug "found major $pkg_major minor $pkg_minor micro $pkg_micro"
+
+    #start checking the version
+    debug "version check"
+
+    # reset check
+    WRONG=
+
+    if [ ! "$pkg_major" -gt "$MAJOR" ]; then
+      debug "major: $pkg_major <= $MAJOR"
+      if [ "$pkg_major" -lt "$MAJOR" ]; then
+        debug "major: $pkg_major < $MAJOR"
+        WRONG=1
+      elif [ ! "$pkg_minor" -gt "$MINOR" ]; then
+        debug "minor: $pkg_minor <= $MINOR"
+        if [ "$pkg_minor" -lt "$MINOR" ]; then
+          debug "minor: $pkg_minor < $MINOR"
+          WRONG=1
+        elif [ "$pkg_micro" -lt "$MICRO" ]; then
+          debug "micro: $pkg_micro < $MICRO"
+         WRONG=1
+        fi
+      fi
+    fi
+
+    if test ! -z "$WRONG"; then
+      echo "found $pkg_version, not ok !"
+      continue
+    else
+      echo "found $pkg_version, ok."
+      # we set a var with the same name as the package, but stripped of
+      # unwanted chars
+      VAR=`echo $PACKAGE | sed 's/-//g'`
+      debug "setting $VAR"
+      eval $VAR="$COMMAND"
+      return 0
+    fi
+  done
+
+  echo "not found !"
+  echo "You must have $PACKAGE installed to compile $package."
+  echo "Download the appropriate package for your distribution,"
+  echo "or get the source tarball at $URL"
+  return 1;
+}
+
+aclocal_check ()
+{
+  # normally aclocal is part of automake
+  # so we expect it to be in the same place as automake
+  # so if a different automake is supplied, we need to adapt as well
+  # so how's about replacing automake with aclocal in the set var,
+  # and saving that in $aclocal ?
+  # note, this will fail if the actual automake isn't called automake*
+  # or if part of the path before it contains it
+  if [ -z "$automake" ]; then
+    echo "Error: no automake variable set !"
+    return 1
+  else
+    aclocal=`echo $automake | sed s/automake/aclocal/`
+    debug "aclocal: $aclocal"
+    if [ "$aclocal" != "aclocal" ];
+    then
+      CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-aclocal=$aclocal"
+    fi
+    if [ ! -x `which $aclocal` ]; then
+      echo "Error: cannot execute $aclocal !"
+      return 1
+    fi
+  fi
+}
+
+autoheader_check ()
+{
+  # same here - autoheader is part of autoconf
+  # use the same voodoo
+  if [ -z "$autoconf" ]; then
+    echo "Error: no autoconf variable set !"
+    return 1
+  else
+    autoheader=`echo $autoconf | sed s/autoconf/autoheader/`
+    debug "autoheader: $autoheader"
+    if [ "$autoheader" != "autoheader" ];
+    then
+      CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoheader=$autoheader"
+    fi
+    if [ ! -x `which $autoheader` ]; then
+      echo "Error: cannot execute $autoheader !"
+      return 1
+    fi
+  fi
+
+}
+autoconf_2_52d_check ()
+{
+  # autoconf 2.52d has a weird issue involving a yes:no error
+  # so don't allow it's use
+  test -z "$NOCHECK" && {
+    ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-Z\.\ ()]*//;s/ .*$//'`
+    if test "$ac_version" = "2.52d"; then
+      echo "autoconf 2.52d has an issue with our current build."
+      echo "We don't know who's to blame however.  So until we do, get a"
+      echo "regular version.  RPM's of a working version are on the gstreamer site."
+      exit 1
+    fi
+  }
+  return 0
+}
+
+die_check ()
+{
+  # call with $DIE
+  # if set to 1, we need to print something helpful then die
+  DIE=$1
+  if test "x$DIE" = "x1";
+  then
+    echo
+    echo "- Please get the right tools before proceeding."
+    echo "- Alternatively, if you're sure we're wrong, run with --nocheck."
+    exit 1
+  fi
+}
+
+autogen_options ()
+{
+  if test "x$1" = "x"; then
+    return 0
+  fi
+
+  while test "x$1" != "x" ; do
+    optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    case "$1" in
+      --noconfigure)
+          NOCONFIGURE=defined
+         AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
+          echo "+ configure run disabled"
+          shift
+          ;;
+      --nocheck)
+         AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
+          NOCHECK=defined
+          echo "+ autotools version check disabled"
+          shift
+          ;;
+      --debug)
+          DEBUG=defined
+         AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
+          echo "+ debug output enabled"
+          shift
+          ;;
+      -h|--help)
+          echo "autogen.sh (autogen options) -- (configure options)"
+          echo "autogen.sh help options: "
+          echo " --noconfigure            don't run the configure script"
+          echo " --nocheck                don't do version checks"
+          echo " --debug                  debug the autogen process"
+          echo
+          echo " --with-autoconf PATH     use autoconf in PATH"
+          echo " --with-automake PATH     use automake in PATH"
+          echo
+          echo "Any argument either not in the above list or after a '--' will be "
+          echo "passed to ./configure."
+         exit 1
+          ;;
+      --with-automake=*)
+          AUTOMAKE=$optarg
+          echo "+ using alternate automake in $optarg"
+         CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE"
+          shift
+          ;;
+      --with-autoconf=*)
+          AUTOCONF=$optarg
+          echo "+ using alternate autoconf in $optarg"
+         CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF"
+          shift
+          ;;
+      --) shift ; break ;;
+      *)
+          echo "+ passing argument $1 to configure"
+         CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1"
+          shift
+          ;;
+    esac
+  done
+
+  for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
+  if test ! -z "$CONFIGURE_EXT_OPT"
+  then
+    echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
+  fi
+}
+
+toplevel_check ()
+{
+  srcfile=$1
+  test -f $srcfile || {
+        echo "You must run this script in the top-level $package directory"
+        exit 1
+  }
+}
+
+
+tool_run ()
+{
+  tool=$1
+  options=$2
+  run_if_fail=$3
+  echo "+ running $tool $options..."
+  $tool $options || {
+    echo
+    echo $tool failed
+    eval $run_if_fail
+    exit 1
+  }
+}
diff --git a/common/gst-xmlinspect.py b/common/gst-xmlinspect.py
new file mode 100755 (executable)
index 0000000..0d7f696
--- /dev/null
@@ -0,0 +1,168 @@
+# -*- Mode: Python -*-
+# vi:si:et:sw=4:sts=4:ts=4
+
+"""
+examine all plugins and elements and output xml documentation for them
+used as part of the plugin documentation build
+"""
+
+import sys
+import os
+import pygst
+pygst.require('0.10')
+import gst
+
+INDENT_SIZE = 2
+
+# all templates
+
+PAD_TEMPLATE = """<caps>
+  <name>%(name)s</name>
+  <direction>%(direction)s</direction>
+  <presence>%(presence)s</presence>
+  <details>%(details)s</details>
+</caps>"""
+
+ELEMENT_TEMPLATE = """<element>
+  <name>%(name)s</name>
+  <longname>%(longname)s</longname>
+  <class>%(class)s</class>
+  <description>%(description)s</description>
+  <author>%(author)s</author>
+  <pads>
+%(pads)s
+  </pads>
+</element>"""
+
+PLUGIN_TEMPLATE = """<plugin>
+  <name>%(name)s</name>
+  <description>%(description)s</description>
+  <filename>%(filename)s</filename>
+  <basename>%(basename)s</basename>
+  <version>%(version)s</version>
+  <license>%(license)s</license>
+  <source>%(source)s</source>
+  <package>%(package)s</package>
+  <origin>%(origin)s</origin>
+  <elements>
+%(elements)s
+  </elements>
+</plugin>"""
+
+def xmlencode(line):
+    """
+    Replace &, <, and >
+    """
+    line = "&amp;".join(line.split("&"))
+    line = "&lt;".join(line.split("<"))
+    line = "&gt;".join(line.split(">"))
+    return line
+
+def get_offset(indent):
+    return " " * INDENT_SIZE * indent
+
+def output_pad_template(pt, indent=0):
+    print  "PAD TEMPLATE", pt.name_template
+    paddir = ("unknown","source","sink")
+    padpres = ("always","sometimes","request")
+    
+    d = {
+      'name':        xmlencode(pt.name_template),
+      'direction':   xmlencode(paddir[pt.direction]),
+      'presence':    xmlencode(padpres[pt.presence]),
+      'details':     xmlencode(pt.static_caps.string),
+    }
+    block = PAD_TEMPLATE % d
+
+    offset = get_offset(indent)
+    return offset + ("\n" + offset).join(block.split("\n"))
+    
+def output_element_factory(elf, indent=0):
+    print  "ELEMENT", elf.get_name()
+
+    padsoutput = []
+    padtemplates = elf.get_static_pad_templates()
+    for padtemplate in padtemplates:
+        padsoutput.append(output_pad_template(padtemplate, indent))
+
+    d = {
+        'name':        xmlencode(elf.get_name()),
+        'longname':    xmlencode(elf.get_longname()),
+        'class':       xmlencode(elf.get_klass()),
+        'description': xmlencode(elf.get_description()),
+        'author':      xmlencode(elf.get_author()),
+        'pads': "\n".join(padsoutput),
+    }
+    block = ELEMENT_TEMPLATE % d
+
+    offset = get_offset(indent)
+    return offset + ("\n" + offset).join(block.split("\n"))
+
+def output_plugin(plugin, indent=0):
+    print "PLUGIN", plugin.get_name()
+    version = plugin.get_version()
+    
+    elements = {}
+    gst.debug('getting features for plugin %s' % plugin.get_name())
+    registry = gst.registry_get_default()
+    features = registry.get_feature_list_by_plugin(plugin.get_name())
+    gst.debug('plugin %s has %d features' % (plugin.get_name(), len(features)))
+    for feature in features:
+        if isinstance(feature, gst.ElementFactory):
+            elements[feature.get_name()] = feature
+    #gst.debug("got features")
+        
+    elementsoutput = []
+    keys = elements.keys()
+    keys.sort()
+    for name in keys:
+        feature = elements[name]
+        elementsoutput.append(output_element_factory(feature, indent + 2))
+
+    filename = plugin.get_filename()
+    basename = filename
+    if basename:
+        basename = os.path.basename(basename)
+    d = {
+        'name':        xmlencode(plugin.get_name()),
+        'description': xmlencode(plugin.get_description()),
+        'filename':    filename,
+        'basename':    basename,
+        'version':     version,
+        'license':     xmlencode(plugin.get_license()),
+        'source':      xmlencode(plugin.get_source()),
+        'package':     xmlencode(plugin.get_package()),
+        'origin':      xmlencode(plugin.get_origin()),
+        'elements': "\n".join(elementsoutput),
+    }
+    block = PLUGIN_TEMPLATE % d
+    
+    offset = get_offset(indent)
+    return offset + ("\n" + offset).join(block.split("\n"))
+
+def main():
+    if len(sys.argv) == 1:
+        sys.stderr.write("Please specify a source module to inspect")
+        sys.exit(1)
+    source = sys.argv[1]
+
+    if len(sys.argv) > 2:
+        os.chdir(sys.argv[2])
+
+    registry = gst.registry_get_default()
+    all = registry.get_plugin_list()
+    for plugin in all:
+        gst.debug("inspecting plugin %s from source %s" % (
+            plugin.get_name(), plugin.get_source()))
+        # this skips gstcoreelements, with bin and pipeline
+        if plugin.get_filename() is None:
+            continue
+        if plugin.get_source() != source:
+            continue
+
+        filename = "plugin-%s.xml" % plugin.get_name()
+        handle = open(filename, "w")
+        handle.write(output_plugin(plugin))
+        handle.close()
+
+main()
diff --git a/common/gst.supp b/common/gst.supp
new file mode 100755 (executable)
index 0000000..9b2a3a2
--- /dev/null
@@ -0,0 +1,1988 @@
+### this file contains suppressions for valgrind when running
+### the gstreamer unit tests
+### it might be useful for wider use as well
+
+### syscall suppressions
+
+{
+   <clone on Wim's Debian>
+   Memcheck:Param
+   clone(parent_tidptr)
+   fun:clone
+   fun:clone
+}
+
+{
+   <clone on Wim's Debian>
+   Memcheck:Param
+   clone(child_tidptr)
+   fun:clone
+   fun:clone
+}
+
+{
+   <clone on Wim's Debian>
+   Memcheck:Param
+   clone(tlsinfo)
+   fun:clone
+   fun:clone
+}
+
+### glibc suppressions
+
+{
+   <conditional jump on wim's debian 2/2/06>
+   Memcheck:Cond
+   obj:/lib/ld-2.3.*.so
+   fun:dl_open_worker
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   fun:dlopen_doit
+   obj:/lib/ld-2.3.*.so
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+   fun:gst_plugin_load_file
+}
+
+# glibc does not deallocate thread-local storage
+
+{
+   <tls>
+   Memcheck:Leak
+   fun:calloc
+   fun:_dl_allocate_tls
+   fun:pthread_create@@*
+}
+
+# I get an extra stack entry on x86/dapper
+{
+   <tls>
+   Memcheck:Leak
+   fun:calloc
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_allocate_tls
+   fun:pthread_create@@*
+}
+
+
+{
+   <pthread strstr>
+   Memcheck:Cond
+   fun:strstr
+   fun:__pthread_initialize_minimal
+   obj:/lib/libpthread-*.so
+   obj:/lib/libpthread-*.so
+   fun:call_init
+   fun:_dl_init
+   obj:/lib/ld-*.so
+}
+
+# a thread-related free problem in glibc from Edgard
+{
+   __libc_freeres_rw_acess
+   Memcheck:Addr4
+   obj:*
+   obj:*
+   obj:*
+   obj:*
+   obj:*
+   fun:__libc_freeres
+}
+
+{
+   <a conditional jump on wim's debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+}
+
+# g_module_open-related problems
+{
+   <started showing up on fc4-quick>
+   Memcheck:Addr2
+   fun:memcpy
+   fun:_dl_map_object_deps
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:dlopen_doit
+   fun:_dl_catch_error
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+   fun:gst_plugin_load_file
+   fun:gst_registry_scan_path_level
+   fun:gst_registry_scan_path_level
+   fun:gst_registry_scan_path_level
+   fun:init_post
+   fun:g_option_context_parse
+   fun:gst_init_check
+   fun:gst_init
+   fun:gst_check_init
+   fun:main
+}
+
+{
+   <started showing up on fc4-quick>
+   Memcheck:Addr4
+   fun:memcpy
+   fun:_dl_map_object_deps
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:dlopen_doit
+   fun:_dl_catch_error
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+   fun:gst_plugin_load_file
+   fun:gst_registry_scan_path_level
+   fun:gst_registry_scan_path_level
+   fun:gst_registry_scan_path_level
+   fun:init_post
+   fun:g_option_context_parse
+   fun:gst_init_check
+   fun:gst_init
+   fun:gst_check_init
+   fun:main
+}
+
+{
+   <g_module_open on wim's debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   fun:do_sym
+   fun:_dl_sym
+   fun:dlsym_doit
+   obj:/lib/ld-2.3.*.so
+   fun:_dlerror_run
+   fun:dlsym
+   fun:g_module_symbol
+   fun:g_module_open
+   fun:gst_plugin_load_file
+}
+
+{
+   <g_module_open on wim's debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   fun:dl_open_worker
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   fun:dlopen_doit
+   obj:/lib/ld-2.3.*.so
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+   fun:gst_plugin_load_file
+}
+{
+   <g_module_open on wim's debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.3.*.so
+   fun:dl_open_worker
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   fun:dlopen_doit
+   obj:/lib/ld-2.3.*.so
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+   fun:gst_plugin_load_file
+   fun:gst_plugin_load_by_name
+   fun:gst_plugin_feature_load
+}
+
+{
+   <leak on wim's debian in g_module_open>
+   Memcheck:Leak
+   fun:malloc
+   obj:/lib/ld-2.3.*.so
+   fun:dl_open_worker
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   fun:dlopen_doit
+   obj:/lib/ld-2.3.*.so
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+   fun:gst_plugin_load_file
+   fun:gst_plugin_load_by_name
+}
+
+{
+   <invalid read on wim's debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   fun:dl_open_worker
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   fun:dlopen_doit
+   obj:/lib/ld-2.3.*.so
+}
+
+{
+   <invalid read on wim's debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   fun:dl_open_worker
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   fun:dlopen_doit
+   obj:/lib/ld-2.3.*.so
+   fun:_dlerror_run
+}
+
+{
+   <invalid read on wim's debian - 2006-02-02>
+   Memcheck:Addr4
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   fun:dl_open_worker
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   fun:dlopen_doit
+   obj:/lib/ld-2.3.*.so
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+}
+
+{
+   <invalid read on wim's debian - 2006-02-02>
+   Memcheck:Addr4
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   fun:dl_open_worker
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   fun:dlopen_doit
+   obj:/lib/ld-2.3.*.so
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+}
+
+{
+   <invalid read on wim's debian - 2006-02-02>
+   Memcheck:Addr4
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   fun:do_sym
+   fun:_dl_sym
+   fun:dlsym_doit
+   obj:/lib/ld-2.3.*.so
+   fun:_dlerror_run
+   fun:dlsym
+   fun:g_module_symbol
+   fun:g_module_open
+}
+
+{
+   <futex on Andy's 64-bit ubuntu>
+   Memcheck:Param
+   futex(uaddr2)
+   fun:pthread_once
+   obj:/lib/libc-2.3.*.so
+   obj:/lib/libc-2.3.*.so
+   fun:mbsnrtowcs
+   fun:vfprintf
+   fun:vsprintf
+   fun:sprintf
+   obj:/lib/libc-2.3.*.so
+   fun:tmpfile
+   fun:setup_pipe
+   fun:setup_messaging_with_key
+   fun:setup_messaging
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+   fun:g_module_open
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   fun:_dl_sym
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlsym
+   fun:g_module_symbol
+   fun:g_module_open
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+   fun:g_module_open
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+   fun:g_module_open
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+   fun:g_module_open
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/ld-2.7.so
+   fun:__libc_dlopen_mode
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/ld-2.7.so
+   fun:__libc_dlopen_mode
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/ld-2.7.so
+   fun:__libc_dlopen_mode
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   fun:iconv_open
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/ld-2.7.so
+   fun:__libc_dlopen_mode
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   obj:/lib/i686/cmov/libc-2.7.so
+   fun:iconv_open
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Cond
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+{
+   <suppression for glibc 2.7 on debian>
+   Memcheck:Addr4
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   obj:/lib/ld-2.7.so
+   obj:/lib/i686/cmov/libdl-2.7.so
+   fun:dlopen
+}
+
+# suppression for a glibc bug:
+# http://valgrind.org/docs/manual/faq.html#faq.exit_errors>
+{
+   <Workaround for a glibc bug> 
+   Memcheck:Free
+   fun:free
+   obj:*libc-*.so
+   fun:__libc_freeres
+   fun:*
+   fun:_Exit
+}
+
+# valgrind doesn't allow me to specify a suppression for Addr1, Addr2, Addr4
+# as Addr*, so 3 copies for that; and then 2 of each for that pesky memcpy
+{
+   <Invalid read of size 1, 2, 4 on thomas's FC4>
+   Memcheck:Addr1
+   fun:_dl_signal_error
+   fun:_dl_map_object_deps
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:dlopen_doit
+   fun:_dl_catch_error
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+}
+
+{
+   <Invalid read of size 1, 2, 4 on thomas's FC4>
+   Memcheck:Addr2
+   fun:_dl_signal_error
+   fun:_dl_map_object_deps
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:dlopen_doit
+   fun:_dl_catch_error
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+}
+{
+   <Invalid read of size 1, 2, 4 on thomas's FC4>
+   Memcheck:Addr4
+   fun:_dl_signal_error
+   fun:_dl_map_object_deps
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:dlopen_doit
+   fun:_dl_catch_error
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+}
+
+{
+   <Invalid read of size 1, 2, 4 on thomas's FC4>
+   Memcheck:Addr1
+   fun:memcpy
+   fun:_dl_signal_error
+   fun:_dl_map_object_deps
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:dlopen_doit
+   fun:_dl_catch_error
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+}
+
+{
+   <Invalid read of size 1, 2, 4 on thomas's FC4>
+   Memcheck:Addr2
+   fun:memcpy
+   fun:_dl_signal_error
+   fun:_dl_map_object_deps
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:dlopen_doit
+   fun:_dl_catch_error
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+}
+{
+   <Invalid read of size 1, 2, 4 on thomas's FC4>
+   Memcheck:Addr4
+   fun:memcpy
+   fun:_dl_signal_error
+   fun:_dl_map_object_deps
+   fun:dl_open_worker
+   fun:_dl_catch_error
+   fun:_dl_open
+   fun:dlopen_doit
+   fun:_dl_catch_error
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+   fun:g_module_open
+}
+
+{
+   <Addr8 on Andy's AMD64 ubuntu in dl_open>
+   Memcheck:Addr8
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/libc-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   obj:/lib/libdl-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+}
+
+{
+   <Conditional jump on Andy's AMD64 ubuntu>
+   Memcheck:Cond
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/libc-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   fun:_dl_open
+   obj:/lib/libdl-2.3.*.so
+   obj:/lib/ld-2.3.*.so
+   obj:/lib/libdl-2.3.*.so
+   fun:dlopen
+   fun:g_module_open
+   fun:gst_plugin_load_file
+   fun:gst_plugin_load_by_name
+   fun:gst_plugin_feature_load
+}
+
+{
+   <Mike's x86 dapper>
+   Memcheck:Addr4
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/i686/cmov/libc-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+   fun:dlopen
+}
+
+{
+   <Mike's x86 dapper>
+   Memcheck:Cond
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/i686/cmov/libc-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+   fun:dlopen
+}
+
+{
+   <Another dapper one>
+   Memcheck:Cond
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/i686/cmov/libc-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+   fun:dlopen
+}
+
+### glib suppressions
+{
+   <g_parse_debug_string>
+   Memcheck:Cond
+   fun:g_parse_debug_string
+   obj:/usr/lib*/libglib-2.0.so.*
+   fun:g_slice_alloc
+   fun:g_slice_alloc0
+}
+
+{
+   <g_type_init malloc>
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:g_strdup
+   fun:g_quark_from_string
+   obj:*
+   obj:*
+   fun:g_type_register_fundamental
+   obj:*
+   fun:g_type_init_with_debug_flags
+   fun:g_type_init
+   fun:init_pre
+}
+
+{
+   <g_type_init calloc>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   obj:*
+   obj:*
+   fun:g_type_register_fundamental
+}
+
+{
+   <g_type_init calloc 2>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   obj:*
+   obj:*
+   fun:g_type_init_with_debug_flags
+}
+
+{
+   <g_type_init calloc 3, GSlice version>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:g_slice_alloc
+   obj:*
+   obj:*
+   fun:g_type_init_with_debug_flags
+}
+
+#pthread memleaks
+
+{
+   Thread creation leak
+   Memcheck:Leak
+   fun:calloc
+   fun:allocate_dtv
+   fun:_dl_allocate*
+   fun:_dl_allocate*
+   fun:__pthread_initialize_minimal
+}
+
+{
+   Thread management leak
+   Memcheck:Leak
+   fun:calloc
+   fun:allocate_dtv
+   fun:_dl_allocate*
+   fun:_dl_allocate*
+   fun:__pthread_*
+}
+
+{
+   Thread management leak 2
+   Memcheck:Leak
+   fun:memalign
+   fun:_dl_allocate*
+   fun:_dl_allocate*
+   fun:__pthread_*
+}
+
+{
+   pthread_create Syscall param write(buf) points to uninitialised byte(s)
+   Memcheck:Param
+   write(buf)
+   fun:pthread_create@@GLIBC_2.2.5
+   fun:g_thread_create*
+
+}
+
+# nss_parse_* memleak (used by g_option_context_parse)
+{
+   nss_parse_* memleak
+   Memcheck:Leak
+   fun:malloc
+   fun:nss_parse_service_list
+   fun:__nss_database_lookup
+}
+
+# liboil suppressions
+{
+   <liboil cpu_fault_check_try>
+   Memcheck:Value8
+   obj:/usr/lib/liboil-0.3.so.0.1.0
+   obj:/usr/lib/liboil-0.3.so.0.1.0
+   obj:/usr/lib/liboil-0.3.so.0.1.0
+   fun:oil_cpu_fault_check_try
+   fun:oil_test_check_impl
+   fun:oil_class_optimize
+   fun:oil_optimize_all
+   fun:oil_init
+}
+
+{
+   <annoying read error inside dlopen stuff on Ubuntu Dapper x86_64>
+   Memcheck:Addr8
+   obj:/lib/ld-2.3.6.so
+}
+
+{
+   <Ubuntu Dapper x86_64>
+   Memcheck:Param
+   futex(uaddr2)
+   fun:pthread_once
+   obj:/lib/libc-2.3.6.so
+   obj:/lib/libc-2.3.6.so
+   fun:setlocale
+   fun:init_pre
+   fun:g_option_context_parse
+   fun:gst_init_check
+   fun:gst_init
+   fun:gst_check_init
+   fun:main
+}
+
+{
+   <Ubuntu Dapper x86_64 dlopen stuff again>
+   Memcheck:Cond
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+   obj:/lib/libdl-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/libdl-2.3.6.so
+   fun:dlopen
+   fun:g_module_open
+   fun:gst_plugin_load_file
+}
+# this exists in a bunch of different variations, hence the short tail/trace
+{
+   <dlopen invalid read of size 4 suppression on tpm's Ubuntu edgy/x86>
+   Memcheck:Addr4
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+}
+{
+   <and the same for 64bit systems>
+   Memcheck:Addr8
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+}
+
+# More edgy suppressions (Mike)
+{  
+   <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
+   Memcheck:Cond
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   fun:dlopen_doit
+   obj:/lib/ld-2.4.so
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+}
+
+{  
+   <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
+   Memcheck:Cond
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   fun:dlopen_doit
+   obj:/lib/ld-2.4.so
+   fun:_dlerror_run
+   fun:dlopen@@GLIBC_2.1
+}
+
+{  
+   <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
+   Memcheck:Cond
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   fun:do_sym
+   fun:_dl_sym
+}
+
+# This one's overly general, but there's zero other information in the stack
+# trace - just these five lines!
+{  
+   <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
+   Memcheck:Cond
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+   obj:/lib/ld-2.4.so
+}
+
+{
+   <tls leaks on Edgy/x86>
+   Memcheck:Leak
+   fun:calloc
+   obj:/lib/ld-2.4.so
+   fun:_dl_allocate_tls
+   fun:pthread_create@@GLIBC_2.1
+}
+
+# TLS leaks for feisty/x86
+{
+   <tls leaks on Feisty/x86>
+   Memcheck:Leak
+   fun:calloc
+   fun:allocate_dtv
+   fun:_dl_allocate_tls
+   fun:pthread_create@@GLIBC_2.1
+}
+
+{
+   <libcdio 0.76 leak>
+   Memcheck:Leak
+   fun:calloc
+   obj:/usr/lib/libcdio.so.6.0.1
+   fun:cdio_open_am_linux
+   obj:/usr/lib/libcdio.so.6.0.1
+   fun:cdio_open_am
+}
+
+{
+   <Addr8 on Jan's AMD64 ubuntu Feisty in dl_open>
+   Memcheck:Addr8
+   obj:/lib/ld-2.5.so
+}
+
+{
+   <First of many Alsa errors>
+   Memcheck:Cond
+   fun:snd_pcm_direct_shm_create_or_connect
+   fun:snd_pcm_dsnoop_open
+   fun:_snd_pcm_dsnoop_open
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_open_slave
+   fun:_snd_pcm_plug_open
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_open_slave
+   fun:_snd_pcm_asym_open
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+}
+
+{
+   <alsa error>
+   Memcheck:Cond
+   fun:snd_pcm_hw_param_set_near
+   fun:set_hwparams
+}
+
+{
+   <alsa error>
+   Memcheck:Cond
+   fun:_snd_pcm_hw_param_set_min
+   fun:snd_pcm_hw_param_set_min
+   fun:snd_pcm_hw_param_set_near
+   fun:set_hwparams
+}
+
+{
+   <alsa error>
+   Memcheck:Cond
+   fun:_snd_pcm_hw_param_set_min
+   fun:snd_pcm_hw_param_set_min
+   fun:snd_pcm_hw_param_set_near
+   fun:set_hwparams
+}
+
+{
+   <alsa error>
+   Memcheck:Cond
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_hw_param_set_near
+   fun:set_hwparams
+}
+{
+   <alsa error>
+   Memcheck:Cond
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_close
+   obj:/*lib/libasound.so.2.0.0
+}
+{
+   <alsa error>
+   Memcheck:Cond
+   fun:snd_pcm_direct_shm_create_or_connect
+   fun:snd_pcm_dmix_open
+   fun:_snd_pcm_dmix_open
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_open_slave
+   fun:_snd_pcm_softvol_open
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_open_slave
+   fun:_snd_pcm_plug_open
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_open_slave
+   fun:_snd_pcm_asym_open
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+}
+{
+   <alsa error>
+   Memcheck:Leak
+   fun:malloc
+   fun:strdup
+   fun:snd_dlobj_cache_add
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_open_slave
+   fun:snd_pcm_dsnoop_open
+   fun:_snd_pcm_dsnoop_open
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_open_slave
+   fun:_snd_pcm_plug_open
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_pcm_open_slave
+   fun:_snd_pcm_asym_open
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+}
+# Catch about 15 variations on inserting info into an ALSA
+# internal cache
+{
+   <alsa error>
+   Memcheck:Leak
+   fun:malloc
+   fun:snd_dlobj_cache_add
+   obj:/*lib/libasound.so.2.0.0
+}
+{
+   <this catches a bunch of very similar errors related to parsing the configs>
+   Memcheck:Leak
+   fun:malloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+}
+{
+   <alsa error>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+}
+{
+   <alsa error - same as above with 6 libasound>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+}
+{
+   <alsa error - same as above with 7 libasound>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+}
+{
+   <alsa error - same as above with 10 libasound>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+}
+{
+   <alsa error - same as above with 11 libasound>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+}
+{
+   <alsa error>
+   Memcheck:Leak
+   fun:malloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   fun:snd_config_hook_load_for_all_cards
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+   fun:snd_config_search_alias_hooks
+   fun:snd_config_search_definition
+}
+{
+   <alsa error - same as above, but using calloc>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   fun:snd_config_hook_load_for_all_cards
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+   fun:snd_config_search_alias_hooks
+   fun:snd_config_search_definition
+}
+{
+   <alsa error - same as above, but with only 9 libasounds>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+   fun:snd_config_search_alias_hooks
+   fun:snd_config_search_definition
+}
+{
+   <alsa error>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error - same as above, with 7 libasound repeats>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error - same as above, with 6 libasound repeats>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error - same as above, with 6 libasound repeats>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error - same as above, with 7 libasound repeats>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error - same as above, with 8 libasound repeats>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error - same as above, with 9 libasound repeats>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error - same as above, with 10 libasound repeats>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error - same as above, with 11 libasound repeats>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_update_r
+   fun:snd_config_update
+}
+{
+   <alsa error>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+   fun:snd_config_search_alias_hooks
+   fun:snd_config_search_definition
+   obj:/*lib/libasound.so.2.0.0
+}
+{
+   <alsa error>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+   fun:snd_config_search_alias_hooks
+   fun:snd_config_search_definition
+   obj:/*lib/libasound.so.2.0.0
+}
+{
+   <alsa error>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   fun:snd_config_hook_load_for_all_cards
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+   fun:snd_config_search_alias_hooks
+   fun:snd_config_search_definition
+   obj:/*lib/libasound.so.2.0.0
+}
+{
+   <alsa error - same as above, but with 8 libasound in the stack>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   fun:snd_config_hook_load_for_all_cards
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+   fun:snd_config_search_alias_hooks
+   fun:snd_config_search_definition
+   obj:/*lib/libasound.so.2.0.0
+}
+{
+   <alsa error - same as above, but with 7 libasound in the stack>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   fun:snd_config_hook_load_for_all_cards
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+   fun:snd_config_search_alias_hooks
+   fun:snd_config_search_definition
+   obj:/*lib/libasound.so.2.0.0
+}
+{
+   <alsa error - same as above, but with 6 libasound in the stack>
+   Memcheck:Leak
+   fun:calloc
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_hook_load
+   fun:snd_config_hook_load_for_all_cards
+   obj:/*lib/libasound.so.2.0.0
+   fun:snd_config_searcha_hooks
+   fun:snd_config_search_alias_hooks
+   fun:snd_config_search_definition
+   obj:/*lib/libasound.so.2.0.0
+}
+{
+   <nss lookup within ALSA>
+   Memcheck:Leak
+   fun:malloc
+   obj:/lib/libc*.so
+   fun:__nss_database_lookup
+   obj:*
+   obj:*
+   fun:getgrnam_r
+   fun:getgrnam
+   fun:snd_pcm_direct_parse_open_conf
+}
+
+{
+   <libxcb leak on Ubuntu Feisty>
+   Memcheck:Leak
+   fun:calloc
+   fun:_XCBInitDisplayLock
+   fun:XOpenDisplay
+}
+
+# GConf internal initialisations related to getting the default client.
+{
+   <Orbit something or other>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc_tcval
+   obj:/usr/lib/libORBit-2.so.*
+   fun:ORBit_demarshal_IOR
+   fun:ORBit_demarshal_object
+   fun:CORBA_ORB_string_to_object
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_get_current_lock_holder
+   fun:gconf_activate_server
+   obj:/usr/lib/libgconf-2.so.*
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_engine_get_default
+}
+{
+   <gconf internal leak>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc_tcval
+   obj:/usr/lib/libORBit-2.so.*
+   fun:PortableServer_POA_servant_to_reference
+   obj:/usr/lib/libgconf-2.so.*
+   obj:/usr/lib/libgconf-2.so.*
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_engine_get_default
+}
+{
+   <gconf internal leak>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc_tcval
+   obj:/usr/lib/libORBit-2.so.*
+   fun:ORBit_demarshal_IOR
+   fun:ORBit_demarshal_object
+   fun:CORBA_ORB_string_to_object
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_get_current_lock_holder
+   fun:gconf_activate_server
+   obj:/usr/lib/libgconf-2.so.*
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_engine_get_default
+}  
+{
+   <gconf internal initialisation>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc*
+   obj:/usr/lib/libORBit-2.so.*
+   fun:ORBit_demarshal_IOR
+   fun:ORBit_demarshal_object
+   fun:ORBit_demarshal_value
+   obj:/usr/lib/libORBit-2.so.*
+   fun:ORBit_small_invoke_stub
+   fun:ConfigServer_get_default_database
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_engine_get_default
+}
+{
+   <gconf internal init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc*
+   obj:/usr/lib/libORBit-2.so.*
+   fun:IOP_generate_profiles
+   fun:ORBit_marshal_object
+   fun:ORBit_marshal_value
+   obj:/usr/lib/libORBit-2.so.*
+   fun:ORBit_small_invoke_stub
+   fun:ConfigServer_add_client
+   obj:/usr/lib/libgconf-2.so.*
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_engine_get_default
+}
+{
+   <gconf internal init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc_by_tc
+   obj:/usr/lib/libORBit-2.so.*
+   fun:PortableServer_POA_servant_to_reference
+   obj:/usr/lib/libgconf-2.so.*
+   obj:/usr/lib/libgconf-2.so.*
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_engine_get_default
+}
+{
+   <gconf internal init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc_by_tc
+   obj:/usr/lib/libORBit-2.so.*
+   fun:ORBit_demarshal_IOR
+   fun:ORBit_demarshal_object
+   fun:CORBA_ORB_string_to_object
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_get_current_lock_holder
+   fun:gconf_activate_server
+   obj:/usr/lib/libgconf-2.so.*
+   obj:/usr/lib/libgconf-2.so.*
+   fun:gconf_engine_get_default
+}
+
+# Some libORBit/bonobo initialisation stuff
+{
+   <bonobo init>
+   Memcheck:Leak
+   fun:malloc
+   fun:g_malloc
+   fun:ORBit_alloc_string
+   fun:CORBA_string_dup
+   fun:Bonobo_ActivationEnvValue_set
+   fun:bonobo_activation_init_activation_env
+   fun:bonobo_activation_orb_init
+   fun:bonobo_activation_init
+}
+{
+   <bonobo init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc*
+   fun:ORBit_small_alloc*
+   obj:/usr/lib/libORBit-2.so*
+   fun:PortableServer_POA_servant_to_reference
+   obj:/usr/lib/libbonobo-2.so*
+}
+{
+   <bonobo init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc_tcval
+   fun:ORBit_small_allocbuf
+   fun:ORBit_adaptor_setup
+   obj:/usr/lib/libORBit-2.so*
+   fun:ORBit_POA_setup_root
+   fun:ORBit_init_internals
+   fun:CORBA_ORB_init
+}
+{
+   <bonobo init - more recent variant of above>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc_tcval
+   fun:ORBit_adaptor_setup
+   obj:/usr/lib/libORBit-2.so*
+   fun:ORBit_POA_setup_root
+   fun:ORBit_init_internals
+   fun:CORBA_ORB_init
+}
+{
+   <bonobo init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc*
+   fun:ORBit_small_allocbuf
+   fun:bonobo_activation_init_activation_env
+   fun:bonobo_activation_orb_init
+   fun:bonobo_activation_init
+}
+
+# More GConf stuff from the FC5 buildbot, mostly variations on the 
+# above stack traces
+{
+   <incompletely initialised ORBit buffer>
+   Memcheck:Param
+   writev(vector[...])
+   fun:writev
+   obj:/usr/lib/libORBit-2.so*
+   fun:link_connection_writev
+   fun:giop_send_buffer_write
+   obj:/usr/lib/libORBit-2.so*
+   fun:ORBit_small_invoke_stub
+   fun:ORBit_small_invoke_stub_n
+   fun:ORBit_c_stub_invoke
+   fun:ConfigServer_ping
+   fun:gconf_activate_server
+   obj:/usr/lib/libgconf-2.so*
+   obj:/usr/lib/libgconf-2.so*
+   fun:gconf_engine_get_default
+}
+{
+   <gconf init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc*
+   fun:ORBit_small_alloc*
+   obj:/usr/lib/libORBit-2.so*
+   fun:PortableServer_POA_servant_to_reference
+   obj:/usr/lib/libgconf-2.so*
+   obj:/usr/lib/libgconf-2.so*
+   obj:/usr/lib/libgconf-2.so*
+   fun:gconf_engine_get_default
+}
+{
+   <gconf init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc*
+   fun:ORBit_small_alloc
+   obj:/usr/lib/libORBit-2.so*
+   fun:ORBit_demarshal_IOR
+   fun:ORBit_demarshal_object
+   fun:CORBA_ORB_string_to_object
+   obj:/usr/lib/libgconf-2.so*
+   fun:gconf_get_current_lock_holder
+   fun:gconf_activate_server
+   obj:/usr/lib/libgconf-2.so*
+   obj:/usr/lib/libgconf-2.so*
+   fun:gconf_engine_get_default
+}
+{
+   <gconf init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc*
+   fun:ORBit_small_alloc*
+   obj:/usr/lib/libORBit-2.so*
+   fun:ORBit_demarshal_IOR
+   fun:ORBit_demarshal_object
+   fun:CORBA_ORB_string_to_object
+   obj:/usr/lib/libgconf-2.so*
+   fun:gconf_get_current_lock_holder
+   fun:gconf_activate_server
+   obj:/usr/lib/libgconf-2.so*
+   obj:/usr/lib/libgconf-2.so*
+   fun:gconf_engine_get_default
+}
+{
+   <bonobo init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc*
+   fun:ORBit_small_alloc*
+   obj:/usr/lib/libORBit-2.so*
+   fun:ORBit_demarshal_IOR
+   fun:ORBit_demarshal_object
+   fun:ORBit_demarshal_value
+   obj:/usr/lib/libORBit-2.so*
+   fun:ORBit_small_invoke_stub
+   fun:ORBit_small_invoke_stub_n
+   fun:ORBit_c_stub_invoke
+   fun:ConfigServer_get_default_database
+   obj:/usr/lib/libgconf-2.so*
+   fun:gconf_engine_get_default
+}
+{
+   <gconf init>
+   Memcheck:Leak
+   fun:calloc
+   fun:g_malloc0
+   fun:ORBit_alloc*
+   fun:ORBit_small_alloc*
+   obj:/usr/lib/libORBit-2.so*
+   fun:ORBit_OAObject_object_to_objkey
+   fun:IOP_generate_profiles
+   fun:ORBit_marshal_object
+   fun:ORBit_marshal_value
+   obj:/usr/lib/libORBit-2.so*
+   fun:ORBit_small_invoke_stub
+   fun:ORBit_small_invoke_stub_n
+   fun:ORBit_c_stub_invoke
+   fun:ConfigServer_add_client
+   obj:/usr/lib/libgconf-2.so*
+   obj:/usr/lib/libgconf-2.so*
+   fun:gconf_engine_get_default
+}
+{
+   <GLib caching the home dir>
+   Memcheck:Leak
+   fun:malloc
+   obj:*libc-*.so
+   fun:__nss_database_lookup
+   obj:*
+   obj:*
+   fun:getpwnam_r
+   obj:/usr/lib*/libglib-2.0.so.*
+   fun:g_get_home_dir
+}
+{
+   <GLib caching the user name>
+   Memcheck:Leak
+   fun:malloc
+   obj:*libc-*.so
+   fun:__nss_database_lookup
+   obj:*
+   obj:*
+   fun:getpwnam_r
+   obj:/usr/lib*/libglib-2.0.so.*
+   fun:g_get_user_name
+}
+{
+   <GLib caching the tmp dir>
+   Memcheck:Leak
+   fun:malloc
+   obj:*libc-*.so
+   fun:__nss_database_lookup
+   obj:*
+   obj:*
+   fun:getpwnam_r
+   obj:/usr/lib*/libglib-2.0.so.*
+   fun:g_get_tmp_dir
+}
+
+{
+   <GLib caching the host name>
+   Memcheck:Leak
+   fun:malloc
+   obj:*libc-*.so
+   fun:__nss_database_lookup
+   obj:*
+   obj:*
+   fun:getpwnam_r
+   obj:/usr/lib*/libglib-2.0.so.0.*
+   fun:g_get_host_name
+}
+
+
+## Some Fontconfig errors.
+{
+   <First time load of a font - feisty x86_64>
+   Memcheck:Leak
+   fun:malloc
+   fun:FcPatternObjectInsertElt
+   fun:FcPatternObjectAddWithBinding
+   fun:FcPatternAppend
+   fun:FcEndElement
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   fun:XML_ParseBuffer
+   fun:FcConfigParseAndLoad
+   fun:FcConfigParseAndLoad
+   fun:FcParseInclude
+   fun:FcEndElement
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   fun:XML_ParseBuffer
+   fun:FcConfigParseAndLoad
+}
+{
+   <First time load of a font - feisty x86_64>
+   Memcheck:Leak
+   fun:malloc
+   fun:FcStrCopy
+   fun:FcEndElement
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   fun:XML_ParseBuffer
+   fun:FcConfigParseAndLoad
+   fun:FcConfigParseAndLoad
+   fun:FcParseInclude
+   fun:FcEndElement
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   obj:/usr/lib/libexpat.so.1.0.0
+   fun:XML_ParseBuffer
+   fun:FcConfigParseAndLoad
+   fun:FcInitLoadConfig
+   fun:FcInitLoadConfigAndFonts
+}
+
diff --git a/common/gstdoc-scangobj b/common/gstdoc-scangobj
new file mode 100755 (executable)
index 0000000..90ba889
--- /dev/null
@@ -0,0 +1,1607 @@
+#!/usr/bin/perl -w
+# -*- cperl -*-
+#
+# gtk-doc - GTK DocBook documentation generator.
+# Copyright (C) 1998  Damon Chaplin
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+#
+# This gets information about object heirarchies and signals
+# by compiling a small C program. CFLAGS and LDFLAGS must be
+# set appropriately before running this script.
+#
+# NOTE: the lookup_signal_arg_names() function contains the argument names of
+#       standard GTK signal handlers. This may need to be updated for new
+#       GTK signals or Gnome widget signals.
+
+use Getopt::Long;
+
+unshift @INC, '/usr/share/gtk-doc/data';
+require "gtkdoc-common.pl";
+
+# Options
+
+# name of documentation module
+my $MODULE;
+my $OUTPUT_DIR;
+my $PRINT_VERSION;
+my $PRINT_HELP;
+my $TYPE_INIT_FUNC="g_type_init ()";
+
+# --nogtkinit is deprecated, as it is the default now anyway.
+%optctl = (module => \$MODULE,
+           source => \$SOURCE,
+          types => \$TYPES_FILE,
+          nogtkinit => \$NO_GTK_INIT,
+          'type-init-func' => \$TYPE_INIT_FUNC,
+          'output-dir' => \$OUTPUT_DIR,
+          'version' => \$PRINT_VERSION,
+          'help' => \$PRINT_HELP);
+          
+GetOptions(\%optctl, "module=s", "source=s", "types:s", "output-dir:s", "nogtkinit", "type-init-func:s", "version", "help");
+
+if ($NO_GTK_INIT) {
+  # Do nothing. This just avoids a warning.
+}
+
+if ($PRINT_VERSION) {
+    print "1.5\n";
+    exit 0;
+}
+
+if (!$MODULE) {
+    $PRINT_HELP = 1;
+}
+
+if ($PRINT_HELP) {
+    print "gstdoc-scangobj version 1.5\n";
+    print "\n--module=MODULE_NAME  Name of the doc module being parsed";
+    print "\n--source=SOURCE_NAME  Name of the source module for plugins";
+    print "\n--types=FILE          The name of the file to store the types in";
+    print "\n--type-init-func=FUNC The init function to call instead of g_type_init ()";
+    print "\n--output-dir=DIRNAME  The directory where the results are stored";
+    print "\n--version             Print the version of this program";
+    print "\n--help                Print this help\n";
+    exit 0;
+}
+
+$OUTPUT_DIR = $OUTPUT_DIR ? $OUTPUT_DIR : ".";
+
+# THOMAS: dynamic types; only use types file for headers
+ $TYPES_FILE = $TYPES_FILE ? $TYPES_FILE : "$OUTPUT_DIR/$MODULE.types";
+
+open (TYPES, $TYPES_FILE) || die "Cannot open $TYPES_FILE: $!\n";
+open (OUTPUT, ">$MODULE-scan.c") || die "Cannot open $MODULE-scan.c: $!\n";
+
+my $old_signals_filename = "$OUTPUT_DIR/$MODULE.signals";
+my $new_signals_filename = "$OUTPUT_DIR/$MODULE.signals.new";
+my $old_hierarchy_filename = "$OUTPUT_DIR/$MODULE.hierarchy";
+my $new_hierarchy_filename = "$OUTPUT_DIR/$MODULE.hierarchy.new";
+my $old_interfaces_filename = "$OUTPUT_DIR/$MODULE.interfaces";
+my $new_interfaces_filename = "$OUTPUT_DIR/$MODULE.interfaces.new";
+my $old_prerequisites_filename = "$OUTPUT_DIR/$MODULE.prerequisites";
+my $new_prerequisites_filename = "$OUTPUT_DIR/$MODULE.prerequisites.new";
+my $old_args_filename = "$OUTPUT_DIR/$MODULE.args";
+my $new_args_filename = "$OUTPUT_DIR/$MODULE.args.new";
+
+# write a C program to scan the types
+
+$includes = "";
+#@types = ();
+
+for (<TYPES>) {
+    if (/^#include/) {
+       $includes .= $_;
+#    } elsif (/^%/) {
+#      next;
+#    } elsif (/^\s*$/) {
+#      next;
+#    } else {
+#      chomp;
+#      push @types, $_;
+    }
+}
+
+#$ntypes = @types + 1;
+
+print OUTPUT <<EOT;
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+
+$includes
+#ifdef GTK_IS_WIDGET_CLASS
+#include <gtk/gtkversion.h>
+#endif
+GType *object_types = NULL;
+
+static GType *
+get_object_types (void)
+{
+    GList *plugins = NULL;
+    GList *factories = NULL;
+    GList *l;
+    GstElementFactory *factory = NULL;
+
+    gint i = 0;
+
+    /* get a list of features from plugins in our source module */
+    plugins = gst_registry_get_plugin_list (gst_registry_get_default());
+
+    while (plugins) {
+      GList *features;
+      GstPlugin *plugin;
+      const gchar *source;
+
+      plugin = (GstPlugin *) (plugins->data);
+      plugins = g_list_next (plugins);
+      source = gst_plugin_get_source (plugin);
+      /*g_print ("plugin: %s source: %s\\n", plugin->desc.name, source);*/
+      if (!source || strcmp (source, "$SOURCE") != 0) {
+        continue;
+      }
+      g_print ("plugin: %s source: %s\\n", plugin->desc.name, source);
+
+      features =
+          gst_registry_get_feature_list_by_plugin (gst_registry_get_default (),
+          plugin->desc.name);
+      while (features) {
+        GstPluginFeature *feature;
+        feature = GST_PLUGIN_FEATURE (features->data);
+        feature = gst_plugin_feature_load (feature);
+        if (!feature) {
+          g_warning ("Could not load plugin feature %s",
+                     gst_plugin_feature_get_name (feature));
+        }
+
+        if (GST_IS_ELEMENT_FACTORY (feature)) {
+          factory = GST_ELEMENT_FACTORY (feature);
+          factories = g_list_prepend (factories, factory);
+        }
+        features = g_list_next (features);
+      }
+    }
+
+    g_message ("number of element factories: %d", g_list_length (factories));
+
+    /* allocate the object_types array to hold them */
+    object_types = g_new0 (GType, g_list_length (factories)+1);
+
+    l = factories;
+    i = 0;
+
+    /* fill it */
+    while (l) {
+      GType type;
+      factory = GST_ELEMENT_FACTORY (l->data);
+      type = gst_element_factory_get_element_type (factory);
+      g_message ("adding type %p for factory %s", (void *) type, gst_element_factory_get_longname (factory));
+      object_types[i] = type;
+      i++;
+      l = g_list_next (l);
+    }
+    object_types[i] = 0;
+EOT
+
+print OUTPUT <<EOT;
+
+    /* Need to make sure all the types are loaded in and initialize
+     * their signals and properties.
+     */
+    for (i=0; object_types[i]; i++) {
+      if (G_TYPE_IS_CLASSED (object_types[i]))
+        g_type_class_ref (object_types[i]);
+        else {
+          g_warning ("not reffing type: %s", g_type_name (object_types[i]));
+        }
+    }
+
+    return object_types;
+}
+
+/*
+ * This uses GObject type functions to output signal prototypes and the object
+ * hierarchy.
+ */
+
+/* The output files */
+const gchar *signals_filename = "$new_signals_filename";
+const gchar *hierarchy_filename = "$new_hierarchy_filename";
+const gchar *interfaces_filename = "$new_interfaces_filename";
+const gchar *prerequisites_filename = "$new_prerequisites_filename";
+const gchar *args_filename = "$new_args_filename";
+
+
+static void output_signals (void);
+static void output_object_signals (FILE *fp,
+                                  GType object_type);
+static void output_object_signal (FILE *fp,
+                                 const gchar *object_class_name,
+                                 guint signal_id);
+static const gchar * get_type_name (GType type,
+                                   gboolean * is_pointer);
+static const gchar * get_gdk_event (const gchar * signal_name);
+static const gchar ** lookup_signal_arg_names (const gchar * type,
+                                              const gchar * signal_name);
+
+static void output_object_hierarchy (void);
+static void output_hierarchy (FILE *fp,
+                             GType type,
+                             guint level);
+
+static void output_object_interfaces (void);
+static void output_interfaces (FILE *fp,
+                              GType type);
+
+static void output_interface_prerequisites (void);
+static void output_prerequisites (FILE *fp,
+                                 GType type);
+
+static void output_args (void);
+static void output_object_args (FILE *fp, GType object_type);
+
+int
+main (int argc, char *argv[])
+{
+  /* Silence the compiler: */
+  if (argv != argv) argc = argc;
+
+  $TYPE_INIT_FUNC;
+
+  get_object_types ();
+
+  output_signals ();
+  output_object_hierarchy ();
+  output_object_interfaces ();
+  output_interface_prerequisites ();
+  output_args ();
+
+  return 0;
+}
+
+
+static void
+output_signals (void)
+{
+  FILE *fp;
+  gint i;
+
+  fp = fopen (signals_filename, "w");
+  if (fp == NULL)
+    {
+      g_warning ("Couldn't open output file: %s : %s", signals_filename, strerror(errno));
+      return;
+    }
+
+  for (i = 0; object_types[i]; i++)
+    output_object_signals (fp, object_types[i]);
+
+  fclose (fp);
+}
+
+static gint
+compare_signals (const void *a, const void *b)
+{
+  const guint *signal_a = a;
+  const guint *signal_b = b;
+
+  return strcmp (g_signal_name (*signal_a), g_signal_name (*signal_b));
+}
+
+/* This outputs all the signals of one object. */
+static void
+output_object_signals (FILE *fp, GType object_type)
+{
+  const gchar *object_class_name;
+  guint *signals, n_signals;
+  guint sig;
+
+  if (G_TYPE_IS_INSTANTIATABLE (object_type) ||
+      G_TYPE_IS_INTERFACE (object_type))
+    {
+
+      object_class_name = g_type_name (object_type);
+
+      signals = g_signal_list_ids (object_type, &n_signals);
+      qsort (signals, n_signals, sizeof (guint), compare_signals);
+
+      for (sig = 0; sig < n_signals; sig++)
+        {
+           output_object_signal (fp, object_class_name, signals[sig]);
+        }
+      g_free (signals);
+   }
+}
+
+
+/* This outputs one signal. */
+static void
+output_object_signal (FILE *fp,
+                     const gchar *object_name,
+                     guint signal_id)
+{
+  GSignalQuery query_info;
+  const gchar *type_name, *ret_type, *object_arg, *arg_name;
+  gchar *pos, *object_arg_lower;
+  gboolean is_pointer;
+  gchar ret_type_buffer[1024], buffer[1024];
+  guint i, param;
+  const gchar **arg_names;
+  gint param_num, widget_num, event_num, callback_num;
+  gint *arg_num;
+  gchar signal_name[128];
+  gchar flags[16];
+
+  /*  g_print ("Object: %s Signal: %u\\n", object_name, signal_id);*/
+
+  param_num = 1;
+  widget_num = event_num = callback_num = 0;
+
+  g_signal_query (signal_id, &query_info);
+
+  /* Output the return type and function name. */
+  ret_type = get_type_name (query_info.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE, &is_pointer);
+  sprintf (ret_type_buffer, "%s%s", ret_type, is_pointer ? "*" : "");
+
+  /* Output the signal object type and the argument name. We assume the
+     type is a pointer - I think that is OK. We remove "Gtk" or "Gnome" and
+     convert to lower case for the argument name. */
+  pos = buffer;
+  sprintf (pos, "%s ", object_name);
+  pos += strlen (pos);
+
+  if (!strncmp (object_name, "Gtk", 3))
+      object_arg = object_name + 3;
+  else if (!strncmp (object_name, "Gnome", 5))
+      object_arg = object_name + 5;
+  else
+      object_arg = object_name;
+
+  object_arg_lower = g_ascii_strdown (object_arg, -1);
+  sprintf (pos, "*%s\\n", object_arg_lower);
+  pos += strlen (pos);
+  if (!strncmp (object_arg_lower, "widget", 6))
+    widget_num = 2;
+  g_free(object_arg_lower);
+
+  /* Convert signal name to use underscores rather than dashes '-'. */
+  strcpy (signal_name, query_info.signal_name);
+  for (i = 0; signal_name[i]; i++)
+    {
+      if (signal_name[i] == '-')
+       signal_name[i] = '_';
+    }
+
+  /* Output the signal parameters. */
+  arg_names = lookup_signal_arg_names (object_name, signal_name);
+
+  for (param = 0; param < query_info.n_params; param++)
+    {
+      if (arg_names)
+       {
+         sprintf (pos, "%s\\n", arg_names[param]);
+         pos += strlen (pos);
+       }
+      else
+       {
+         type_name = get_type_name (query_info.param_types[param] & ~G_SIGNAL_TYPE_STATIC_SCOPE, &is_pointer);
+
+         /* Most arguments to the callback are called "arg1", "arg2", etc.
+            GdkWidgets are called "widget", "widget2", ...
+            GdkEvents are called "event", "event2", ...
+            GtkCallbacks are called "callback", "callback2", ... */
+         if (!strcmp (type_name, "GtkWidget"))
+           {
+             arg_name = "widget";
+             arg_num = &widget_num;
+           }
+         else if (!strcmp (type_name, "GdkEvent"))
+           {
+             type_name = get_gdk_event (signal_name);
+             arg_name = "event";
+             arg_num = &event_num;
+             is_pointer = TRUE;
+           }
+         else if (!strcmp (type_name, "GtkCallback")
+                  || !strcmp (type_name, "GtkCCallback"))
+           {
+             arg_name = "callback";
+             arg_num = &callback_num;
+           }
+         else
+           {
+             arg_name = "arg";
+             arg_num = &param_num;
+           }
+         sprintf (pos, "%s ", type_name);
+         pos += strlen (pos);
+
+         if (!arg_num || *arg_num == 0)
+           sprintf (pos, "%s%s\\n", is_pointer ? "*" : " ", arg_name);
+         else
+           sprintf (pos, "%s%s%i\\n", is_pointer ? "*" : " ", arg_name,
+                    *arg_num);
+         pos += strlen (pos);
+
+         if (arg_num)
+           {
+             if (*arg_num == 0)
+               *arg_num = 2;
+             else
+               *arg_num += 1;
+           }
+       }
+    }
+
+  pos = flags;
+  /* We use one-character flags for simplicity. */
+  if (query_info.signal_flags & G_SIGNAL_RUN_FIRST)
+    *pos++ = 'f';
+  if (query_info.signal_flags & G_SIGNAL_RUN_LAST)
+    *pos++ = 'l';
+  if (query_info.signal_flags & G_SIGNAL_RUN_CLEANUP)
+    *pos++ = 'c';
+  if (query_info.signal_flags & G_SIGNAL_NO_RECURSE)
+    *pos++ = 'r';
+  if (query_info.signal_flags & G_SIGNAL_DETAILED)
+    *pos++ = 'd';
+  if (query_info.signal_flags & G_SIGNAL_ACTION)
+    *pos++ = 'a';
+  if (query_info.signal_flags & G_SIGNAL_NO_HOOKS)
+    *pos++ = 'h';
+  *pos = 0;
+
+  fprintf (fp,
+          "<SIGNAL>\\n<NAME>%s::%s</NAME>\\n<RETURNS>%s</RETURNS>\\n<FLAGS>%s</FLAGS>\\n%s</SIGNAL>\\n\\n",
+          object_name, query_info.signal_name, ret_type_buffer, flags, buffer);
+}
+
+
+/* Returns the type name to use for a signal argument or return value, given
+   the GtkType from the signal info. It also sets is_pointer to TRUE if the
+   argument needs a '*' since it is a pointer. */
+static const gchar *
+get_type_name (GType type, gboolean * is_pointer)
+{
+  const gchar *type_name;
+
+  *is_pointer = FALSE;
+  type_name = g_type_name (type);
+
+  switch (type) {
+  case G_TYPE_NONE:
+  case G_TYPE_CHAR:
+  case G_TYPE_UCHAR:
+  case G_TYPE_BOOLEAN:
+  case G_TYPE_INT:
+  case G_TYPE_UINT:
+  case G_TYPE_LONG:
+  case G_TYPE_ULONG:
+  case G_TYPE_FLOAT:
+  case G_TYPE_DOUBLE:
+  case G_TYPE_POINTER:
+    /* These all have normal C type names so they are OK. */
+    return type_name;
+
+  case G_TYPE_STRING:
+    /* A GtkString is really a gchar*. */
+    *is_pointer = TRUE;
+    return "gchar";
+
+  case G_TYPE_ENUM:
+  case G_TYPE_FLAGS:
+    /* We use a gint for both of these. Hopefully a subtype with a decent
+       name will be registered and used instead, as GTK+ does itself. */
+    return "gint";
+
+  case G_TYPE_BOXED:
+    /* The boxed type shouldn't be used itself, only subtypes. Though we
+       return 'gpointer' just in case. */
+    return "gpointer";
+
+  case G_TYPE_PARAM:
+    /* A GParam is really a GParamSpec*. */
+    *is_pointer = TRUE;
+    return "GParamSpec";
+
+  default:
+    break;
+  }
+
+  /* For all GObject subclasses we can use the class name with a "*",
+     e.g. 'GtkWidget *'. */
+  if (g_type_is_a (type, G_TYPE_OBJECT))
+    *is_pointer = TRUE;
+
+  if (G_TYPE_IS_CLASSED (type))
+    *is_pointer = TRUE;
+
+  /* All boxed subtypes will be pointers as well. */
+  if (g_type_is_a (type, G_TYPE_BOXED))
+    *is_pointer = TRUE;
+
+  /* All pointer subtypes will be pointers as well. */
+  if (g_type_is_a (type, G_TYPE_POINTER))
+    *is_pointer = TRUE;
+
+  /* But enums are not */
+  if (g_type_is_a (type, G_TYPE_ENUM) ||
+      g_type_is_a (type, G_TYPE_FLAGS))
+    *is_pointer = FALSE;
+
+  return type_name;
+}
+
+
+static const gchar *
+get_gdk_event (const gchar * signal_name)
+{
+  static const gchar *GbGDKEvents[] =
+  {
+    "button_press_event", "GdkEventButton",
+    "button_release_event", "GdkEventButton",
+    "motion_notify_event", "GdkEventMotion",
+    "delete_event", "GdkEvent",
+    "destroy_event", "GdkEvent",
+    "expose_event", "GdkEventExpose",
+    "key_press_event", "GdkEventKey",
+    "key_release_event", "GdkEventKey",
+    "enter_notify_event", "GdkEventCrossing",
+    "leave_notify_event", "GdkEventCrossing",
+    "configure_event", "GdkEventConfigure",
+    "focus_in_event", "GdkEventFocus",
+    "focus_out_event", "GdkEventFocus",
+    "map_event", "GdkEvent",
+    "unmap_event", "GdkEvent",
+    "property_notify_event", "GdkEventProperty",
+    "selection_clear_event", "GdkEventSelection",
+    "selection_request_event", "GdkEventSelection",
+    "selection_notify_event", "GdkEventSelection",
+    "proximity_in_event", "GdkEventProximity",
+    "proximity_out_event", "GdkEventProximity",
+    "drag_begin_event", "GdkEventDragBegin",
+    "drag_request_event", "GdkEventDragRequest",
+    "drag_end_event", "GdkEventDragRequest",
+    "drop_enter_event", "GdkEventDropEnter",
+    "drop_leave_event", "GdkEventDropLeave",
+    "drop_data_available_event", "GdkEventDropDataAvailable",
+    "other_event", "GdkEventOther",
+    "client_event", "GdkEventClient",
+    "no_expose_event", "GdkEventNoExpose",
+    "visibility_notify_event", "GdkEventVisibility",
+    "window_state_event", "GdkEventWindowState",
+    "scroll_event", "GdkEventScroll",
+    NULL
+  };
+
+  gint i;
+
+  for (i = 0; GbGDKEvents[i]; i += 2)
+    {
+      if (!strcmp (signal_name, GbGDKEvents[i]))
+       return GbGDKEvents[i + 1];
+    }
+  return "GdkEvent";
+}
+
+
+/* This returns argument names to use for some known GTK signals.
+    It is passed a widget name, e.g. 'GtkCList' and a signal name, e.g.
+    'select_row' and it returns a pointer to an array of argument types and
+    names. */
+static const gchar **
+lookup_signal_arg_names (const gchar * type, const gchar * signal_name)
+{
+  /* Each arg array starts with the object type name and the signal name,
+     and then signal arguments follow. */
+  static const gchar *GbArgTable[][16] =
+  {
+    {"GtkCList", "select_row",
+     "gint             row",
+     "gint             column",
+     "GdkEventButton  *event"},
+    {"GtkCList", "unselect_row",
+     "gint             row",
+     "gint             column",
+     "GdkEventButton  *event"},
+    {"GtkCList", "click_column",
+     "gint             column"},
+
+    {"GtkCList", "resize_column",
+     "gint             column",
+     "gint             width"},
+
+    {"GtkCList", "extend_selection",
+     "GtkScrollType    scroll_type",
+     "gfloat           position",
+     "gboolean         auto_start_selection"},
+    {"GtkCList", "scroll_vertical",
+     "GtkScrollType    scroll_type",
+     "gfloat           position"},
+    {"GtkCList", "scroll_horizontal",
+     "GtkScrollType    scroll_type",
+     "gfloat           position"},
+
+    {"GtkCTree", "tree_select_row",
+     "GtkCTreeNode    *node",
+     "gint             column"},
+    {"GtkCTree", "tree_unselect_row",
+     "GtkCTreeNode    *node",
+     "gint             column"},
+    {"GtkCTree", "tree_expand",
+     "GtkCTreeNode    *node"},
+    {"GtkCTree", "tree_collapse",
+     "GtkCTreeNode    *node"},
+    {"GtkCTree", "tree_move",
+     "GtkCTreeNode    *node",
+     "GtkCTreeNode    *new_parent",
+     "GtkCTreeNode    *new_sibling"},
+    {"GtkCTree", "change_focus_row_expansion",
+     "GtkCTreeExpansionType expansion"},
+
+    {"GtkEditable", "insert_text",
+     "gchar           *new_text",
+     "gint             new_text_length",
+     "gint            *position"},
+    {"GtkEditable", "delete_text",
+     "gint             start_pos",
+     "gint             end_pos"},
+    {"GtkEditable", "set_editable",
+     "gboolean         is_editable"},
+    {"GtkEditable", "move_cursor",
+     "gint             x",
+     "gint             y"},
+    {"GtkEditable", "move_word",
+     "gint             num_words"},
+    {"GtkEditable", "move_page",
+     "gint             x",
+     "gint             y"},
+    {"GtkEditable", "move_to_row",
+     "gint             row"},
+    {"GtkEditable", "move_to_column",
+     "gint             column"},
+
+    {"GtkEditable", "kill_char",
+     "gint             direction"},
+    {"GtkEditable", "kill_word",
+     "gint             direction"},
+    {"GtkEditable", "kill_line",
+     "gint             direction"},
+
+
+    {"GtkInputDialog", "enable_device",
+     "GdkDevice       *deviceid"},
+    {"GtkInputDialog", "disable_device",
+     "GdkDevice       *deviceid"},
+
+    {"GtkListItem", "extend_selection",
+     "GtkScrollType    scroll_type",
+     "gfloat           position",
+     "gboolean         auto_start_selection"},
+    {"GtkListItem", "scroll_vertical",
+     "GtkScrollType    scroll_type",
+     "gfloat           position"},
+    {"GtkListItem", "scroll_horizontal",
+     "GtkScrollType    scroll_type",
+     "gfloat           position"},
+
+    {"GtkMenuShell", "move_current",
+     "GtkMenuDirectionType direction"},
+    {"GtkMenuShell", "activate_current",
+     "gboolean         force_hide"},
+
+
+    {"GtkNotebook", "switch_page",
+     "GtkNotebookPage *page",
+     "guint            page_num"},
+    {"GtkStatusbar", "text_pushed",
+     "guint            context_id",
+     "gchar           *text"},
+    {"GtkStatusbar", "text_popped",
+     "guint            context_id",
+     "gchar           *text"},
+    {"GtkTipsQuery", "widget_entered",
+     "GtkWidget       *widget",
+     "gchar           *tip_text",
+     "gchar           *tip_private"},
+    {"GtkTipsQuery", "widget_selected",
+     "GtkWidget       *widget",
+     "gchar           *tip_text",
+     "gchar           *tip_private",
+     "GdkEventButton  *event"},
+    {"GtkToolbar", "orientation_changed",
+     "GtkOrientation   orientation"},
+    {"GtkToolbar", "style_changed",
+     "GtkToolbarStyle  style"},
+    {"GtkWidget", "draw",
+     "GdkRectangle    *area"},
+    {"GtkWidget", "size_request",
+     "GtkRequisition  *requisition"},
+    {"GtkWidget", "size_allocate",
+     "GtkAllocation   *allocation"},
+    {"GtkWidget", "state_changed",
+     "GtkStateType     state"},
+    {"GtkWidget", "style_set",
+     "GtkStyle        *previous_style"},
+
+    {"GtkWidget", "install_accelerator",
+     "gchar           *signal_name",
+     "gchar            key",
+     "gint             modifiers"},
+
+    {"GtkWidget", "add_accelerator",
+     "guint            accel_signal_id",
+     "GtkAccelGroup   *accel_group",
+     "guint            accel_key",
+     "GdkModifierType  accel_mods",
+     "GtkAccelFlags    accel_flags"},
+
+    {"GtkWidget", "parent_set",
+     "GtkObject       *old_parent"},
+
+    {"GtkWidget", "remove_accelerator",
+     "GtkAccelGroup   *accel_group",
+     "guint            accel_key",
+     "GdkModifierType  accel_mods"},
+    {"GtkWidget", "debug_msg",
+     "gchar           *message"},
+    {"GtkWindow", "move_resize",
+     "gint            *x",
+     "gint            *y",
+     "gint             width",
+     "gint             height"},
+    {"GtkWindow", "set_focus",
+     "GtkWidget       *widget"},
+
+    {"GtkWidget", "selection_get",
+     "GtkSelectionData *data",
+     "guint            info",
+     "guint            time"},
+    {"GtkWidget", "selection_received",
+     "GtkSelectionData *data",
+     "guint            time"},
+
+    {"GtkWidget", "drag_begin",
+     "GdkDragContext  *drag_context"},
+    {"GtkWidget", "drag_end",
+     "GdkDragContext  *drag_context"},
+    {"GtkWidget", "drag_data_delete",
+     "GdkDragContext  *drag_context"},
+    {"GtkWidget", "drag_leave",
+     "GdkDragContext  *drag_context",
+     "guint            time"},
+    {"GtkWidget", "drag_motion",
+     "GdkDragContext  *drag_context",
+     "gint             x",
+     "gint             y",
+     "guint            time"},
+    {"GtkWidget", "drag_drop",
+     "GdkDragContext  *drag_context",
+     "gint             x",
+     "gint             y",
+     "guint            time"},
+    {"GtkWidget", "drag_data_get",
+     "GdkDragContext  *drag_context",
+     "GtkSelectionData *data",
+     "guint            info",
+     "guint            time"},
+    {"GtkWidget", "drag_data_received",
+     "GdkDragContext  *drag_context",
+     "gint             x",
+     "gint             y",
+     "GtkSelectionData *data",
+     "guint            info",
+     "guint            time"},
+
+    {NULL}
+  };
+
+  gint i;
+
+  for (i = 0; GbArgTable[i][0]; i++)
+    {
+#if 1
+      if (!strcmp (type, GbArgTable[i][0])
+         && !strcmp (signal_name, GbArgTable[i][1]))
+       return &GbArgTable[i][2];
+#endif
+    }
+  return NULL;
+}
+
+/* This outputs the hierarchy of all objects which have been initialized,
+   i.e. by calling their XXX_get_type() initialization function. */
+static void
+output_object_hierarchy (void)
+{
+  FILE *fp;
+  gint i;
+
+  fp = fopen (hierarchy_filename, "w");
+  if (fp == NULL)
+    {
+      g_warning ("Couldn't open output file: %s : %s", hierarchy_filename, strerror(errno));
+      return;
+    }
+  output_hierarchy (fp, G_TYPE_OBJECT, 0);
+  output_hierarchy (fp, G_TYPE_INTERFACE, 0);
+  
+  for (i=0; object_types[i]; i++) {
+    if (!g_type_parent (object_types[i]) &&
+      (object_types[i] != G_TYPE_NONE) &&
+      (object_types[i] != G_TYPE_OBJECT) &&
+      (object_types[i] != G_TYPE_INTERFACE)
+    ) {
+      g_warning ("printing hierarchy for root type: %s",
+          g_type_name (object_types[i]));
+      output_hierarchy (fp, object_types[i], 0);
+    }
+  }
+  /* for debugging
+  for (i=0; object_types[i]; i++) {
+    if(object_types[i] != G_TYPE_NONE) {
+      g_print ("type has not been added to hierarchy: %s\\n",
+        g_type_name (object_types[i]));
+    }
+  }
+  for debugging */
+
+  fclose (fp);
+}
+
+/* This is called recursively to output the hierarchy of a widget. */
+static void
+output_hierarchy (FILE  *fp,
+                 GType  type,
+                 guint   level)
+{
+  guint i;
+  GType *children;
+  guint n_children;
+
+  if (!type)
+    return;
+
+  /* for debugging
+  for (i=0; object_types[i]; i++) {
+    if(object_types[i] == type) {
+      g_print ("added type to hierarchy (level %d): %s\\n",
+        level, g_type_name (type));
+      object_types[i] = G_TYPE_NONE;
+      break;
+    }
+  }
+  for debugging */
+
+  for (i = 0; i < level; i++)
+    fprintf (fp, "  ");
+  fprintf (fp, g_type_name (type));
+  fprintf (fp, "\\n");
+
+  children = g_type_children (type, &n_children);
+
+  for (i=0; i < n_children; i++) {
+    output_hierarchy (fp, children[i], level + 1);
+  }
+
+  g_free (children);
+}
+
+static void output_object_interfaces (void)
+{
+  guint i;
+  FILE *fp;
+
+  fp = fopen (interfaces_filename, "w");
+  if (fp == NULL)
+    {
+      g_warning ("Couldn't open output file: %s : %s", interfaces_filename, strerror(errno));
+      return;
+    }
+  output_interfaces (fp, G_TYPE_OBJECT);
+
+  for (i = 0; object_types[i]; i++)
+    {
+      if (!g_type_parent (object_types[i]) &&
+          (object_types[i] != G_TYPE_OBJECT) &&
+          G_TYPE_IS_INSTANTIATABLE (object_types[i]))
+        {
+          output_interfaces (fp, object_types[i]);
+        }
+    }
+  fclose (fp);
+}
+
+static void
+output_interfaces (FILE  *fp,
+                  GType  type)
+{
+  guint i;
+  GType *children, *interfaces;
+  guint n_children, n_interfaces;
+
+  if (!type)
+    return;
+
+  interfaces = g_type_interfaces (type, &n_interfaces);
+
+  if (n_interfaces > 0)
+    {
+      fprintf (fp, g_type_name (type));
+      for (i=0; i < n_interfaces; i++)
+          fprintf (fp, " %s", g_type_name (interfaces[i]));
+      fprintf (fp, "\\n");
+     }
+  g_free (interfaces);
+
+  children = g_type_children (type, &n_children);
+
+  for (i=0; i < n_children; i++)
+    output_interfaces (fp, children[i]);
+
+  g_free (children);
+}
+
+static void output_interface_prerequisites (void)
+{
+  FILE *fp;
+
+  fp = fopen (prerequisites_filename, "w");
+  if (fp == NULL)
+    {
+      g_warning ("Couldn't open output file: %s : %s", prerequisites_filename, strerror(errno));
+      return;
+    }
+  output_prerequisites (fp, G_TYPE_INTERFACE);
+  fclose (fp);
+}
+
+static void
+output_prerequisites (FILE  *fp,
+                     GType  type)
+{
+#if GLIB_CHECK_VERSION(2,1,0)
+  guint i;
+  GType *children, *prerequisites;
+  guint n_children, n_prerequisites;
+
+  if (!type)
+    return;
+
+  prerequisites = g_type_interface_prerequisites (type, &n_prerequisites);
+
+  if (n_prerequisites > 0)
+    {
+      fprintf (fp, g_type_name (type));
+      for (i=0; i < n_prerequisites; i++)
+          fprintf (fp, " %s", g_type_name (prerequisites[i]));
+      fprintf (fp, "\\n");
+     }
+  g_free (prerequisites);
+
+  children = g_type_children (type, &n_children);
+
+  for (i=0; i < n_children; i++)
+    output_prerequisites (fp, children[i]);
+
+  g_free (children);
+#endif
+}
+
+static void
+output_args (void)
+{
+  FILE *fp;
+  gint i;
+
+  fp = fopen (args_filename, "w");
+  if (fp == NULL)
+    {
+      g_warning ("Couldn't open output file: %s : %s", args_filename, strerror(errno));
+      return;
+    }
+
+  for (i = 0; object_types[i]; i++) {
+    output_object_args (fp, object_types[i]);
+  }
+
+  fclose (fp);
+}
+
+static gint
+compare_param_specs (const void *a, const void *b)
+{
+  GParamSpec *spec_a = *(GParamSpec **)a;
+  GParamSpec *spec_b = *(GParamSpec **)b;
+
+  return strcmp (g_param_spec_get_name (spec_a), g_param_spec_get_name (spec_b));
+}
+
+/* Its common to have unsigned properties restricted
+ * to the signed range. Therefore we make this look
+ * a bit nicer by spelling out the max constants.
+ */
+
+/* Don't use "==" with floats, it might trigger a gcc warning.  */
+#define GTKDOC_COMPARE_FLOAT(x, y) (x <= y && x >= y)
+
+static gchar*
+describe_double_constant (gdouble value)
+{
+  gchar *desc;
+
+  if (GTKDOC_COMPARE_FLOAT (value, G_MAXDOUBLE))
+    desc = g_strdup ("G_MAXDOUBLE");
+  else if (GTKDOC_COMPARE_FLOAT (value, G_MINDOUBLE))
+    desc = g_strdup ("G_MINDOUBLE");
+  else if (GTKDOC_COMPARE_FLOAT (value, -G_MAXDOUBLE))
+    desc = g_strdup ("-G_MAXDOUBLE");
+  else if (GTKDOC_COMPARE_FLOAT (value, G_MAXFLOAT))
+    desc = g_strdup ("G_MAXFLOAT");
+  else if (GTKDOC_COMPARE_FLOAT (value, G_MINFLOAT))
+    desc = g_strdup ("G_MINFLOAT");
+  else if (GTKDOC_COMPARE_FLOAT (value, -G_MAXFLOAT))
+    desc = g_strdup ("-G_MAXFLOAT");
+  else
+    desc = g_strdup_printf ("%lg", value);
+
+  return desc;
+}
+
+static gchar*
+describe_signed_constant (gint64 value)
+{
+  gchar *desc;
+
+  if (value == G_MAXINT)
+    desc = g_strdup ("G_MAXINT");
+  else if (value == G_MININT)
+    desc = g_strdup ("G_MININT");
+  else if (value == G_MAXUINT)
+    desc = g_strdup ("G_MAXUINT");
+  else if (value == G_MAXLONG)
+    desc = g_strdup ("G_MAXLONG");
+  else if (value == G_MINLONG)
+    desc = g_strdup ("G_MINLONG");
+  else if (value == G_MAXULONG)
+    desc = g_strdup ("G_MAXULONG");
+  else if (value == G_MAXINT64)
+    desc = g_strdup ("G_MAXINT64");
+  else if (value == G_MININT64)
+    desc = g_strdup ("G_MININT64");
+  else
+    desc = g_strdup_printf ("%" G_GINT64_FORMAT, value);
+
+  return desc;
+}
+
+static gchar*
+describe_unsigned_constant (guint64 value)
+{
+  gchar *desc;
+
+  if (value == G_MAXINT)
+    desc = g_strdup ("G_MAXINT");
+  else if (value == G_MININT)
+    desc = g_strdup ("G_MININT");
+  else if (value == G_MAXUINT)
+    desc = g_strdup ("G_MAXUINT");
+  else if (value == G_MAXLONG)
+    desc = g_strdup ("G_MAXLONG");
+  else if (value == G_MINLONG)
+    desc = g_strdup ("G_MINLONG");
+  else if (value == G_MAXULONG)
+    desc = g_strdup ("G_MAXULONG");
+  else if (value == G_MAXINT64)
+    desc = g_strdup ("G_MAXINT64");
+  else if (value == G_MININT64)
+    desc = g_strdup ("G_MININT64");
+  else if (value == G_MAXUINT64)
+    desc = g_strdup ("G_MAXUINT64");
+  else
+    desc = g_strdup_printf ("%" G_GUINT64_FORMAT, value);
+
+  return desc;
+}
+
+static gchar*
+describe_type (GParamSpec *spec)
+{
+  gchar *desc;
+  gchar *lower;
+  gchar *upper;
+
+  if (G_IS_PARAM_SPEC_CHAR (spec))
+    {
+      GParamSpecChar *pspec = G_PARAM_SPEC_CHAR (spec);
+
+      lower = describe_signed_constant (pspec->minimum);
+      upper = describe_signed_constant (pspec->maximum);
+      if (pspec->minimum == G_MININT8 && pspec->maximum == G_MAXINT8)
+       desc = g_strdup ("");
+      else if (pspec->minimum == G_MININT8)
+       desc = g_strdup_printf ("<= %s", upper);
+      else if (pspec->maximum == G_MAXINT8)
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else if (G_IS_PARAM_SPEC_UCHAR (spec))
+    {
+      GParamSpecUChar *pspec = G_PARAM_SPEC_UCHAR (spec);
+
+      lower = describe_unsigned_constant (pspec->minimum);
+      upper = describe_unsigned_constant (pspec->maximum);
+      if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT8)
+       desc = g_strdup ("");
+      else if (pspec->minimum == 0)
+       desc = g_strdup_printf ("<= %s", upper);
+      else if (pspec->maximum == G_MAXUINT8)
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else if (G_IS_PARAM_SPEC_INT (spec))
+    {
+      GParamSpecInt *pspec = G_PARAM_SPEC_INT (spec);
+
+      lower = describe_signed_constant (pspec->minimum);
+      upper = describe_signed_constant (pspec->maximum);
+      if (pspec->minimum == G_MININT && pspec->maximum == G_MAXINT)
+       desc = g_strdup ("");
+      else if (pspec->minimum == G_MININT)
+       desc = g_strdup_printf ("<= %s", upper);
+      else if (pspec->maximum == G_MAXINT)
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else if (G_IS_PARAM_SPEC_UINT (spec))
+    {
+      GParamSpecUInt *pspec = G_PARAM_SPEC_UINT (spec);
+
+      lower = describe_unsigned_constant (pspec->minimum);
+      upper = describe_unsigned_constant (pspec->maximum);
+      if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT)
+       desc = g_strdup ("");
+      else if (pspec->minimum == 0)
+       desc = g_strdup_printf ("<= %s", upper);
+      else if (pspec->maximum == G_MAXUINT)
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else if (G_IS_PARAM_SPEC_LONG (spec))
+    {
+      GParamSpecLong *pspec = G_PARAM_SPEC_LONG (spec);
+
+      lower = describe_signed_constant (pspec->minimum);
+      upper = describe_signed_constant (pspec->maximum);
+      if (pspec->minimum == G_MINLONG && pspec->maximum == G_MAXLONG)
+       desc = g_strdup ("");
+      else if (pspec->minimum == G_MINLONG)
+       desc = g_strdup_printf ("<= %s", upper);
+      else if (pspec->maximum == G_MAXLONG)
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else if (G_IS_PARAM_SPEC_ULONG (spec))
+    {
+      GParamSpecULong *pspec = G_PARAM_SPEC_ULONG (spec);
+      gchar *upper;
+
+      lower = describe_unsigned_constant (pspec->minimum);
+      upper = describe_unsigned_constant (pspec->maximum);
+      if (pspec->minimum == 0 && pspec->maximum == G_MAXULONG)
+       desc = g_strdup ("");
+      else if (pspec->minimum == 0)
+       desc = g_strdup_printf ("<= %s", upper);
+      else if (pspec->maximum == G_MAXULONG)
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else if (G_IS_PARAM_SPEC_INT64 (spec))
+    {
+      GParamSpecInt64 *pspec = G_PARAM_SPEC_INT64 (spec);
+
+      lower = describe_signed_constant (pspec->minimum);
+      upper = describe_signed_constant (pspec->maximum);
+      if (pspec->minimum == G_MININT64 && pspec->maximum == G_MAXINT64)
+       desc = g_strdup ("");
+      else if (pspec->minimum == G_MININT64)
+       desc = g_strdup_printf ("<= %s", upper);
+      else if (pspec->maximum == G_MAXINT64)
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else if (G_IS_PARAM_SPEC_UINT64 (spec))
+    {
+      GParamSpecUInt64 *pspec = G_PARAM_SPEC_UINT64 (spec);
+
+      lower = describe_unsigned_constant (pspec->minimum);
+      upper = describe_unsigned_constant (pspec->maximum);
+      if (pspec->minimum == 0 && pspec->maximum == G_MAXUINT64)
+       desc = g_strdup ("");
+      else if (pspec->minimum == 0)
+       desc = g_strdup_printf ("<= %s", upper);
+      else if (pspec->maximum == G_MAXUINT64)
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else if (G_IS_PARAM_SPEC_FLOAT (spec))
+    {
+      GParamSpecFloat *pspec = G_PARAM_SPEC_FLOAT (spec);
+
+      lower = describe_double_constant (pspec->minimum);
+      upper = describe_double_constant (pspec->maximum);
+      if (GTKDOC_COMPARE_FLOAT (pspec->minimum, -G_MAXFLOAT))
+       {
+         if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXFLOAT))
+           desc = g_strdup ("");
+         else
+           desc = g_strdup_printf ("<= %s", upper);
+       }
+      else if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXFLOAT))
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else if (G_IS_PARAM_SPEC_DOUBLE (spec))
+    {
+      GParamSpecDouble *pspec = G_PARAM_SPEC_DOUBLE (spec);
+
+      lower = describe_double_constant (pspec->minimum);
+      upper = describe_double_constant (pspec->maximum);
+      if (GTKDOC_COMPARE_FLOAT (pspec->minimum, -G_MAXDOUBLE))
+       {
+         if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXDOUBLE))
+           desc = g_strdup ("");
+         else
+           desc = g_strdup_printf ("<= %s", upper);
+       }
+      else if (GTKDOC_COMPARE_FLOAT (pspec->maximum, G_MAXDOUBLE))
+       desc = g_strdup_printf (">= %s", lower);
+      else
+       desc = g_strdup_printf ("[%s,%s]", lower, upper);
+      g_free (lower);
+      g_free (upper);
+    }
+  else
+    {
+      desc = g_strdup ("");
+    }
+
+  return desc;
+}
+
+static gchar*
+describe_default (GParamSpec *spec)
+{
+  gchar *desc;
+
+  if (G_IS_PARAM_SPEC_CHAR (spec))
+    {
+      GParamSpecChar *pspec = G_PARAM_SPEC_CHAR (spec);
+
+      desc = g_strdup_printf ("%d", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_UCHAR (spec))
+    {
+      GParamSpecUChar *pspec = G_PARAM_SPEC_UCHAR (spec);
+
+      desc = g_strdup_printf ("%u", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_BOOLEAN (spec))
+    {
+      GParamSpecBoolean *pspec = G_PARAM_SPEC_BOOLEAN (spec);
+
+      desc = g_strdup_printf ("%s", pspec->default_value ? "TRUE" : "FALSE");
+    }
+  else if (G_IS_PARAM_SPEC_INT (spec))
+    {
+      GParamSpecInt *pspec = G_PARAM_SPEC_INT (spec);
+
+      desc = g_strdup_printf ("%d", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_UINT (spec))
+    {
+      GParamSpecUInt *pspec = G_PARAM_SPEC_UINT (spec);
+
+      desc = g_strdup_printf ("%u", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_LONG (spec))
+    {
+      GParamSpecLong *pspec = G_PARAM_SPEC_LONG (spec);
+
+      desc = g_strdup_printf ("%ld", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_LONG (spec))
+    {
+      GParamSpecULong *pspec = G_PARAM_SPEC_ULONG (spec);
+
+      desc = g_strdup_printf ("%lu", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_INT64 (spec))
+    {
+      GParamSpecInt64 *pspec = G_PARAM_SPEC_INT64 (spec);
+
+      desc = g_strdup_printf ("%" G_GINT64_FORMAT, pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_UINT64 (spec))
+    {
+      GParamSpecUInt64 *pspec = G_PARAM_SPEC_UINT64 (spec);
+
+      desc = g_strdup_printf ("%" G_GUINT64_FORMAT, pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_UNICHAR (spec))
+    {
+      GParamSpecUnichar *pspec = G_PARAM_SPEC_UNICHAR (spec);
+
+      if (g_unichar_isprint (pspec->default_value))
+       desc = g_strdup_printf ("'%c'", pspec->default_value);
+      else
+       desc = g_strdup_printf ("%u", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_ENUM (spec))
+    {
+      GParamSpecEnum *pspec = G_PARAM_SPEC_ENUM (spec);
+
+      GEnumValue *value = g_enum_get_value (pspec->enum_class, pspec->default_value);
+      if (value)
+       desc = g_strdup_printf ("%s", value->value_name);
+      else
+       desc = g_strdup_printf ("%d", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_FLAGS (spec))
+    {
+      GParamSpecFlags *pspec = G_PARAM_SPEC_FLAGS (spec);
+      guint default_value;
+      GString *acc;
+
+      default_value = pspec->default_value;
+      acc = g_string_new ("");
+
+      while (default_value)
+       {
+         GFlagsValue *value = g_flags_get_first_value (pspec->flags_class, default_value);
+
+         if (!value)
+           break;
+
+         if (acc->len > 0)
+           g_string_append (acc, "|");
+         g_string_append (acc, value->value_name);
+
+         default_value &= ~value->value;
+       }
+
+      if (default_value == 0)
+       desc = g_string_free (acc, FALSE);
+      else
+       {
+         desc = g_strdup_printf ("%d", pspec->default_value);
+         g_string_free (acc, TRUE);
+       }
+    }
+  else if (G_IS_PARAM_SPEC_FLOAT (spec))
+    {
+      GParamSpecFloat *pspec = G_PARAM_SPEC_FLOAT (spec);
+
+      desc = g_strdup_printf ("%g", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_DOUBLE (spec))
+    {
+      GParamSpecDouble *pspec = G_PARAM_SPEC_DOUBLE (spec);
+
+      desc = g_strdup_printf ("%lg", pspec->default_value);
+    }
+  else if (G_IS_PARAM_SPEC_STRING (spec))
+    {
+      GParamSpecString *pspec = G_PARAM_SPEC_STRING (spec);
+
+      if (pspec->default_value)
+       {
+         gchar *esc = g_strescape (pspec->default_value, NULL);
+
+         desc = g_strdup_printf ("\\"%s\\"", esc);
+
+         g_free (esc);
+       }
+      else
+       desc = g_strdup_printf ("NULL");
+    }
+  else
+    {
+      desc = g_strdup ("");
+    }
+
+  return desc;
+}
+
+
+static void
+output_object_args (FILE *fp, GType object_type)
+{
+  gpointer class;
+  const gchar *object_class_name;
+  guint arg;
+  gchar flags[16], *pos;
+  GParamSpec **properties;
+  guint n_properties;
+  gboolean child_prop;
+  gboolean style_prop;
+  gboolean is_pointer;
+  const gchar *type_name;
+  gchar *type_desc;
+  gchar *default_value;
+
+  if (G_TYPE_IS_OBJECT (object_type))
+    {
+      class = g_type_class_peek (object_type);
+      if (!class)
+       return;
+
+      properties = g_object_class_list_properties (class, &n_properties);
+    }
+#if GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 3)
+  else if (G_TYPE_IS_INTERFACE (object_type))
+    {
+      class = g_type_default_interface_ref (object_type);
+
+      if (!class)
+       return;
+
+      properties = g_object_interface_list_properties (class, &n_properties);
+    }
+#endif
+  else
+    return;
+
+  object_class_name = g_type_name (object_type);
+
+  child_prop = FALSE;
+  style_prop = FALSE;
+
+  while (TRUE) {
+    qsort (properties, n_properties, sizeof (GParamSpec *), compare_param_specs);
+    for (arg = 0; arg < n_properties; arg++)
+      {
+        GParamSpec *spec = properties[arg];
+        const gchar *nick, *blurb, *dot;
+
+        if (spec->owner_type != object_type)
+          continue;
+
+        pos = flags;
+        /* We use one-character flags for simplicity. */
+        if (child_prop && !style_prop)
+         *pos++ = 'c';
+        if (style_prop)
+         *pos++ = 's';
+        if (spec->flags & G_PARAM_READABLE)
+         *pos++ = 'r';
+        if (spec->flags & G_PARAM_WRITABLE)
+         *pos++ = 'w';
+        if (spec->flags & G_PARAM_CONSTRUCT)
+         *pos++ = 'x';
+        if (spec->flags & G_PARAM_CONSTRUCT_ONLY)
+         *pos++ = 'X';
+        *pos = 0;
+
+        nick = g_param_spec_get_nick (spec);
+        blurb = g_param_spec_get_blurb (spec);
+
+        dot = "";
+        if (blurb) {
+          int str_len = strlen (blurb);
+          if (str_len > 0  && blurb[str_len - 1] != '.')
+            dot = ".";
+        }
+
+       type_desc = describe_type (spec);
+       default_value = describe_default (spec);
+       type_name = get_type_name (spec->value_type, &is_pointer);
+        fprintf (fp, "<ARG>\\n<NAME>%s::%s</NAME>\\n<TYPE>%s%s</TYPE>\\n<RANGE>%s</RANGE>\\n<FLAGS>%s</FLAGS>\\n<NICK>%s</NICK>\\n<BLURB>%s%s</BLURB>\\n<DEFAULT>%s</DEFAULT>\\n</ARG>\\n\\n",
+                object_class_name, g_param_spec_get_name (spec), type_name, is_pointer ? "*" : "", type_desc, flags, nick ? nick : "(null)", blurb ? blurb : "(null)", dot, default_value);
+       g_free (type_desc);
+       g_free (default_value);
+      }
+
+    g_free (properties);
+
+#ifdef GTK_IS_CONTAINER_CLASS
+    if (!child_prop && GTK_IS_CONTAINER_CLASS (class)) {
+      properties = gtk_container_class_list_child_properties (class, &n_properties);
+      child_prop = TRUE;
+      continue;
+    }
+#endif
+
+#ifdef GTK_IS_WIDGET_CLASS
+#if GTK_CHECK_VERSION(2,1,0)
+    if (!style_prop && GTK_IS_WIDGET_CLASS (class)) {
+      properties = gtk_widget_class_list_style_properties (GTK_WIDGET_CLASS (class), &n_properties);
+      style_prop = TRUE;
+      continue;
+    }
+#endif
+#endif
+
+    break;
+  }
+}
+EOT
+
+close OUTPUT;
+
+# Compile and run our file
+
+$CC = $ENV{CC} ? $ENV{CC} : "gcc";
+$LD = $ENV{LD} ? $ENV{LD} : $CC;
+$CFLAGS = $ENV{CFLAGS} ? "$ENV{CFLAGS} -Wall -g" : "-Wall -g";
+$LDFLAGS = $ENV{LDFLAGS} ? $ENV{LDFLAGS} : "";
+
+my $o_file;
+if ($CC =~ /libtool/) {
+  $o_file  = "$MODULE-scan.lo"
+} else {
+  $o_file = "$MODULE-scan.o"
+}
+
+print "gtk-doc: Compiling scanner\n";
+$command = "$CC $CFLAGS -c -o $o_file $MODULE-scan.c";
+system($command) == 0 or die "Compilation of scanner failed: $!\n";
+
+print "gtk-doc: Linking scanner\n";
+$command = "$LD -o $MODULE-scan $o_file $LDFLAGS";
+system($command) == 0 or die "Linking of scanner failed: $!\n";
+
+print "gtk-doc: Running scanner $MODULE-scan\n";
+system("sh -c ./$MODULE-scan") == 0 or die "Scan failed: $!\n";
+
+unlink "./$MODULE-scan.c", "./$MODULE-scan.o", "./$MODULE-scan.lo", "./$MODULE-scan";
+
+#&UpdateFileIfChanged ($old_signals_filename, $new_signals_filename, 0);
+&UpdateFileIfChanged ($old_hierarchy_filename, $new_hierarchy_filename, 0);
+&UpdateFileIfChanged ($old_interfaces_filename, $new_interfaces_filename, 0);
+&UpdateFileIfChanged ($old_prerequisites_filename, $new_prerequisites_filename, 0);
+#&UpdateFileIfChanged ($old_args_filename, $new_args_filename, 0);
+
+
diff --git a/common/gtk-doc-plugins.mak b/common/gtk-doc-plugins.mak
new file mode 100755 (executable)
index 0000000..71f60ba
--- /dev/null
@@ -0,0 +1,397 @@
+# This is an include file specifically tuned for building documentation
+# for GStreamer plug-ins
+
+help:
+       @echo
+       @echo "If you are a doc maintainer, run 'make update' to update"
+       @echo "the documentation files maintained in CVS"
+       @echo
+       @echo Other useful make targets:
+       @echo
+       @echo  check-inspected-versions: make sure the inspected plugin info
+       @echo                            is up to date before a release
+       @echo
+
+# update the stuff maintained by doc maintainers
+update:
+       $(MAKE) inspect-update
+       $(MAKE) scanobj-update
+
+# We set GPATH here; this gives us semantics for GNU make
+# which are more like other make's VPATH, when it comes to
+# whether a source that is a target of one rule is then
+# searched for in VPATH/GPATH.
+#
+GPATH = $(srcdir)
+
+# thomas: make docs parallel installable
+TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@
+
+EXTRA_DIST =                           \
+       scanobj-build.stamp             \
+       $(srcdir)/inspect/*.xml         \
+       inspect.stamp                   \
+       inspect-build.stamp             \
+       $(SCANOBJ_FILES)                \
+       $(content_files)                \
+       $(extra_files)                  \
+       $(HTML_IMAGES)                  \
+       $(DOC_MAIN_SGML_FILE)   \
+       $(DOC_OVERRIDES)                \
+       $(DOC_MODULE)-sections.txt
+
+MAINTAINER_DOC_STAMPS =                        \
+       scanobj-build.stamp             \
+       inspect-build.stamp             \
+       inspect.stamp
+
+# we don't add inspect-build.stamp and scanobj-build.stamp here since they are
+# built manually by docs maintainers and result is commited to CVS
+DOC_STAMPS =                           \
+       scan-build.stamp                \
+       tmpl-build.stamp                \
+       sgml-build.stamp                \
+       html-build.stamp                \
+       scan.stamp                      \
+       tmpl.stamp                      \
+       sgml.stamp                      \
+       html.stamp
+
+# files generated/updated by gtkdoc-scangobj
+SCANOBJ_FILES =                                \
+       $(DOC_MODULE).signals           \
+        $(DOC_MODULE).hierarchy         \
+        $(DOC_MODULE).interfaces        \
+        $(DOC_MODULE).prerequisites     \
+       $(DOC_MODULE).types             \
+        $(DOC_MODULE).args
+
+SCANOBJ_FILES_O =                      \
+       .libs/$(DOC_MODULE)-scan.o
+
+# files generated/updated by gtkdoc-scan
+SCAN_FILES =                           \
+       $(DOC_MODULE)-sections.txt      \
+       $(DOC_MODULE)-overrides.txt     \
+       $(DOC_MODULE)-undocumented.txt  \
+       $(DOC_MODULE)-decl.txt          \
+       $(DOC_MODULE)-decl-list.txt
+
+
+REPORT_FILES = \
+       $(DOC_MODULE)-undocumented.txt \
+       $(DOC_MODULE)-undeclared.txt \
+       $(DOC_MODULE)-unused.txt
+
+# FC3 seems to need -scan.c to be part of CLEANFILES for distcheck
+# no idea why FC4 can do without
+CLEANFILES = \
+       $(SCANOBJ_FILES_O) \
+       $(DOC_MODULE)-scan.c \
+       $(REPORT_FILES) \
+       $(DOC_STAMPS) \
+       inspect-registry.xml
+
+
+if ENABLE_GTK_DOC
+all-local: html-build.stamp
+
+#### scan gobjects; done by documentation maintainer ####
+scanobj-update:
+       -rm scanobj-build.stamp
+       $(MAKE) scanobj-build.stamp
+
+# in the case of non-srcdir builds, the built gst directory gets added
+# to gtk-doc scanning; but only then, to avoid duplicates
+# FIXME: since we don't have the scan step as part of the build anymore,
+# we could remove that
+# TODO: finish elite script that updates the output files of this step
+# instead of rewriting them, so that multiple maintainers can generate
+# a collective set of args and signals
+scanobj-build.stamp: $(SCANOBJ_DEPS) $(basefiles)
+       @echo '*** Scanning GObjects ***'
+       if test x"$(srcdir)" != x. ; then                               \
+           for f in $(SCANOBJ_FILES);                                  \
+           do                                                          \
+               cp $(srcdir)/$$f . ;                                    \
+           done;                                                       \
+       else                                                            \
+           $(INSPECT_ENVIRONMENT)                                      \
+           CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"                         \
+           CFLAGS="-g $(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)"               \
+           $(GST_DOC_SCANOBJ) --type-init-func="gst_init(NULL,NULL)"   \
+               --module=$(DOC_MODULE) --source=$(PACKAGE) &&           \
+               $(PYTHON)                                               \
+               $(top_srcdir)/common/scangobj-merge.py $(DOC_MODULE);   \
+       fi
+       touch scanobj-build.stamp
+
+$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(SCANOBJ_FILES_O): scan-build.stamp
+       @true
+
+### inspect GStreamer plug-ins; done by documentation maintainer ###
+
+# only look at the plugins in this module when building inspect .xml stuff
+INSPECT_REGISTRY=$(top_builddir)/docs/plugins/inspect-registry.xml
+INSPECT_ENVIRONMENT=\
+        GST_PLUGIN_SYSTEM_PATH= \
+        GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/sys:$(top_builddir)/ext:$(top_builddir)/plugins:$(top_builddir)/src \
+        GST_REGISTRY=$(INSPECT_REGISTRY)
+
+# update the element and plugin XML descriptions; store in inspect/
+inspect:
+       mkdir inspect
+
+inspect-update: inspect
+       -rm $(INSPECT_REGISTRY)
+       -rm inspect-build.stamp
+       $(MAKE) inspect-build.stamp
+
+# FIXME: inspect.stamp should be written to by gst-xmlinspect.py
+# IF the output changed; see gtkdoc-mktmpl
+inspect-build.stamp:
+       @echo '*** Rebuilding plugin inspection files ***'
+       if test x"$(srcdir)" != x. ; then \
+           cp $(srcdir)/inspect.stamp . ; \
+           cp $(srcdir)/inspect-build.stamp . ; \
+       else \
+           $(INSPECT_ENVIRONMENT) $(PYTHON) \
+               $(top_srcdir)/common/gst-xmlinspect.py $(PACKAGE) inspect && \
+           echo -n "timestamp" > inspect.stamp && \
+           touch inspect-build.stamp; \
+        fi
+
+### scan headers; done on every build ###
+scan-build.stamp: $(HFILE_GLOB) $(EXTRA_HFILES) $(basefiles) scanobj-build.stamp inspect-build.stamp
+       if test "x$(top_srcdir)" != "x$(top_builddir)" &&               \
+          test -d "$(top_builddir)/gst";                               \
+        then                                                           \
+            export BUILT_OPTIONS="--source-dir=$(top_builddir)/gst";   \
+        fi;                                                            \
+       gtkdoc-scan                                                     \
+           $(SCAN_OPTIONS) $(EXTRA_HFILES)                             \
+           --module=$(DOC_MODULE)                                      \
+           $$BUILT_OPTIONS                                             \
+           --ignore-headers="$(IGNORE_HFILES)";                        \
+       touch scan-build.stamp
+
+#### update templates; done on every build ####
+
+### FIXME: make this error out again when docs are fixed for 0.9
+# in a non-srcdir build, we need to copy files from the previous step
+# and the files from previous runs of this step
+tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
+       @echo '*** Rebuilding template files ***'
+       if test x"$(srcdir)" != x. ; then                               \
+           for f in $(SCANOBJ_FILES) $(SCAN_FILES);                    \
+           do                                                          \
+               if test -e $(srcdir)/$$f; then cp $(srcdir)/$$f . ; fi; \
+           done;                                                       \
+       fi
+       gtkdoc-mktmpl --module=$(DOC_MODULE) | tee tmpl-build.log
+       $(PYTHON) \
+               $(top_srcdir)/common/mangle-tmpl.py $(srcdir)/inspect tmpl
+       @cat $(DOC_MODULE)-unused.txt
+       rm -f tmpl-build.log
+       touch tmpl-build.stamp
+
+tmpl.stamp: tmpl-build.stamp
+       @true
+
+#### build xml; done on every build ####
+
+### FIXME: make this error out again when docs are fixed for 0.9
+sgml-build.stamp: tmpl.stamp inspect.stamp $(CFILE_GLOB) $(top_srcdir)/common/plugins.xsl
+       @echo '*** Building XML ***'
+       @-mkdir -p xml
+       @for a in $(srcdir)/inspect/*.xml; do \
+            xsltproc --stringparam module $(MODULE) \
+               $(top_srcdir)/common/plugins.xsl $$a > xml/`basename $$a`; done
+       @for f in $(EXAMPLE_CFILES); do \
+               $(PYTHON) $(top_srcdir)/common/c-to-xml.py $$f > xml/element-`basename $$f .c`.xml; done
+       gtkdoc-mkdb \
+               --module=$(DOC_MODULE) \
+               --source-dir=$(DOC_SOURCE_DIR) \
+               --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) \
+               --output-format=xml \
+               --ignore-files="$(IGNORE_HFILES) $(IGNORE_CFILES)" \
+               $(MKDB_OPTIONS) \
+               | tee sgml-build.log
+       @if grep "WARNING:" sgml-build.log > /dev/null; then true; fi # exit 1; fi
+       cp ../version.entities xml
+       rm sgml-build.log
+       touch sgml-build.stamp
+
+sgml.stamp: sgml-build.stamp
+       @true
+
+#### build html; done on every step ####
+
+html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
+       @echo '*** Building HTML ***'
+       if test -d html; then rm -rf html; fi
+       mkdir html
+       cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
+       @for f in $(content_files); do cp $(srcdir)/$$f html; done
+       cp -pr xml html
+       cp ../version.entities html
+       cd html && gtkdoc-mkhtml $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) \
+           2>&1 | tee ../html-build.log
+       @if grep "warning:" html-build.log > /dev/null; then \
+               echo "ERROR"; grep "warning:" html-build.log; exit 1; fi
+       @rm html-build.log
+       mv html/index.sgml html/index.sgml.bak
+       $(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml
+       rm -f html/index.sgml.bak
+       rm -f html/$(DOC_MAIN_SGML_FILE)
+       rm -rf html/xml
+       rm -f html/version.entities
+       test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
+           if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
+       @echo '-- Fixing Crossreferences' 
+       gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+       touch html-build.stamp
+else
+all-local:
+endif
+
+# FIXME: these rules need a little cleaning up
+clean-local:
+       rm -f *~ *.bak
+       rm -rf .libs
+# clean files generated for tmpl build
+       -rm -rf tmpl
+# clean files copied/generated for nonsrcdir tmpl build
+       if test x"$(srcdir)" != x. ; then \
+           rm -rf $(SCANOBJ_FILES) $(SCAN_FILES);                      \
+       fi
+# clean files generated for xml build
+       -rm -rf xml
+# clean files generate for html build
+       -rm -rf html
+
+distclean-local: clean
+       rm -rf tmpl/*.sgml.bak
+       rm -f *.stamp || true
+       rm -rf *.o
+
+# thomas: make docs parallel installable; devhelp requires majorminor too
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) 
+       (installfiles=`echo ./html/*.html`; \
+       if test "$$installfiles" = './html/*.html'; \
+       then echo '-- Nothing to install' ; \
+       else \
+         for i in $$installfiles; do \
+           echo '-- Installing '$$i ; \
+           $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
+         done; \
+         pngfiles=`echo ./html/*.png`; \
+         if test "$$pngfiles" != './html/*.png'; then \
+           for i in $$pngfiles; do \
+             echo '-- Installing '$$i ; \
+             $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
+           done; \
+         fi; \
+         echo '-- Installing $(srcdir)/html/$(DOC_MODULE).devhelp' ; \
+         $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp \
+           $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
+         if test -e $(srcdir)/html/$(DOC_MODULE).devhelp2; then \
+                 $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp2 \
+                  $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
+         fi; \
+         echo '-- Installing $(srcdir)/html/index.sgml' ; \
+         $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
+               if test -e $(srcdir)/html/style.css; then \
+                       echo '-- Installing $(srcdir)/html/style.css' ; \
+                       $(INSTALL_DATA) $(srcdir)/html/style.css $(DESTDIR)$(TARGET_DIR); \
+               fi; \
+       fi) 
+uninstall-local:
+       (installfiles=`echo ./html/*.html`; \
+       if test "$$installfiles" = './html/*.html'; \
+       then echo '-- Nothing to uninstall' ; \
+       else \
+         for i in $$installfiles; do \
+           rmfile=`basename $$i` ; \
+           echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
+           rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
+         done; \
+         pngfiles=`echo ./html/*.png`; \
+         if test "$$pngfiles" != './html/*.png'; then \
+           for i in $$pngfiles; do \
+             rmfile=`basename $$i` ; \
+             echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
+             rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
+           done; \
+         fi; \
+         echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE).devhelp' ; \
+         rm -f $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
+         if test -e $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; then \
+           rm -f $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
+         fi; \
+         echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/index.sgml' ; \
+         rm -f $(DESTDIR)$(TARGET_DIR)/index.sgml; \
+               if test -e $(DESTDIR)$(TARGET_DIR)/style.css; then \
+                       echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/style.css' ; \
+                       rm -f $(DESTDIR)$(TARGET_DIR)/style.css; \
+               fi; \
+       fi) 
+       if test -d $(DESTDIR)$(TARGET_DIR); then rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(TARGET_DIR) 2>/dev/null; fi; true
+
+#
+# Checks
+#
+check-hierarchy: $(DOC_MODULE).hierarchy
+       @if grep '      ' $(DOC_MODULE).hierarchy; then \
+           echo "$(DOC_MODULE).hierarchy contains tabs, please fix"; \
+           /bin/false; \
+       fi
+
+check: check-hierarchy
+
+# wildcard is apparently not portable to other makes, hence the use of find
+inspect_files = $(shell find $(top_srcdir)/docs/plugins/inspect -name '*.xml')
+
+check-inspected-versions:
+       @echo Checking plugin versions of inspected plugin data ...; \
+       fail=0 ; \
+       for each in $(inspect_files) ; do \
+         if (grep -H '<version>' $$each | grep -v '<version>$(VERSION)'); then \
+           echo $$each should be fixed to say version $(VERSION) or be removed ; \
+           echo "sed -i -e 's/<version.*version>/<version>$(VERSION)<\/version>/'" $$each; \
+           echo ; \
+           fail=1; \
+         fi ; \
+       done ; \
+       exit $$fail
+
+#
+# Require gtk-doc when making dist
+#
+if ENABLE_GTK_DOC
+dist-check-gtkdoc:
+else
+dist-check-gtkdoc:
+       @echo "*** gtk-doc must be installed and enabled in order to make dist"
+       @false
+endif
+
+# FIXME: decide whether we want to dist generated html or not
+dist-hook: dist-check-gtkdoc dist-hook-local
+       mkdir $(distdir)/tmpl
+       mkdir $(distdir)/xml
+       mkdir $(distdir)/html
+       -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
+       -cp $(srcdir)/sgml/*.xml $(distdir)/xml
+       -cp $(srcdir)/html/index.sgml $(distdir)/html
+       -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
+       -cp $(srcdir)/html/$(DOC_MODULE).devhelp* $(distdir)/html
+
+       images=$(HTML_IMAGES) ;               \
+       for i in "" $$images ; do                     \
+         if test "$$i" != ""; then cp $(srcdir)/$$i $(distdir)/html ; fi; \
+       done
+
+.PHONY : dist-hook-local
+
diff --git a/common/gtk-doc.mak b/common/gtk-doc.mak
new file mode 100755 (executable)
index 0000000..1c9ece1
--- /dev/null
@@ -0,0 +1,267 @@
+###########################################################################
+# Everything below here is generic and you shouldn't need to change it.
+###########################################################################
+# thomas: except of course that we did
+
+# thomas: copied from glib-2
+# We set GPATH here; this gives us semantics for GNU make
+# which are more like other make's VPATH, when it comes to
+# whether a source that is a target of one rule is then
+# searched for in VPATH/GPATH.
+#
+GPATH = $(srcdir)
+
+# thomas: make docs parallel installable
+TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@
+
+EXTRA_DIST =                           \
+       $(content_files)                \
+       $(extra_files)                  \
+       $(HTML_IMAGES)                  \
+       $(DOC_MAIN_SGML_FILE)           \
+       $(DOC_MODULE).types             \
+       $(DOC_OVERRIDES)                \
+       $(DOC_MODULE)-sections.txt
+
+DOC_STAMPS =                           \
+       scan-build.stamp                \
+       tmpl-build.stamp                \
+       sgml-build.stamp                \
+       html-build.stamp                \
+       $(srcdir)/tmpl.stamp            \
+       $(srcdir)/sgml.stamp            \
+       $(srcdir)/html.stamp
+
+SCANOBJ_FILES =                                \
+       $(DOC_MODULE).args              \
+       $(DOC_MODULE).hierarchy         \
+       $(DOC_MODULE).interfaces        \
+       $(DOC_MODULE).prerequisites     \
+       .libs/$(DOC_MODULE)-scan.o      \
+       $(DOC_MODULE).signals
+
+REPORT_FILES = \
+       $(DOC_MODULE)-undocumented.txt \
+       $(DOC_MODULE)-undeclared.txt \
+       $(DOC_MODULE)-unused.txt
+
+CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
+
+if ENABLE_GTK_DOC
+all-local: html-build.stamp
+
+#### scan ####
+
+# in the case of non-srcdir builds, the built gst directory gets added
+# to gtk-doc scanning; but only then, to avoid duplicates
+scan-build.stamp: $(HFILE_GLOB) $(SCANOBJ_DEPS) $(basefiles)
+       @echo '*** Scanning header files ***'
+       if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null;  \
+       then                                                            \
+           if test x"$(srcdir)" != x. ; then                           \
+               cp $(srcdir)/$(DOC_MODULE).types . ;                    \
+               chmod u+w $(DOC_MODULE).types ;                         \
+           fi ;                                                        \
+           GST_PLUGIN_SYSTEM_PATH=`cd $(top_builddir) && pwd`          \
+           GST_PLUGIN_PATH=                                            \
+           CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)"                         \
+           CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)"          \
+           gtkdoc-scangobj --type-init-func="gst_init(NULL,NULL)"      \
+               --module=$(DOC_MODULE) ;                                \
+       else                                                            \
+           cd $(srcdir) ;                                              \
+           for i in $(SCANOBJ_FILES) ; do                              \
+               test -f $$i || touch $$i ;                              \
+           done                                                        \
+       fi
+       if test "x$(top_srcdir)" != "x$(top_builddir)";                 \
+        then                                                           \
+          export BUILT_OPTIONS="--source-dir=$(DOC_BUILD_DIR)";                \
+        fi;                                                            \
+       gtkdoc-scan                                                     \
+               $(SCAN_OPTIONS) $(EXTRA_HFILES)                         \
+               --module=$(DOC_MODULE)                                  \
+               --source-dir=$(DOC_SOURCE_DIR)                          \
+               $$BUILT_OPTIONS                                         \
+               --ignore-headers="$(IGNORE_HFILES)"
+       touch scan-build.stamp
+
+$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
+       @true
+
+#### templates ####
+
+tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES)
+       @echo '*** Rebuilding template files ***'
+       if test x"$(srcdir)" != x. ; then \
+           cp $(srcdir)/$(DOC_MODULE)-sections.txt . ; \
+           touch $(DOC_MODULE)-decl.txt ; \
+       fi
+       gtkdoc-mktmpl --module=$(DOC_MODULE) | tee tmpl-build.log
+       @if test -s $(DOC_MODULE)-unused.txt; then \
+           exit $(if $(DOCS_ARE_INCOMPLETE_PLEASE_FIXME),0,1); fi
+       rm -f tmpl-build.log
+       touch tmpl-build.stamp
+
+tmpl.stamp: tmpl-build.stamp
+       @true
+
+#### xml ####
+
+### FIXME: make this error out again when docs are complete
+sgml-build.stamp: tmpl.stamp $(CFILE_GLOB)
+       @echo '*** Building XML ***'
+       gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --main-sgml-file=$(srcdir)/$(DOC_MAIN_SGML_FILE) --output-format=xml $(MKDB_OPTIONS) | tee sgml-build.log
+       @if grep "WARNING:" sgml-build.log > /dev/null; then true; fi # exit 1; fi
+       rm sgml-build.log
+       touch sgml-build.stamp
+
+sgml.stamp: sgml-build.stamp
+       @true
+
+#### html ####
+
+html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
+       @echo '*** Building HTML ***'
+       if test -d html; then rm -rf html; fi
+       mkdir html
+       cp $(srcdir)/$(DOC_MAIN_SGML_FILE) html
+       @for f in $(content_files); do cp $(srcdir)/$$f html; done
+       cp -pr xml html
+       cp ../version.entities html
+       cd html && gtkdoc-mkhtml $(DOC_MODULE) $(DOC_MAIN_SGML_FILE)
+       mv html/index.sgml html/index.sgml.bak
+       $(SED) "s/ href=\"$(DOC_MODULE)\// href=\"$(DOC_MODULE)-@GST_MAJORMINOR@\//g" html/index.sgml.bak >html/index.sgml
+       rm -f html/index.sgml.bak
+       rm -f html/$(DOC_MAIN_SGML_FILE)
+       rm -rf html/xml
+       rm -f html/version.entities
+       test "x$(HTML_IMAGES)" = "x" || for i in "" $(HTML_IMAGES) ; do \
+           if test "$$i" != ""; then cp $(srcdir)/$$i html ; fi; done
+       @echo '-- Fixing Crossreferences' 
+       gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+       touch html-build.stamp
+else
+all-local:
+endif
+
+clean-local:
+       rm -f *~ *.bak
+       rm -rf xml html
+       rm -rf .libs
+
+maintainer-clean-local: clean
+       cd $(srcdir) && rm -rf xml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+
+# company: don't delete .sgml and -sections.txt as they're in CVS
+# FIXME : thomas added all sgml files and some other things to make
+# make distcheck work
+distclean-local: clean
+       rm -f $(DOC_MODULE)-decl-list.txt
+       rm -f $(DOC_MODULE)-decl.txt
+       rm -f $(REPORT_FILES)
+       rm -rf tmpl/*.sgml.bak
+       rm -f $(DOC_MODULE).hierarchy
+       rm -f *.stamp || true
+       if test x"$(srcdir)" != x. ; then \
+           rm -f $(DOC_MODULE)-docs.sgml ; \
+           rm -f $(DOC_MODULE).types ; \
+           rm -f $(DOC_MODULE).interfaces ; \
+            rm -f $(DOC_MODULE)-overrides.txt ; \
+           rm -f $(DOC_MODULE).prerequisites ; \
+           rm -f $(DOC_MODULE)-sections.txt ; \
+           rm -rf tmpl/*.sgml ; \
+       fi
+       rm -rf *.o
+
+# thomas: make docs parallel installable; devhelp requires majorminor too
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) 
+       (installfiles=`echo ./html/*.html`; \
+       if test "$$installfiles" = './html/*.html'; \
+       then echo '-- Nothing to install' ; \
+       else \
+         for i in $$installfiles; do \
+           echo '-- Installing '$$i ; \
+           $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
+         done; \
+         pngfiles=`echo ./html/*.png`; \
+         if test "$$pngfiles" != './html/*.png'; then \
+           for i in $$pngfiles; do \
+             echo '-- Installing '$$i ; \
+             $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
+           done; \
+         fi; \
+         echo '-- Installing $(srcdir)/html/$(DOC_MODULE).devhelp' ; \
+         $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp \
+           $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
+         if test -e $(srcdir)/html/$(DOC_MODULE).devhelp2; then \
+                 $(INSTALL_DATA) $(srcdir)/html/$(DOC_MODULE).devhelp2 \
+                  $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
+         fi; \
+         echo '-- Installing $(srcdir)/html/index.sgml' ; \
+         $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
+               if test -e $(srcdir)/html/style.css; then \
+                       echo '-- Installing $(srcdir)/html/style.css' ; \
+                       $(INSTALL_DATA) $(srcdir)/html/style.css $(DESTDIR)$(TARGET_DIR); \
+               fi; \
+       fi) 
+uninstall-local:
+       (installfiles=`echo ./html/*.html`; \
+       if test "$$installfiles" = './html/*.html'; \
+       then echo '-- Nothing to uninstall' ; \
+       else \
+         for i in $$installfiles; do \
+           rmfile=`basename $$i` ; \
+           echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
+           rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
+         done; \
+         pngfiles=`echo ./html/*.png`; \
+         if test "$$pngfiles" != './html/*.png'; then \
+           for i in $$pngfiles; do \
+             rmfile=`basename $$i` ; \
+             echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/'$$rmfile ; \
+             rm -f $(DESTDIR)$(TARGET_DIR)/$$rmfile; \
+           done; \
+         fi; \
+         echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE).devhelp' ; \
+         rm -f $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp; \
+         if test -e $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; then \
+           rm -f $(DESTDIR)$(TARGET_DIR)/$(DOC_MODULE)-@GST_MAJORMINOR@.devhelp2; \
+         fi; \
+         echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/index.sgml' ; \
+         rm -f $(DESTDIR)$(TARGET_DIR)/index.sgml; \
+               if test -e $(DESTDIR)$(TARGET_DIR)/style.css; then \
+                       echo '-- Uninstalling $(DESTDIR)$(TARGET_DIR)/style.css' ; \
+                       rm -f $(DESTDIR)$(TARGET_DIR)/style.css; \
+               fi; \
+       fi) 
+       if test -d $(DESTDIR)$(TARGET_DIR); then rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(TARGET_DIR) 2>/dev/null; fi; true
+
+#
+# Require gtk-doc when making dist
+#
+if ENABLE_GTK_DOC
+dist-check-gtkdoc:
+else
+dist-check-gtkdoc:
+       @echo "*** gtk-doc must be installed and enabled in order to make dist"
+       @false
+endif
+
+dist-hook: dist-check-gtkdoc dist-hook-local
+       mkdir $(distdir)/tmpl
+       mkdir $(distdir)/xml
+       mkdir $(distdir)/html
+       -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
+       -cp $(srcdir)/sgml/*.xml $(distdir)/xml
+       -cp $(srcdir)/html/index.sgml $(distdir)/html
+       -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
+       -cp $(srcdir)/html/$(DOC_MODULE).devhelp* $(distdir)/html
+
+       images=$(HTML_IMAGES) ;               \
+       for i in "" $$images ; do                     \
+         if test "$$i" != ""; then cp $(srcdir)/$$i $(distdir)/html ; fi; \
+       done
+
+.PHONY : dist-hook-local
diff --git a/common/m4/Makefile.am b/common/m4/Makefile.am
new file mode 100644 (file)
index 0000000..99ead5c
--- /dev/null
@@ -0,0 +1,29 @@
+EXTRA_DIST = \
+       README \
+       as-ac-expand.m4 \
+       as-auto-alt.m4 \
+       as-compiler-flag.m4 \
+       as-compiler.m4 \
+       as-docbook.m4 \
+       as-gcc-inline-assembly.m4 \
+       as-libtool.m4 \
+       as-libtool-tags.m4 \
+       as-python.m4 \
+       as-scrub-include.m4 \
+       as-version.m4 \
+       ax_create_stdint_h.m4 \
+       glib-gettext.m4 \
+       gst-arch.m4 \
+       gst-args.m4 \
+       gst-check.m4 \
+       gst-debuginfo.m4 \
+       gst-default.m4 \
+       gst-doc.m4 \
+       gst-feature.m4 \
+       gst-function.m4 \
+       gst-gettext.m4 \
+       gst-glib2.m4 \
+       gst-libxml2.m4 \
+       gst-plugindir.m4 \
+       gst-valgrind.m4 \
+       pkg.m4
diff --git a/common/m4/README b/common/m4/README
new file mode 100755 (executable)
index 0000000..f044598
--- /dev/null
@@ -0,0 +1,3 @@
+All aclocal .m4 files we need are put here and cat'd to acinclude.m4 in 
+the source root.  Official ones (taken from the relevant devel packages) 
+are named as-is, unofficial ones (or changed ones) get a gst-prefix.
diff --git a/common/m4/as-ac-expand.m4 b/common/m4/as-ac-expand.m4
new file mode 100755 (executable)
index 0000000..d6c9e33
--- /dev/null
@@ -0,0 +1,43 @@
+dnl as-ac-expand.m4 0.2.0
+dnl autostars m4 macro for expanding directories using configure's prefix
+dnl thomas@apestaart.org
+
+dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
+dnl example
+dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
+dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
+
+AC_DEFUN([AS_AC_EXPAND],
+[
+  EXP_VAR=[$1]
+  FROM_VAR=[$2]
+
+  dnl first expand prefix and exec_prefix if necessary
+  prefix_save=$prefix
+  exec_prefix_save=$exec_prefix
+
+  dnl if no prefix given, then use /usr/local, the default prefix
+  if test "x$prefix" = "xNONE"; then
+    prefix="$ac_default_prefix"
+  fi
+  dnl if no exec_prefix given, then use prefix
+  if test "x$exec_prefix" = "xNONE"; then
+    exec_prefix=$prefix
+  fi
+
+  full_var="$FROM_VAR"
+  dnl loop until it doesn't change anymore
+  while true; do
+    new_full_var="`eval echo $full_var`"
+    if test "x$new_full_var" = "x$full_var"; then break; fi
+    full_var=$new_full_var
+  done
+
+  dnl clean up
+  full_var=$new_full_var
+  AC_SUBST([$1], "$full_var")
+
+  dnl restore prefix and exec_prefix
+  prefix=$prefix_save
+  exec_prefix=$exec_prefix_save
+])
diff --git a/common/m4/as-auto-alt.m4 b/common/m4/as-auto-alt.m4
new file mode 100755 (executable)
index 0000000..3f7920d
--- /dev/null
@@ -0,0 +1,50 @@
+dnl as-auto-alt.m4 0.0.2
+dnl autostars m4 macro for supplying alternate autotools versions to configure
+dnl thomas@apestaart.org
+dnl
+dnl AS_AUTOTOOLS_ALTERNATE()
+dnl
+dnl supplies --with arguments for autoconf, autoheader, automake, aclocal
+
+AC_DEFUN([AS_AUTOTOOLS_ALTERNATE],
+[
+  dnl allow for different autoconf version
+  AC_ARG_WITH(autoconf,
+    AC_HELP_STRING([--with-autoconf],
+                   [use a different autoconf for regeneration of Makefiles]),
+    [
+      unset AUTOCONF
+      AM_MISSING_PROG(AUTOCONF, ${withval})
+      AC_MSG_NOTICE([Using $AUTOCONF as autoconf])
+    ])
+
+  dnl allow for different autoheader version
+  AC_ARG_WITH(autoheader,
+    AC_HELP_STRING([--with-autoheader],
+                   [use a different autoheader for regeneration of Makefiles]),
+    [
+      unset AUTOHEADER
+      AM_MISSING_PROG(AUTOHEADER, ${withval})
+      AC_MSG_NOTICE([Using $AUTOHEADER as autoheader])
+    ])
+
+  dnl allow for different automake version
+  AC_ARG_WITH(automake,
+    AC_HELP_STRING([--with-automake],
+                   [use a different automake for regeneration of Makefiles]),
+    [
+      unset AUTOMAKE
+      AM_MISSING_PROG(AUTOMAKE, ${withval})
+      AC_MSG_NOTICE([Using $AUTOMAKE as automake])
+    ])
+
+  dnl allow for different aclocal version
+  AC_ARG_WITH(aclocal,
+    AC_HELP_STRING([--with-aclocal],
+                   [use a different aclocal for regeneration of Makefiles]),
+    [
+      unset ACLOCAL
+      AM_MISSING_PROG(ACLOCAL, ${withval})
+      AC_MSG_NOTICE([Using $ACLOCAL as aclocal])
+    ])
+])
diff --git a/common/m4/as-compiler-flag.m4 b/common/m4/as-compiler-flag.m4
new file mode 100755 (executable)
index 0000000..882a4c7
--- /dev/null
@@ -0,0 +1,64 @@
+dnl as-compiler-flag.m4 0.1.0
+
+dnl autostars m4 macro for detection of compiler flags
+
+dnl David Schleef <ds@schleef.org>
+dnl Tim-Philipp Müller <tim centricular net>
+
+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 --git a/common/m4/as-compiler.m4 b/common/m4/as-compiler.m4
new file mode 100755 (executable)
index 0000000..233a719
--- /dev/null
@@ -0,0 +1,44 @@
+dnl as-compiler.m4 0.1.0
+                                                                                
+dnl autostars m4 macro for detection of compiler flavor
+
+dnl Thomas Vander Stichele <thomas at apestaart dot org>
+
+dnl $Id: as-compiler.m4,v 1.4 2004/06/01 09:33:45 thomasvs Exp $
+                                                                                
+dnl AS_COMPILER(COMPILER)
+dnl will set variable COMPILER to
+dnl - gcc
+dnl - forte
+dnl - (empty) if no guess could be made
+
+AC_DEFUN([AS_COMPILER],
+[
+  as_compiler=
+  AC_MSG_CHECKING(for compiler flavour)
+
+  dnl is it gcc ?
+  if test "x$GCC" = "xyes"; then
+    as_compiler="gcc"
+  fi
+
+  dnl is it forte ?
+  AC_TRY_RUN([
+int main
+(int argc, char *argv[])
+{
+#ifdef __sun
+  return 0;
+#else
+  return 1;
+#endif
+}
+  ], as_compiler="forte", ,)
+
+  if test "x$as_compiler" = "x"; then
+    AC_MSG_RESULT([unknown !])
+  else
+    AC_MSG_RESULT($as_compiler)
+  fi
+  [$1]=$as_compiler
+])
diff --git a/common/m4/as-docbook.m4 b/common/m4/as-docbook.m4
new file mode 100755 (executable)
index 0000000..8a1b32a
--- /dev/null
@@ -0,0 +1,66 @@
+dnl AS_DOCBOOK([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl checks if xsltproc can build docbook documentation
+dnl (which is possible if the catalog is set up properly
+dnl I also tried checking for a specific version and type of docbook
+dnl but xsltproc seemed to happily run anyway, so we can't check for that
+dnl and version
+dnl this macro takes inspiration from
+dnl http://www.movement.uklinux.net/docs/docbook-autotools/configure.html
+AC_DEFUN([AS_DOCBOOK],
+[
+  XSLTPROC_FLAGS=--nonet
+  DOCBOOK_ROOT=
+  TYPE_LC=xml
+  TYPE_UC=XML
+  DOCBOOK_VERSION=4.1.2
+
+  if test ! -f /etc/xml/catalog; then
+    for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/ /usr/local/share/xsl/docbook ;
+    do
+      if test -d "$i"; then
+        DOCBOOK_ROOT=$i
+      fi
+    done
+  else
+    XML_CATALOG=/etc/xml/catalog
+    CAT_ENTRY_START='<!--'
+    CAT_ENTRY_END='-->'
+  fi
+
+  dnl We need xsltproc to process the test
+  AC_CHECK_PROG(XSLTPROC,xsltproc,xsltproc,)
+  XSLTPROC_WORKS=no
+  if test -n "$XSLTPROC"; then
+    AC_MSG_CHECKING([whether xsltproc docbook processing works])
+
+    if test -n "$XML_CATALOG"; then
+      DB_FILE="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
+    else
+      DB_FILE="$DOCBOOK_ROOT/xhtml/docbook.xsl"
+    fi
+    $XSLTPROC $XSLTPROC_FLAGS $DB_FILE >/dev/null 2>&1 << END
+<?xml version="1.0" encoding='ISO-8859-1'?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook $TYPE_UC V$DOCBOOK_VERSION//EN" "http://www.oasis-open.org/docbook/$TYPE_LC/$DOCBOOK_VERSION/docbookx.dtd">
+<book id="test">
+</book>
+END
+    if test "$?" = 0; then
+      XSLTPROC_WORKS=yes
+    fi
+    AC_MSG_RESULT($XSLTPROC_WORKS)
+  fi
+
+  if test "x$XSLTPROC_WORKS" = "xyes"; then
+    dnl execute ACTION-IF-FOUND
+    ifelse([$1], , :, [$1])
+  else
+    dnl execute ACTION-IF-NOT-FOUND
+    ifelse([$2], , :, [$2])
+  fi
+
+  AC_SUBST(XML_CATALOG)
+  AC_SUBST(XSLTPROC_FLAGS)
+  AC_SUBST(DOCBOOK_ROOT)
+  AC_SUBST(CAT_ENTRY_START)
+  AC_SUBST(CAT_ENTRY_END)
+])
diff --git a/common/m4/as-gcc-inline-assembly.m4 b/common/m4/as-gcc-inline-assembly.m4
new file mode 100755 (executable)
index 0000000..799e80e
--- /dev/null
@@ -0,0 +1,52 @@
+dnl as-gcc-inline-assembly.m4 0.1.0
+
+dnl autostars m4 macro for detection of gcc inline assembly
+
+dnl David Schleef <ds@schleef.org>
+
+dnl $Id: as-gcc-inline-assembly.m4,v 1.1 2008-02-26 09:38:00 thaytan Exp $
+
+dnl AS_COMPILER_FLAG(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_GCC_INLINE_ASSEMBLY],
+[
+  AC_MSG_CHECKING([if compiler supports gcc-style inline assembly])
+
+  AC_TRY_COMPILE([], [
+#ifdef __GNUC_MINOR__
+#if (__GNUC__ * 1000 + __GNUC_MINOR__) < 3004
+#error GCC before 3.4 has critical bugs compiling inline assembly
+#endif
+#endif
+__asm__ (""::) ], [flag_ok=yes], [flag_ok=no])
+
+  if test "X$flag_ok" = Xyes ; then
+    $1
+    true
+  else
+    $2
+    true
+  fi
+  AC_MSG_RESULT([$flag_ok])
+])
+
+
+AC_DEFUN([AS_GCC_ASM_POWERPC_FPU],
+[
+  AC_MSG_CHECKING([if compiler supports FPU instructions on PowerPC])
+
+  AC_TRY_COMPILE([], [__asm__ ("fadd 0,0,0"::) ], [flag_ok=yes], [flag_ok=no])
+
+  if test "X$flag_ok" = Xyes ; then
+    $1
+    true
+  else
+    $2
+    true
+  fi
+  AC_MSG_RESULT([$flag_ok])
+])
+
diff --git a/common/m4/as-libtool-tags.m4 b/common/m4/as-libtool-tags.m4
new file mode 100755 (executable)
index 0000000..c522ff2
--- /dev/null
@@ -0,0 +1,83 @@
+dnl as-libtool-tags.m4 0.1.4
+
+dnl autostars m4 macro for selecting libtool "tags" (languages)
+
+dnl Andy Wingo does not claim credit for this macro
+dnl backported from libtool 1.6 by Paolo Bonzini
+dnl see http://lists.gnu.org/archive/html/libtool/2003-12/msg00007.html
+
+dnl $Id: as-libtool-tags.m4,v 1.3 2006-04-01 15:30:56 thomasvs Exp $
+
+dnl AS_LIBTOOL_TAGS([tags...])
+
+dnl example
+dnl AS_LIBTOOL_TAGS([]) for only C (no fortran, etc)
+
+dnl When AC_LIBTOOL_TAGS is used, I redefine _LT_AC_TAGCONFIG
+dnl to be more similar to the libtool 1.6 implementation, which
+dnl uses an m4 loop and m4 case instead of a shell loop.  This
+dnl way the CXX/GCJ/F77/RC tests are not always expanded.
+
+dnl AS_LIBTOOL_TAGS
+dnl ---------------
+dnl tags to enable
+AC_DEFUN([AS_LIBTOOL_TAGS],
+[m4_define([_LT_TAGS],[$1])
+m4_define([_LT_AC_TAGCONFIG], [
+  # redefined LT AC TAGCONFIG
+  if test -f "$ltmain"; then
+    if test ! -f "${ofile}"; then
+      AC_MSG_WARN([output file `$ofile' does not exist])
+    fi
+
+    if test -z "$LTCC"; then
+      eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+      if test -z "$LTCC"; then
+        AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+      else
+        AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+      fi
+    fi
+
+    AC_FOREACH([_LT_TAG], _LT_TAGS,
+      echo THOMAS: tag _LT_TAG
+      [m4_case(_LT_TAG,
+      [CXX], [
+    if test -n "$CXX" && test "X$CXX" != "Xno"; then
+      echo "THOMAS: YAY CXX"
+      AC_LIBTOOL_LANG_CXX_CONFIG
+      available_tags="$available_tags _LT_TAG"
+    fi],
+      [F77], [
+    if test -n "$F77" && test "X$F77" != "Xno"; then
+      AC_LIBTOOL_LANG_F77_CONFIG
+      available_tags="$available_tags _LT_TAG"
+    fi],
+      [GCJ], [
+    if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+      AC_LIBTOOL_LANG_GCJ_CONFIG
+      available_tags="$available_tags _LT_TAG"
+    fi],
+      [RC], [
+    if test -n "$RC" && test "X$RC" != "Xno"; then
+      AC_LIBTOOL_LANG_RC_CONFIG
+      available_tags="$available_tags _LT_TAG"
+    fi],
+      [m4_errprintn(m4_location[: error: invalid tag name: ]"_LT_TAG")
+      m4_exit(1)])
+    ])
+    echo THOMAS: available tags: $available_tags
+  fi
+  # Now substitute the updated list of available tags.
+  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+    mv "${ofile}T" "$ofile"
+    chmod +x "$ofile"
+    AC_MSG_NOTICE([updated available libtool tags with $available_tags.])
+  else
+    rm -f "${ofile}T"
+    AC_MSG_ERROR([unable to update list of available tagged configurations.])
+
+  fi
+
+])dnl _LT_AC_TAG_CONFIG
+])
diff --git a/common/m4/as-libtool.m4 b/common/m4/as-libtool.m4
new file mode 100755 (executable)
index 0000000..73dec1f
--- /dev/null
@@ -0,0 +1,45 @@
+dnl as-libtool.m4 0.1.4
+
+dnl autostars m4 macro for libtool versioning
+
+dnl Thomas Vander Stichele <thomas at apestaart dot org>
+
+dnl $Id: as-libtool.m4,v 1.6 2004/06/01 10:04:44 thomasvs Exp $
+
+dnl AS_LIBTOOL(PREFIX, CURRENT, REVISION, AGE, [RELEASE])
+
+dnl example
+dnl AS_LIBTOOL(GST, 2, 0, 0)
+
+dnl this macro
+dnl - defines [$PREFIX]_CURRENT, REVISION and AGE
+dnl - defines [$PREFIX]_LIBVERSION
+dnl - defines [$PREFIX]_LT_LDFLAGS to set versioning
+dnl - AC_SUBST's them all
+
+dnl if RELEASE is given, then add a -release option to the LDFLAGS
+dnl with the given release version
+dnl then use [$PREFIX]_LT_LDFLAGS in the relevant Makefile.am's
+
+dnl call AM_PROG_LIBTOOL after this call
+
+AC_DEFUN([AS_LIBTOOL],
+[
+  [$1]_CURRENT=[$2]
+  [$1]_REVISION=[$3]
+  [$1]_AGE=[$4]
+  [$1]_LIBVERSION=[$2]:[$3]:[$4]
+  AC_SUBST([$1]_CURRENT)
+  AC_SUBST([$1]_REVISION)
+  AC_SUBST([$1]_AGE)
+  AC_SUBST([$1]_LIBVERSION)
+
+  [$1]_LT_LDFLAGS="$[$1]_LT_LDFLAGS -version-info $[$1]_LIBVERSION"
+  if test ! -z "[$5]"
+  then
+    [$1]_LT_LDFLAGS="$[$1]_LT_LDFLAGS -release [$5]"
+  fi
+  AC_SUBST([$1]_LT_LDFLAGS)
+
+  AC_LIBTOOL_DLOPEN
+])
diff --git a/common/m4/as-python.m4 b/common/m4/as-python.m4
new file mode 100755 (executable)
index 0000000..eb9b175
--- /dev/null
@@ -0,0 +1,152 @@
+## ------------------------
+## Python file handling
+## From Andrew Dalke
+## Updated by James Henstridge
+## Updated by Andy Wingo to loop through possible pythons
+## ------------------------
+
+# AS_PATH_PYTHON([MINIMUM-VERSION])
+
+# Adds support for distributing Python modules and packages.  To
+# install modules, copy them to $(pythondir), using the python_PYTHON
+# automake variable.  To install a package with the same name as the
+# automake package, install to $(pkgpythondir), or use the
+# pkgpython_PYTHON automake variable.
+
+# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
+# locations to install python extension modules (shared libraries).
+# Another macro is required to find the appropriate flags to compile
+# extension modules.
+
+# If your package is configured with a different prefix to python,
+# users will have to add the install directory to the PYTHONPATH
+# environment variable, or create a .pth file (see the python
+# documentation for details).
+
+# If the MINIMUM-VERSION argument is passed, AS_PATH_PYTHON will
+# cause an error if the version of python installed on the system
+# doesn't meet the requirement.  MINIMUM-VERSION should consist of
+# numbers and dots only.
+
+# Updated to loop over all possible python binaries by Andy Wingo
+# <wingo@pobox.com>
+# Updated to only warn and unset PYTHON if no good one is found
+
+AC_DEFUN([AS_PATH_PYTHON],
+ [
+  dnl Find a version of Python.  I could check for python versions 1.4
+  dnl or earlier, but the default installation locations changed from
+  dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
+  dnl in 1.5, and I don't want to maintain that logic.
+
+  dnl should we do the version check?
+  PYTHON_CANDIDATES="python python2.2 python2.1 python2.0 python2 \
+                     python1.6 python1.5"
+  ifelse([$1],[],
+         [AC_PATH_PROG(PYTHON, $PYTHON_CANDIDATES)],
+         [
+     AC_MSG_NOTICE(Looking for Python version >= $1)
+    changequote(<<, >>)dnl
+    prog="
+import sys, string
+minver = '$1'
+# split string by '.' and convert to numeric
+minver_info = map(string.atoi, string.split(minver, '.'))
+# we can now do comparisons on the two lists:
+if sys.version_info >= tuple(minver_info):
+       sys.exit(0)
+else:
+       sys.exit(1)"
+    changequote([, ])dnl
+
+    python_good=false
+    for python_candidate in $PYTHON_CANDIDATES; do
+      unset PYTHON
+      AC_PATH_PROG(PYTHON, $python_candidate) 1> /dev/null 2> /dev/null
+
+      if test "x$PYTHON" = "x"; then continue; fi
+
+      if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC; then
+        AC_MSG_CHECKING(["$PYTHON":])
+       AC_MSG_RESULT([okay])
+        python_good=true
+        break;
+      else
+        dnl clear the cache val
+        unset ac_cv_path_PYTHON
+      fi
+    done
+  ])
+
+  if test "$python_good" != "true"; then
+    AC_MSG_WARN([No suitable version of python found])
+    PYTHON=
+  else
+
+  AC_MSG_CHECKING([local Python configuration])
+
+  dnl Query Python for its version number.  Getting [:3] seems to be
+  dnl the best way to do this; it's what "site.py" does in the standard
+  dnl library.  Need to change quote character because of [:3]
+
+  AC_SUBST(PYTHON_VERSION)
+  changequote(<<, >>)dnl
+  PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
+  changequote([, ])dnl
+
+
+  dnl Use the values of $prefix and $exec_prefix for the corresponding
+  dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX.  These are made
+  dnl distinct variables so they can be overridden if need be.  However,
+  dnl general consensus is that you shouldn't need this ability.
+
+  AC_SUBST(PYTHON_PREFIX)
+  PYTHON_PREFIX='${prefix}'
+
+  AC_SUBST(PYTHON_EXEC_PREFIX)
+  PYTHON_EXEC_PREFIX='${exec_prefix}'
+
+  dnl At times (like when building shared libraries) you may want
+  dnl to know which OS platform Python thinks this is.
+
+  AC_SUBST(PYTHON_PLATFORM)
+  PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
+
+
+  dnl Set up 4 directories:
+
+  dnl pythondir -- where to install python scripts.  This is the
+  dnl   site-packages directory, not the python standard library
+  dnl   directory like in previous automake betas.  This behaviour
+  dnl   is more consistent with lispdir.m4 for example.
+  dnl
+  dnl Also, if the package prefix isn't the same as python's prefix,
+  dnl then the old $(pythondir) was pretty useless.
+
+  AC_SUBST(pythondir)
+  pythondir=$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
+
+  dnl pkgpythondir -- $PACKAGE directory under pythondir.  Was
+  dnl   PYTHON_SITE_PACKAGE in previous betas, but this naming is
+  dnl   more consistent with the rest of automake.
+  dnl   Maybe this should be put in python.am?
+
+  AC_SUBST(pkgpythondir)
+  pkgpythondir=\${pythondir}/$PACKAGE
+
+  dnl pyexecdir -- directory for installing python extension modules
+  dnl   (shared libraries)  Was PYTHON_SITE_EXEC in previous betas.
+
+  AC_SUBST(pyexecdir)
+  pyexecdir=$PYTHON_EXEC_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
+
+  dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
+  dnl   Maybe this should be put in python.am?
+
+  AC_SUBST(pkgpyexecdir)
+  pkgpyexecdir=\${pyexecdir}/$PACKAGE
+
+  AC_MSG_RESULT([looks good])
+
+  fi
+])
diff --git a/common/m4/as-scrub-include.m4 b/common/m4/as-scrub-include.m4
new file mode 100755 (executable)
index 0000000..96dfb8f
--- /dev/null
@@ -0,0 +1,36 @@
+dnl as-scrub-include.m4 0.0.4
+
+dnl autostars m4 macro for scrubbing CFLAGS of system include dirs
+dnl because gcc 3.x complains about including system including dirs
+
+dnl Thomas Vander Stichele <thomas at apestaart dot org>
+
+dnl $Id: as-scrub-include.m4,v 1.5 2004/06/12 08:19:09 thomasvs Exp $
+
+dnl This macro uses output of cpp -v and expects it to contain text that 
+dnl looks a little bit like this:
+dnl #include <...> search starts here:
+dnl  /usr/local/include
+dnl  /usr/lib/gcc-lib/i386-redhat-linux/3.2/include
+dnl  /usr/include
+dnl End of search list.
+
+dnl AS_SCRUB_INCLUDE(VAR)
+dnl example
+dnl AS_SCRUB_INCLUDE(CFLAGS)
+dnl will remove all system include dirs from the given CFLAGS
+
+AC_DEFUN([AS_SCRUB_INCLUDE],
+[
+  GIVEN_CFLAGS=$[$1]
+  INCLUDE_DIRS=`echo | cpp -v 2>&1`
+
+  dnl remove everything from this output between the "starts here" and "End of"
+  dnl line
+  INCLUDE_DIRS=`echo $INCLUDE_DIRS | sed -e 's/.*<...> search starts here://' | sed -e 's/End of search list.*//'`
+  for dir in $INCLUDE_DIRS; do
+    dnl use "" as the sed script so $dir gets expanded
+    GIVEN_CFLAGS=`echo $GIVEN_CFLAGS | sed -e "s#-I$dir ##"`
+  done
+  [$1]=$GIVEN_CFLAGS
+])
diff --git a/common/m4/as-version.m4 b/common/m4/as-version.m4
new file mode 100755 (executable)
index 0000000..a5b4399
--- /dev/null
@@ -0,0 +1,71 @@
+dnl as-version.m4 0.2.0
+
+dnl autostars m4 macro for versioning
+
+dnl Thomas Vander Stichele <thomas at apestaart dot org>
+
+dnl $Id: as-version.m4,v 1.4 2004/06/01 09:40:05 thomasvs Exp $
+
+dnl AS_VERSION
+
+dnl example
+dnl AS_VERSION
+
+dnl this macro
+dnl - AC_SUBST's PACKAGE_VERSION_MAJOR, _MINOR, _MICRO
+dnl - AC_SUBST's PACKAGE_VERSION_RELEASE,
+dnl    which can be used for rpm release fields
+dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents
+dnl   maintainer mode from running correctly
+dnl
+dnl don't forget to put #undef PACKAGE_VERSION_RELEASE in acconfig.h
+dnl if you use acconfig.h
+
+AC_DEFUN([AS_VERSION],
+[
+  PACKAGE_VERSION_MAJOR=$(echo AC_PACKAGE_VERSION | cut -d'.' -f1)
+  PACKAGE_VERSION_MINOR=$(echo AC_PACKAGE_VERSION | cut -d'.' -f2)
+  PACKAGE_VERSION_MICRO=$(echo AC_PACKAGE_VERSION | cut -d'.' -f3)
+
+  AC_SUBST(PACKAGE_VERSION_MAJOR)
+  AC_SUBST(PACKAGE_VERSION_MINOR)
+  AC_SUBST(PACKAGE_VERSION_MICRO)
+])
+
+dnl AS_NANO(ACTION-IF-NO-NANO, [ACTION-IF-NANO])
+
+dnl requires AC_INIT to be called before
+dnl For projects using a fourth or nano number in your versioning to indicate
+dnl development or prerelease snapshots, this macro allows the build to be
+dnl set up differently accordingly.
+
+dnl this macro:
+dnl - parses AC_PACKAGE_VERSION, set by AC_INIT, and extracts the nano number
+dnl - sets the variable PACKAGE_VERSION_NANO
+dnl - sets the variable PACKAGE_VERSION_RELEASE, which can be used
+dnl   for rpm release fields
+dnl - executes ACTION-IF-NO-NANO or ACTION-IF-NANO
+    
+dnl example:
+dnl AS_NANO(RELEASE="yes", RELEASE="no")
+
+AC_DEFUN([AS_NANO],
+[
+  AC_MSG_CHECKING(nano version)
+
+  NANO=$(echo AC_PACKAGE_VERSION | cut -d'.' -f4)
+
+  if test x"$NANO" = x || test "x$NANO" = "x0" ; then
+    AC_MSG_RESULT([0 (release)])
+    NANO=0
+    PACKAGE_VERSION_RELEASE=1
+    ifelse([$1], , :, [$1])
+  else
+    AC_MSG_RESULT($NANO)
+    PACKAGE_VERSION_RELEASE=0.`date +%Y%m%d.%H%M%S`
+    ifelse([$2], , :, [$2])
+  fi
+  PACKAGE_VERSION_NANO=$NANO
+  AC_SUBST(PACKAGE_VERSION_NANO)
+  AC_SUBST(PACKAGE_VERSION_RELEASE)
+])
diff --git a/common/m4/ax_create_stdint_h.m4 b/common/m4/ax_create_stdint_h.m4
new file mode 100755 (executable)
index 0000000..13bf699
--- /dev/null
@@ -0,0 +1,734 @@
+##### http://autoconf-archive.cryp.to/ax_create_stdint_h.html
+#
+# SYNOPSIS
+#
+#   AX_CREATE_STDINT_H [( HEADER-TO-GENERATE [, HEDERS-TO-CHECK])]
+#
+# DESCRIPTION
+#
+#   the "ISO C9X: 7.18 Integer types <stdint.h>" section requires the
+#   existence of an include file <stdint.h> that defines a set of
+#   typedefs, especially uint8_t,int32_t,uintptr_t. Many older
+#   installations will not provide this file, but some will have the
+#   very same definitions in <inttypes.h>. In other enviroments we can
+#   use the inet-types in <sys/types.h> which would define the typedefs
+#   int8_t and u_int8_t respectivly.
+#
+#   This macros will create a local "_stdint.h" or the headerfile given
+#   as an argument. In many cases that file will just "#include
+#   <stdint.h>" or "#include <inttypes.h>", while in other environments
+#   it will provide the set of basic 'stdint's definitions/typedefs:
+#
+#     int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,intptr_t,uintptr_t
+#     int_least32_t.. int_fast32_t.. intmax_t
+#
+#   which may or may not rely on the definitions of other files, or
+#   using the AC_CHECK_SIZEOF macro to determine the actual sizeof each
+#   type.
+#
+#   if your header files require the stdint-types you will want to
+#   create an installable file mylib-int.h that all your other
+#   installable header may include. So if you have a library package
+#   named "mylib", just use
+#
+#        AX_CREATE_STDINT_H(mylib-int.h)
+#
+#   in configure.ac and go to install that very header file in
+#   Makefile.am along with the other headers (mylib.h) - and the
+#   mylib-specific headers can simply use "#include <mylib-int.h>" to
+#   obtain the stdint-types.
+#
+#   Remember, if the system already had a valid <stdint.h>, the
+#   generated file will include it directly. No need for fuzzy
+#   HAVE_STDINT_H things... (oops, GCC 4.2.x has deliberatly disabled
+#   its stdint.h for non-c99 compilation and the c99-mode is not the
+#   default. Therefore this macro will not use the compiler's stdint.h
+#   - please complain to the GCC developers).
+#
+# LAST MODIFICATION
+#
+#   2007-06-27
+#
+# COPYLEFT
+#
+#   Copyright (c) 2007 Guido U. Draheim <guidod@gmx.de>
+#
+#   This program is free software; you can redistribute it and/or
+#   modify it under the terms of the GNU General Public License as
+#   published by the Free Software Foundation; either version 2 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+#   General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program; if not, write to the Free Software
+#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+#   02111-1307, USA.
+#
+#   As a special exception, the respective Autoconf Macro's copyright
+#   owner gives unlimited permission to copy, distribute and modify the
+#   configure scripts that are the output of Autoconf when processing
+#   the Macro. You need not follow the terms of the GNU General Public
+#   License when using or distributing such scripts, even though
+#   portions of the text of the Macro appear in them. The GNU General
+#   Public License (GPL) does govern all other use of the material that
+#   constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the
+#   Autoconf Macro released by the Autoconf Macro Archive. When you
+#   make and distribute a modified version of the Autoconf Macro, you
+#   may extend this special exception to the GPL to apply to your
+#   modified version as well.
+
+AC_DEFUN([AX_CHECK_DATA_MODEL],[
+   AC_CHECK_SIZEOF(char)
+   AC_CHECK_SIZEOF(short)
+   AC_CHECK_SIZEOF(int)
+   AC_CHECK_SIZEOF(long)
+   AC_CHECK_SIZEOF(void*)
+   ac_cv_char_data_model=""
+   ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char"
+   ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short"
+   ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int"
+   ac_cv_long_data_model=""
+   ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int"
+   ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long"
+   ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp"
+   AC_MSG_CHECKING([data model])
+   case "$ac_cv_char_data_model/$ac_cv_long_data_model" in
+    122/242)     ac_cv_data_model="IP16"  ; n="standard 16bit machine" ;;
+    122/244)     ac_cv_data_model="LP32"  ; n="standard 32bit machine" ;;
+    122/*)       ac_cv_data_model="i16"   ; n="unusual int16 model" ;;
+    124/444)     ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;;
+    124/488)     ac_cv_data_model="LP64"  ; n="standard 64bit unixish" ;;
+    124/448)     ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;;
+    124/*)       ac_cv_data_model="i32"   ; n="unusual int32 model" ;;
+    128/888)     ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;;
+    128/*)       ac_cv_data_model="i64"   ; n="unusual int64 model" ;;
+    222/*2)      ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;;
+    333/*3)      ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;;
+    444/*4)      ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;;
+    666/*6)      ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;;
+    888/*8)      ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;;
+    222/*|333/*|444/*|666/*|888/*) :
+                 ac_cv_data_model="iDSP"  ; n="unusual dsptype" ;;
+     *)          ac_cv_data_model="none"  ; n="very unusual model" ;;
+   esac
+   AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)])
+])
+
+dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF])
+AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[
+AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[
+ ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h)
+  AC_MSG_RESULT([(..)])
+  for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h sys/types.h])
+  do
+   unset ac_cv_type_uintptr_t
+   unset ac_cv_type_uint64_t
+   AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>])
+   AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
+   m4_ifvaln([$2],[$2]) break
+  done
+  AC_MSG_CHECKING([for stdint uintptr_t])
+ ])
+])
+
+AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[
+AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[
+ ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h)
+  AC_MSG_RESULT([(..)])
+  for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h sys/types.h stdint.h])
+  do
+   unset ac_cv_type_uint32_t
+   unset ac_cv_type_uint64_t
+   AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>])
+   AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>])
+   m4_ifvaln([$2],[$2]) break
+   break;
+  done
+  AC_MSG_CHECKING([for stdint uint32_t])
+ ])
+])
+
+AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[
+AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[
+ ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h)
+  AC_MSG_RESULT([(..)])
+  for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do
+   unset ac_cv_type_u_int32_t
+   unset ac_cv_type_u_int64_t
+   AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>])
+   AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>])
+   m4_ifvaln([$2],[$2]) break
+   break;
+  done
+  AC_MSG_CHECKING([for stdint u_int32_t])
+ ])
+])
+
+AC_DEFUN([AX_CREATE_STDINT_H],
+[# ------ AX CREATE STDINT H -------------------------------------
+AC_MSG_CHECKING([for stdint types])
+ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)`
+# try to shortcircuit - if the default include path of the compiler
+# can find a "stdint.h" header then we assume that all compilers can.
+AC_CACHE_VAL([ac_cv_header_stdint_t],[
+old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS=""
+old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS=""
+old_CFLAGS="$CFLAGS"     ; CFLAGS=""
+AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
+[ac_cv_stdint_result="(assuming C99 compatible system)"
+ ac_cv_header_stdint_t="stdint.h"; ],
+[ac_cv_header_stdint_t=""])
+if test "$GCC" = "yes" && test ".$ac_cv_header_stdint_t" = "."; then
+CFLAGS="-std=c99"
+AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;],
+[AC_MSG_WARN(your GCC compiler has a defunct stdint.h for its default-mode)])
+fi
+CXXFLAGS="$old_CXXFLAGS"
+CPPFLAGS="$old_CPPFLAGS"
+CFLAGS="$old_CFLAGS" ])
+
+v="... $ac_cv_header_stdint_h"
+if test "$ac_stdint_h" = "stdint.h" ; then
+ AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)])
+elif test "$ac_stdint_h" = "inttypes.h" ; then
+ AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)])
+elif test "_$ac_cv_header_stdint_t" = "_" ; then
+ AC_MSG_RESULT([(putting them into $ac_stdint_h)$v])
+else
+ ac_cv_header_stdint="$ac_cv_header_stdint_t"
+ AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)])
+fi
+
+if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit..
+
+dnl .....intro message done, now do a few system checks.....
+dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type,
+dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW
+dnl instead that is triggered with 3 or more arguments (see types.m4)
+
+inttype_headers=`echo $2 | sed -e 's/,/ /g'`
+
+ac_cv_stdint_result="(no helpful system typedefs seen)"
+AX_CHECK_HEADER_STDINT_X(dnl
+   stdint.h inttypes.h sys/inttypes.h $inttype_headers,
+   ac_cv_stdint_result="(seen uintptr_t$and64 in $i)")
+
+if test "_$ac_cv_header_stdint_x" = "_" ; then
+AX_CHECK_HEADER_STDINT_O(dnl,
+   inttypes.h sys/inttypes.h stdint.h $inttype_headers,
+   ac_cv_stdint_result="(seen uint32_t$and64 in $i)")
+fi
+
+if test "_$ac_cv_header_stdint_x" = "_" ; then
+if test "_$ac_cv_header_stdint_o" = "_" ; then
+AX_CHECK_HEADER_STDINT_U(dnl,
+   sys/types.h inttypes.h sys/inttypes.h $inttype_headers,
+   ac_cv_stdint_result="(seen u_int32_t$and64 in $i)")
+fi fi
+
+dnl if there was no good C99 header file, do some typedef checks...
+if test "_$ac_cv_header_stdint_x" = "_" ; then
+   AC_MSG_CHECKING([for stdint datatype model])
+   AC_MSG_RESULT([(..)])
+   AX_CHECK_DATA_MODEL
+fi
+
+if test "_$ac_cv_header_stdint_x" != "_" ; then
+   ac_cv_header_stdint="$ac_cv_header_stdint_x"
+elif  test "_$ac_cv_header_stdint_o" != "_" ; then
+   ac_cv_header_stdint="$ac_cv_header_stdint_o"
+elif  test "_$ac_cv_header_stdint_u" != "_" ; then
+   ac_cv_header_stdint="$ac_cv_header_stdint_u"
+else
+   ac_cv_header_stdint="stddef.h"
+fi
+
+AC_MSG_CHECKING([for extra inttypes in chosen header])
+AC_MSG_RESULT([($ac_cv_header_stdint)])
+dnl see if int_least and int_fast types are present in _this_ header.
+unset ac_cv_type_int_least32_t
+unset ac_cv_type_int_fast32_t
+AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>])
+AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>])
+AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>])
+
+fi # shortcircut to system "stdint.h"
+# ------------------ PREPARE VARIABLES ------------------------------
+if test "$GCC" = "yes" ; then
+ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1`
+else
+ac_cv_stdint_message="using $CC"
+fi
+
+AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl
+$ac_cv_stdint_result])
+
+dnl -----------------------------------------------------------------
+# ----------------- DONE inttypes.h checks START header -------------
+AC_CONFIG_COMMANDS([$ac_stdint_h],[
+AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h)
+ac_stdint=$tmp/_stdint.h
+
+echo "#ifndef" $_ac_stdint_h >$ac_stdint
+echo "#define" $_ac_stdint_h "1" >>$ac_stdint
+echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint
+echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint
+echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint
+if test "_$ac_cv_header_stdint_t" != "_" ; then
+echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint
+echo "#include <stdint.h>" >>$ac_stdint
+echo "#endif" >>$ac_stdint
+echo "#endif" >>$ac_stdint
+else
+
+cat >>$ac_stdint <<STDINT_EOF
+
+/* ................... shortcircuit part ........................... */
+
+#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H
+#include <stdint.h>
+#else
+#include <stddef.h>
+
+/* .................... configured part ............................ */
+
+STDINT_EOF
+
+echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint
+if test "_$ac_cv_header_stdint_x" != "_" ; then
+  ac_header="$ac_cv_header_stdint_x"
+  echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint
+else
+  echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint
+fi
+
+echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint
+if  test "_$ac_cv_header_stdint_o" != "_" ; then
+  ac_header="$ac_cv_header_stdint_o"
+  echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint
+else
+  echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint
+fi
+
+echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint
+if  test "_$ac_cv_header_stdint_u" != "_" ; then
+  ac_header="$ac_cv_header_stdint_u"
+  echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint
+else
+  echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint
+fi
+
+echo "" >>$ac_stdint
+
+if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then
+  echo "#include <$ac_header>" >>$ac_stdint
+  echo "" >>$ac_stdint
+fi fi
+
+echo "/* which 64bit typedef has been found */" >>$ac_stdint
+if test "$ac_cv_type_uint64_t" = "yes" ; then
+echo "#define   _STDINT_HAVE_UINT64_T" "1"  >>$ac_stdint
+else
+echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint
+fi
+if test "$ac_cv_type_u_int64_t" = "yes" ; then
+echo "#define   _STDINT_HAVE_U_INT64_T" "1"  >>$ac_stdint
+else
+echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint
+fi
+echo "" >>$ac_stdint
+
+echo "/* which type model has been detected */" >>$ac_stdint
+if test "_$ac_cv_char_data_model" != "_" ; then
+echo "#define   _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint
+echo "#define   _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint
+else
+echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint
+echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint
+fi
+echo "" >>$ac_stdint
+
+echo "/* whether int_least types were detected */" >>$ac_stdint
+if test "$ac_cv_type_int_least32_t" = "yes"; then
+echo "#define   _STDINT_HAVE_INT_LEAST32_T" "1"  >>$ac_stdint
+else
+echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint
+fi
+echo "/* whether int_fast types were detected */" >>$ac_stdint
+if test "$ac_cv_type_int_fast32_t" = "yes"; then
+echo "#define   _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint
+else
+echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint
+fi
+echo "/* whether intmax_t type was detected */" >>$ac_stdint
+if test "$ac_cv_type_intmax_t" = "yes"; then
+echo "#define   _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint
+else
+echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint
+fi
+echo "" >>$ac_stdint
+
+  cat >>$ac_stdint <<STDINT_EOF
+/* .................... detections part ............................ */
+
+/* whether we need to define bitspecific types from compiler base types */
+#ifndef _STDINT_HEADER_INTPTR
+#ifndef _STDINT_HEADER_UINT32
+#ifndef _STDINT_HEADER_U_INT32
+#define _STDINT_NEED_INT_MODEL_T
+#else
+#define _STDINT_HAVE_U_INT_TYPES
+#endif
+#endif
+#endif
+
+#ifdef _STDINT_HAVE_U_INT_TYPES
+#undef _STDINT_NEED_INT_MODEL_T
+#endif
+
+#ifdef  _STDINT_CHAR_MODEL
+#if     _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124
+#ifndef _STDINT_BYTE_MODEL
+#define _STDINT_BYTE_MODEL 12
+#endif
+#endif
+#endif
+
+#ifndef _STDINT_HAVE_INT_LEAST32_T
+#define _STDINT_NEED_INT_LEAST_T
+#endif
+
+#ifndef _STDINT_HAVE_INT_FAST32_T
+#define _STDINT_NEED_INT_FAST_T
+#endif
+
+#ifndef _STDINT_HEADER_INTPTR
+#define _STDINT_NEED_INTPTR_T
+#ifndef _STDINT_HAVE_INTMAX_T
+#define _STDINT_NEED_INTMAX_T
+#endif
+#endif
+
+
+/* .................... definition part ............................ */
+
+/* some system headers have good uint64_t */
+#ifndef _HAVE_UINT64_T
+#if     defined _STDINT_HAVE_UINT64_T  || defined HAVE_UINT64_T
+#define _HAVE_UINT64_T
+#elif   defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T
+#define _HAVE_UINT64_T
+typedef u_int64_t uint64_t;
+#endif
+#endif
+
+#ifndef _HAVE_UINT64_T
+/* .. here are some common heuristics using compiler runtime specifics */
+#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L
+#define _HAVE_UINT64_T
+#define _HAVE_LONGLONG_UINT64_T
+typedef long long int64_t;
+typedef unsigned long long uint64_t;
+
+#elif !defined __STRICT_ANSI__
+#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__
+#define _HAVE_UINT64_T
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__
+/* note: all ELF-systems seem to have loff-support which needs 64-bit */
+#if !defined _NO_LONGLONG
+#define _HAVE_UINT64_T
+#define _HAVE_LONGLONG_UINT64_T
+typedef long long int64_t;
+typedef unsigned long long uint64_t;
+#endif
+
+#elif defined __alpha || (defined __mips && defined _ABIN32)
+#if !defined _NO_LONGLONG
+typedef long int64_t;
+typedef unsigned long uint64_t;
+#endif
+  /* compiler/cpu type to define int64_t */
+#endif
+#endif
+#endif
+
+#if defined _STDINT_HAVE_U_INT_TYPES
+/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */
+typedef u_int8_t uint8_t;
+typedef u_int16_t uint16_t;
+typedef u_int32_t uint32_t;
+
+/* glibc compatibility */
+#ifndef __int8_t_defined
+#define __int8_t_defined
+#endif
+#endif
+
+#ifdef _STDINT_NEED_INT_MODEL_T
+/* we must guess all the basic types. Apart from byte-adressable system, */
+/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */
+/* (btw, those nibble-addressable systems are way off, or so we assume) */
+
+dnl   /* have a look at "64bit and data size neutrality" at */
+dnl   /* http://unix.org/version2/whatsnew/login_64bit.html */
+dnl   /* (the shorthand "ILP" types always have a "P" part) */
+
+#if defined _STDINT_BYTE_MODEL
+#if _STDINT_LONG_MODEL+0 == 242
+/* 2:4:2 =  IP16 = a normal 16-bit system                */
+typedef unsigned char   uint8_t;
+typedef unsigned short  uint16_t;
+typedef unsigned long   uint32_t;
+#ifndef __int8_t_defined
+#define __int8_t_defined
+typedef          char    int8_t;
+typedef          short   int16_t;
+typedef          long    int32_t;
+#endif
+#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444
+/* 2:4:4 =  LP32 = a 32-bit system derived from a 16-bit */
+/* 4:4:4 = ILP32 = a normal 32-bit system                */
+typedef unsigned char   uint8_t;
+typedef unsigned short  uint16_t;
+typedef unsigned int    uint32_t;
+#ifndef __int8_t_defined
+#define __int8_t_defined
+typedef          char    int8_t;
+typedef          short   int16_t;
+typedef          int     int32_t;
+#endif
+#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488
+/* 4:8:4 =  IP32 = a 32-bit system prepared for 64-bit    */
+/* 4:8:8 =  LP64 = a normal 64-bit system                 */
+typedef unsigned char   uint8_t;
+typedef unsigned short  uint16_t;
+typedef unsigned int    uint32_t;
+#ifndef __int8_t_defined
+#define __int8_t_defined
+typedef          char    int8_t;
+typedef          short   int16_t;
+typedef          int     int32_t;
+#endif
+/* this system has a "long" of 64bit */
+#ifndef _HAVE_UINT64_T
+#define _HAVE_UINT64_T
+typedef unsigned long   uint64_t;
+typedef          long    int64_t;
+#endif
+#elif _STDINT_LONG_MODEL+0 == 448
+/*      LLP64   a 64-bit system derived from a 32-bit system */
+typedef unsigned char   uint8_t;
+typedef unsigned short  uint16_t;
+typedef unsigned int    uint32_t;
+#ifndef __int8_t_defined
+#define __int8_t_defined
+typedef          char    int8_t;
+typedef          short   int16_t;
+typedef          int     int32_t;
+#endif
+/* assuming the system has a "long long" */
+#ifndef _HAVE_UINT64_T
+#define _HAVE_UINT64_T
+#define _HAVE_LONGLONG_UINT64_T
+typedef unsigned long long uint64_t;
+typedef          long long  int64_t;
+#endif
+#else
+#define _STDINT_NO_INT32_T
+#endif
+#else
+#define _STDINT_NO_INT8_T
+#define _STDINT_NO_INT32_T
+#endif
+#endif
+
+/*
+ * quote from SunOS-5.8 sys/inttypes.h:
+ * Use at your own risk.  As of February 1996, the committee is squarely
+ * behind the fixed sized types; the "least" and "fast" types are still being
+ * discussed.  The probability that the "fast" types may be removed before
+ * the standard is finalized is high enough that they are not currently
+ * implemented.
+ */
+
+#if defined _STDINT_NEED_INT_LEAST_T
+typedef  int8_t    int_least8_t;
+typedef  int16_t   int_least16_t;
+typedef  int32_t   int_least32_t;
+#ifdef _HAVE_UINT64_T
+typedef  int64_t   int_least64_t;
+#endif
+
+typedef uint8_t   uint_least8_t;
+typedef uint16_t  uint_least16_t;
+typedef uint32_t  uint_least32_t;
+#ifdef _HAVE_UINT64_T
+typedef uint64_t  uint_least64_t;
+#endif
+  /* least types */
+#endif
+
+#if defined _STDINT_NEED_INT_FAST_T
+typedef  int8_t    int_fast8_t;
+typedef  int       int_fast16_t;
+typedef  int32_t   int_fast32_t;
+#ifdef _HAVE_UINT64_T
+typedef  int64_t   int_fast64_t;
+#endif
+
+typedef uint8_t   uint_fast8_t;
+typedef unsigned  uint_fast16_t;
+typedef uint32_t  uint_fast32_t;
+#ifdef _HAVE_UINT64_T
+typedef uint64_t  uint_fast64_t;
+#endif
+  /* fast types */
+#endif
+
+#ifdef _STDINT_NEED_INTMAX_T
+#ifdef _HAVE_UINT64_T
+typedef  int64_t       intmax_t;
+typedef uint64_t      uintmax_t;
+#else
+typedef          long  intmax_t;
+typedef unsigned long uintmax_t;
+#endif
+#endif
+
+#ifdef _STDINT_NEED_INTPTR_T
+#ifndef __intptr_t_defined
+#define __intptr_t_defined
+/* we encourage using "long" to store pointer values, never use "int" ! */
+#if   _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484
+typedef  unsigned int   uintptr_t;
+typedef           int    intptr_t;
+#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444
+typedef  unsigned long  uintptr_t;
+typedef           long   intptr_t;
+#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T
+typedef        uint64_t uintptr_t;
+typedef         int64_t  intptr_t;
+#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */
+typedef  unsigned long  uintptr_t;
+typedef           long   intptr_t;
+#endif
+#endif
+#endif
+
+/* The ISO C99 standard specifies that in C++ implementations these
+   should only be defined if explicitly requested.  */
+#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS
+#ifndef UINT32_C
+
+/* Signed.  */
+# define INT8_C(c)      c
+# define INT16_C(c)     c
+# define INT32_C(c)     c
+# ifdef _HAVE_LONGLONG_UINT64_T
+#  define INT64_C(c)    c ## L
+# else
+#  define INT64_C(c)    c ## LL
+# endif
+
+/* Unsigned.  */
+# define UINT8_C(c)     c ## U
+# define UINT16_C(c)    c ## U
+# define UINT32_C(c)    c ## U
+# ifdef _HAVE_LONGLONG_UINT64_T
+#  define UINT64_C(c)   c ## UL
+# else
+#  define UINT64_C(c)   c ## ULL
+# endif
+
+/* Maximal type.  */
+# ifdef _HAVE_LONGLONG_UINT64_T
+#  define INTMAX_C(c)   c ## L
+#  define UINTMAX_C(c)  c ## UL
+# else
+#  define INTMAX_C(c)   c ## LL
+#  define UINTMAX_C(c)  c ## ULL
+# endif
+
+  /* literalnumbers */
+#endif
+#endif
+
+/* These limits are merily those of a two complement byte-oriented system */
+
+/* Minimum of signed integral types.  */
+# define INT8_MIN               (-128)
+# define INT16_MIN              (-32767-1)
+# define INT32_MIN              (-2147483647-1)
+# define INT64_MIN              (-__INT64_C(9223372036854775807)-1)
+/* Maximum of signed integral types.  */
+# define INT8_MAX               (127)
+# define INT16_MAX              (32767)
+# define INT32_MAX              (2147483647)
+# define INT64_MAX              (__INT64_C(9223372036854775807))
+
+/* Maximum of unsigned integral types.  */
+# define UINT8_MAX              (255)
+# define UINT16_MAX             (65535)
+# define UINT32_MAX             (4294967295U)
+# define UINT64_MAX             (__UINT64_C(18446744073709551615))
+
+/* Minimum of signed integral types having a minimum size.  */
+# define INT_LEAST8_MIN         INT8_MIN
+# define INT_LEAST16_MIN        INT16_MIN
+# define INT_LEAST32_MIN        INT32_MIN
+# define INT_LEAST64_MIN        INT64_MIN
+/* Maximum of signed integral types having a minimum size.  */
+# define INT_LEAST8_MAX         INT8_MAX
+# define INT_LEAST16_MAX        INT16_MAX
+# define INT_LEAST32_MAX        INT32_MAX
+# define INT_LEAST64_MAX        INT64_MAX
+
+/* Maximum of unsigned integral types having a minimum size.  */
+# define UINT_LEAST8_MAX        UINT8_MAX
+# define UINT_LEAST16_MAX       UINT16_MAX
+# define UINT_LEAST32_MAX       UINT32_MAX
+# define UINT_LEAST64_MAX       UINT64_MAX
+
+  /* shortcircuit*/
+#endif
+  /* once */
+#endif
+#endif
+STDINT_EOF
+fi
+    if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then
+      AC_MSG_NOTICE([$ac_stdint_h is unchanged])
+    else
+      ac_dir=`AS_DIRNAME(["$ac_stdint_h"])`
+      AS_MKDIR_P(["$ac_dir"])
+      rm -f $ac_stdint_h
+      mv $ac_stdint $ac_stdint_h
+    fi
+],[# variables for create stdint.h replacement
+PACKAGE="$PACKAGE"
+VERSION="$VERSION"
+ac_stdint_h="$ac_stdint_h"
+_ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h)
+ac_cv_stdint_message="$ac_cv_stdint_message"
+ac_cv_header_stdint_t="$ac_cv_header_stdint_t"
+ac_cv_header_stdint_x="$ac_cv_header_stdint_x"
+ac_cv_header_stdint_o="$ac_cv_header_stdint_o"
+ac_cv_header_stdint_u="$ac_cv_header_stdint_u"
+ac_cv_type_uint64_t="$ac_cv_type_uint64_t"
+ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t"
+ac_cv_char_data_model="$ac_cv_char_data_model"
+ac_cv_long_data_model="$ac_cv_long_data_model"
+ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t"
+ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t"
+ac_cv_type_intmax_t="$ac_cv_type_intmax_t"
+])
+])
diff --git a/common/m4/check.m4 b/common/m4/check.m4
new file mode 100755 (executable)
index 0000000..19784ae
--- /dev/null
@@ -0,0 +1,181 @@
+dnl _AM_TRY_CHECK(MINIMUM-VERSION, EXTRA-CFLAGS, EXTRA-LIBS, CHECK-LIB-NAME
+dnl               [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Test for check, and define CHECK_CFLAGS and CHECK_LIBS
+dnl Done this way because of the brokenness that is
+dnl https://launchpad.net/distros/ubuntu/+source/check/+bug/5840
+dnl
+
+AC_DEFUN([_AM_TRY_CHECK],
+[
+  min_check_version=$1
+  extra_cflags=$2
+  extra_libs=$3
+  check_lib_name=$4
+  
+  CHECK_CFLAGS="$extra_cflags"
+  CHECK_LIBS="$extra_libs -l$check_lib_name"
+
+  ac_save_CFLAGS="$CFLAGS"
+  ac_save_LIBS="$LIBS"
+
+  CFLAGS="$CFLAGS $CHECK_CFLAGS"
+  LIBS="$CHECK_LIBS $LIBS"
+
+  AC_MSG_CHECKING(for check named $check_lib_name  - version >= $min_check_version)
+
+  rm -f conf.check-test
+  dnl unset no_check, since in our second run it would have been set to yes
+  dnl before
+  no_check=
+  AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <check.h>
+
+int main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.check-test");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = strdup("$min_check_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_check_version");
+     return 1;
+   }
+    
+  if ((CHECK_MAJOR_VERSION != check_major_version) ||
+      (CHECK_MINOR_VERSION != check_minor_version) ||
+      (CHECK_MICRO_VERSION != check_micro_version))
+    {
+      printf("\n*** The check header file (version %d.%d.%d) does not match\n",
+            CHECK_MAJOR_VERSION, CHECK_MINOR_VERSION, CHECK_MICRO_VERSION);
+      printf("*** the check library (version %d.%d.%d).\n",
+            check_major_version, check_minor_version, check_micro_version);
+      return 1;
+    }
+
+  if ((check_major_version > major) ||
+      ((check_major_version == major) && (check_minor_version > minor)) ||
+      ((check_major_version == major) && (check_minor_version == minor) && (check_micro_version >= micro)))
+    {
+      return 0;
+    }
+  else
+    {
+      printf("\n*** An old version of check (%d.%d.%d) was found.\n",
+             check_major_version, check_minor_version, check_micro_version);
+      printf("*** You need a version of check being at least %d.%d.%d.\n", major, minor, micro);
+      printf("***\n"); 
+      printf("*** If you have already installed a sufficiently new version, this error\n");
+      printf("*** probably means that the wrong copy of the check library and header\n");
+      printf("*** file is being found. Rerun configure with the --with-check=PATH option\n");
+      printf("*** to specify the prefix where the correct version was installed.\n");
+    }
+
+  return 1;
+}
+],, no_check=yes, [echo $ac_n "cross compiling; assumed OK... $ac_c"])
+
+  CFLAGS="$ac_save_CFLAGS"
+  LIBS="$ac_save_LIBS"
+
+  if test "x$no_check" = x ; then
+    AC_MSG_RESULT(yes)
+    ifelse([$5], , :, [$5])
+  else
+    AC_MSG_RESULT(no)
+    if test -f conf.check-test ; then
+      :
+    else
+      echo "*** Could not run check test program, checking why..."
+      CFLAGS="$CFLAGS $CHECK_CFLAGS"
+      LIBS="$CHECK_LIBS $LIBS"
+      AC_TRY_LINK([
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <check.h>
+], ,  [ echo "*** The test program compiled, but did not run. This usually means"
+        echo "*** that the run-time linker is not finding check. You'll need to set your"
+        echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+        echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+        echo "*** is required on your system"
+       echo "***"
+        echo "*** If you have an old version installed, it is best to remove it, although"
+        echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+      [ echo "*** The test program failed to compile or link. See the file config.log for"
+        echo "*** the exact error that occured." ])
+    
+      CFLAGS="$ac_save_CFLAGS"
+      LIBS="$ac_save_LIBS"
+    fi
+
+    CHECK_CFLAGS=""
+    CHECK_LIBS=""
+
+    rm -f conf.check-test
+    ifelse([$6], , AC_MSG_ERROR([check not found]), [$6])
+  fi
+])
+
+
+dnl AM_PATH_CHECK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for check, and define CHECK_CFLAGS and CHECK_LIBS
+dnl
+
+AC_DEFUN([AM_PATH_CHECK],
+[
+  AC_ARG_WITH(check,
+  [  --with-check=PATH       prefix where check is installed [default=auto]])
+  AC_ARG_WITH(checklibname,
+    AC_HELP_STRING([--with-check-lib-name=NAME],
+      [name of the PIC check library (default=check)]))
+  min_check_version=ifelse([$1], ,0.8.2,$1)
+
+  if test x$with_check = xno; then
+    AC_MSG_RESULT(disabled)
+    ifelse([$3], , AC_MSG_ERROR([disabling check is not supported]), [$3])
+  else
+    if test "x$with_check" != x; then
+      CHECK_EXTRA_CFLAGS="-I$with_check/include"
+      CHECK_EXTRA_LIBS="-L$with_check/lib"
+    else
+      CHECK_EXTRA_CFLAGS=""
+      CHECK_EXTRA_LIBS=""
+    fi
+
+    if test x$with_checklibname = x; then
+      _AM_TRY_CHECK($min_check_version, $CHECK_EXTRA_CFLAGS, $CHECK_EXTRA_LIBS,
+        check_pic, [have_check=true], [have_check=false])
+      if test x$have_check = xtrue; then
+        ifelse([$2], , :, [$2])
+      else
+        _AM_TRY_CHECK($min_check_version, $CHECK_EXTRA_CFLAGS, $CHECK_EXTRA_LIBS,
+          check, [have_check=true], [have_check=false])
+        if test x$have_check = xtrue; then
+          ifelse([$2], , :, [$2])
+        else
+          ifelse([$3], , AC_MSG_ERROR([check not found]), [$3])
+        fi
+      fi
+    else
+      _AM_TRY_CHECK($min_check_version, $CHECK_EXTRA_CFLAGS, $CHECK_EXTRA_LIBS,
+        $with_checklibname, [have_check=true], [have_check=false])
+      if test x$have_check = xtrue; then
+        ifelse([$2], , :, [$2])
+      else
+        ifelse([$3], , AC_MSG_ERROR([check not found]), [$3])
+      fi
+    fi
+
+    AC_SUBST(CHECK_CFLAGS)
+    AC_SUBST(CHECK_LIBS)
+    rm -f conf.check-test
+  fi
+])
diff --git a/common/m4/gettext.m4 b/common/m4/gettext.m4
new file mode 100755 (executable)
index 0000000..45cad85
--- /dev/null
@@ -0,0 +1,587 @@
+# gettext.m4 serial 17 (gettext-0.11.5)
+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2002.
+
+dnl Macro to add for using GNU gettext.
+
+dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
+dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
+dnl    default (if it is not specified or empty) is 'no-libtool'.
+dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
+dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
+dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
+dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
+dnl    depending on --{enable,disable}-{shared,static} and on the presence of
+dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
+dnl    $(top_builddir)/intl/libintl.a will be created.
+dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
+dnl    implementations (in libc or libintl) without the ngettext() function
+dnl    will be ignored.  If NEEDSYMBOL is specified and is
+dnl    'need-formatstring-macros', then GNU gettext implementations that don't
+dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
+dnl INTLDIR is used to find the intl libraries.  If empty,
+dnl    the value `$(top_builddir)/intl/' is used.
+dnl
+dnl The result of the configuration is one of three cases:
+dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
+dnl    and used.
+dnl    Catalog format: GNU --> install in $(datadir)
+dnl    Catalog extension: .mo after installation, .gmo in source tree
+dnl 2) GNU gettext has been found in the system's C library.
+dnl    Catalog format: GNU --> install in $(datadir)
+dnl    Catalog extension: .mo after installation, .gmo in source tree
+dnl 3) No internationalization, always use English msgid.
+dnl    Catalog format: none
+dnl    Catalog extension: none
+dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
+dnl The use of .gmo is historical (it was needed to avoid overwriting the
+dnl GNU format catalogs when building on a platform with an X/Open gettext),
+dnl but we keep it in order not to force irrelevant filename changes on the
+dnl maintainers.
+dnl
+AC_DEFUN([AM_GNU_GETTEXT],
+[
+  dnl Argument checking.
+  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
+    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
+])])])])])
+  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
+    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
+])])])])
+  define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
+  define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
+
+  AC_REQUIRE([AM_PO_SUBDIRS])dnl
+  ifelse(gt_included_intl, yes, [
+    AC_REQUIRE([AM_INTL_SUBDIR])dnl
+  ])
+
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Sometimes libintl requires libiconv, so first search for libiconv.
+  dnl Ideally we would do this search only after the
+  dnl      if test "$USE_NLS" = "yes"; then
+  dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
+  dnl the configure script would need to contain the same shell code
+  dnl again, outside any 'if'. There are two solutions:
+  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
+  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
+  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
+  dnl documented, we avoid it.
+  ifelse(gt_included_intl, yes, , [
+    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+  ])
+
+  AC_MSG_CHECKING([whether NLS is requested])
+  dnl Default is enabled NLS
+  AC_ARG_ENABLE(nls,
+    [  --disable-nls           do not use Native Language Support],
+    USE_NLS=$enableval, USE_NLS=yes)
+  AC_MSG_RESULT($USE_NLS)
+  AC_SUBST(USE_NLS)
+
+  ifelse(gt_included_intl, yes, [
+    BUILD_INCLUDED_LIBINTL=no
+    USE_INCLUDED_LIBINTL=no
+  ])
+  LIBINTL=
+  LTLIBINTL=
+  POSUB=
+
+  dnl If we use NLS figure out what method
+  if test "$USE_NLS" = "yes"; then
+    gt_use_preinstalled_gnugettext=no
+    ifelse(gt_included_intl, yes, [
+      AC_MSG_CHECKING([whether included gettext is requested])
+      AC_ARG_WITH(included-gettext,
+        [  --with-included-gettext use the GNU gettext library included here],
+        nls_cv_force_use_gnu_gettext=$withval,
+        nls_cv_force_use_gnu_gettext=no)
+      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+
+      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+    ])
+        dnl User does not insist on using GNU NLS library.  Figure out what
+        dnl to use.  If GNU gettext is available we use this.  Else we have
+        dnl to fall back to GNU NLS library.
+
+        dnl Add a version number to the cache macros.
+        define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
+        define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
+        define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
+
+        AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
+         [AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;],
+            [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
+            gt_cv_func_gnugettext_libc=yes,
+            gt_cv_func_gnugettext_libc=no)])
+
+        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+          dnl Sometimes libintl requires libiconv, so first search for libiconv.
+          ifelse(gt_included_intl, yes, , [
+            AM_ICONV_LINK
+          ])
+          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
+          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
+          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
+          dnl even if libiconv doesn't exist.
+          AC_LIB_LINKFLAGS_BODY([intl])
+          AC_CACHE_CHECK([for GNU gettext in libintl],
+            gt_cv_func_gnugettext_libintl,
+           [gt_save_CPPFLAGS="$CPPFLAGS"
+            CPPFLAGS="$CPPFLAGS $INCINTL"
+            gt_save_LIBS="$LIBS"
+            LIBS="$LIBS $LIBINTL"
+            dnl Now see whether libintl exists and does not depend on libiconv.
+            AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias ();],
+              [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
+              gt_cv_func_gnugettext_libintl=yes,
+              gt_cv_func_gnugettext_libintl=no)
+            dnl Now see whether libintl exists and depends on libiconv.
+            if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
+              LIBS="$LIBS $LIBICONV"
+              AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias ();],
+                [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
+               [LIBINTL="$LIBINTL $LIBICONV"
+                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+                gt_cv_func_gnugettext_libintl=yes
+               ])
+            fi
+            CPPFLAGS="$gt_save_CPPFLAGS"
+            LIBS="$gt_save_LIBS"])
+        fi
+
+        dnl If an already present or preinstalled GNU gettext() is found,
+        dnl use it.  But if this macro is used in GNU gettext, and GNU
+        dnl gettext is already preinstalled in libintl, we update this
+        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
+        if test "$gt_cv_func_gnugettext_libc" = "yes" \
+           || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
+                && test "$PACKAGE" != gettext; }; then
+          gt_use_preinstalled_gnugettext=yes
+        else
+          dnl Reset the values set by searching for libintl.
+          LIBINTL=
+          LTLIBINTL=
+          INCINTL=
+        fi
+
+    ifelse(gt_included_intl, yes, [
+        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
+          dnl GNU gettext is not found in the C library.
+          dnl Fall back on included GNU gettext library.
+          nls_cv_use_gnu_gettext=yes
+        fi
+      fi
+
+      if test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Mark actions used to generate GNU NLS library.
+        INTLOBJS="\$(GETTOBJS)"
+        BUILD_INCLUDED_LIBINTL=yes
+        USE_INCLUDED_LIBINTL=yes
+        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
+        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
+        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
+      fi
+
+      if test "$gt_use_preinstalled_gnugettext" = "yes" \
+         || test "$nls_cv_use_gnu_gettext" = "yes"; then
+        dnl Mark actions to use GNU gettext tools.
+        CATOBJEXT=.gmo
+      fi
+    ])
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes" \
+       || test "$nls_cv_use_gnu_gettext" = "yes"; then
+      AC_DEFINE(ENABLE_NLS, 1,
+        [Define to 1 if translation of program messages to the user's native language
+   is requested.])
+    else
+      USE_NLS=no
+    fi
+  fi
+
+  if test "$USE_NLS" = "yes"; then
+
+    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+      if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+        AC_MSG_CHECKING([how to link with libintl])
+        AC_MSG_RESULT([$LIBINTL])
+        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
+      fi
+
+      dnl For backward compatibility. Some packages may be using this.
+      AC_DEFINE(HAVE_GETTEXT, 1,
+       [Define if the GNU gettext() function is already present or preinstalled.])
+      AC_DEFINE(HAVE_DCGETTEXT, 1,
+       [Define if the GNU dcgettext() function is already present or preinstalled.])
+    fi
+
+    dnl We need to process the po/ directory.
+    POSUB=po
+  fi
+
+  ifelse(gt_included_intl, yes, [
+    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
+    dnl to 'yes' because some of the testsuite requires it.
+    if test "$PACKAGE" = gettext; then
+      BUILD_INCLUDED_LIBINTL=yes
+    fi
+
+    dnl Make all variables we use known to autoconf.
+    AC_SUBST(BUILD_INCLUDED_LIBINTL)
+    AC_SUBST(USE_INCLUDED_LIBINTL)
+    AC_SUBST(CATOBJEXT)
+    AC_SUBST(INTLOBJS)
+
+    dnl For backward compatibility. Some configure.ins may be using this.
+    nls_cv_header_intl=
+    nls_cv_header_libgt=
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    DATADIRNAME=share
+    AC_SUBST(DATADIRNAME)
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    INSTOBJEXT=.mo
+    AC_SUBST(INSTOBJEXT)
+
+    dnl For backward compatibility. Some Makefiles may be using this.
+    GENCAT=gencat
+    AC_SUBST(GENCAT)
+
+    dnl Enable libtool support if the surrounding package wishes it.
+    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
+    AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
+  ])
+
+  dnl For backward compatibility. Some Makefiles may be using this.
+  INTLLIBS="$LIBINTL"
+  AC_SUBST(INTLLIBS)
+
+  dnl Make all documented variables known to autoconf.
+  AC_SUBST(LIBINTL)
+  AC_SUBST(LTLIBINTL)
+  AC_SUBST(POSUB)
+])
+
+
+dnl Checks for all prerequisites of the po subdirectory,
+dnl except for USE_NLS.
+AC_DEFUN([AM_PO_SUBDIRS],
+[
+  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+  AC_REQUIRE([AC_PROG_INSTALL])dnl
+  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
+
+  dnl Perform the following tests also if --disable-nls has been given,
+  dnl because they are needed for "make dist" to work.
+
+  dnl Search for GNU msgfmt in the PATH.
+  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
+  dnl The second test excludes FreeBSD msgfmt.
+  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+    [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
+     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+    :)
+  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+
+  dnl Search for GNU xgettext 0.11 or newer in the PATH.
+  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
+  dnl The second test excludes FreeBSD xgettext.
+  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+    [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
+     (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+    :)
+  dnl Remove leftover from FreeBSD xgettext call.
+  rm -f messages.po
+
+  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
+  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
+    [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
+
+  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
+  dnl Test whether we really found GNU msgfmt.
+  if test "$GMSGFMT" != ":"; then
+    dnl If it is no GNU msgfmt we define it as : so that the
+    dnl Makefiles still can work.
+    if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
+       (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+      : ;
+    else
+      GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
+      AC_MSG_RESULT(
+        [found $GMSGFMT program is not GNU msgfmt; ignore it])
+      GMSGFMT=":"
+    fi
+  fi
+
+  dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
+  dnl Test whether we really found GNU xgettext.
+  if test "$XGETTEXT" != ":"; then
+    dnl If it is no GNU xgettext we define it as : so that the
+    dnl Makefiles still can work.
+    if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 &&
+       (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
+      : ;
+    else
+      AC_MSG_RESULT(
+        [found xgettext program is not GNU xgettext; ignore it])
+      XGETTEXT=":"
+    fi
+    dnl Remove leftover from FreeBSD xgettext call.
+    rm -f messages.po
+  fi
+
+  AC_OUTPUT_COMMANDS([
+    for ac_file in $CONFIG_FILES; do
+      # Support "outfile[:infile[:infile...]]"
+      case "$ac_file" in
+        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+      esac
+      # PO directories have a Makefile.in generated from Makefile.in.in.
+      case "$ac_file" in */Makefile.in)
+        # Adjust a relative srcdir.
+        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
+        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+        # In autoconf-2.13 it is called $ac_given_srcdir.
+        # In autoconf-2.50 it is called $srcdir.
+        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+        case "$ac_given_srcdir" in
+          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+          /*) top_srcdir="$ac_given_srcdir" ;;
+          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
+        esac
+        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+          rm -f "$ac_dir/POTFILES"
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[  ]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+          # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
+          # on $ac_dir but don't depend on user-specified configuration
+          # parameters.
+          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+            # The LINGUAS file contains the set of available languages.
+            if test -n "$ALL_LINGUAS"; then
+              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+            fi
+            ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+            # Hide the ALL_LINGUAS assigment from automake.
+            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
+          fi
+          case "$ac_given_srcdir" in
+            .) srcdirpre= ;;
+            *) srcdirpre='$(srcdir)/' ;;
+          esac
+          POFILES=
+          GMOFILES=
+          UPDATEPOFILES=
+          DUMMYPOFILES=
+          for lang in $ALL_LINGUAS; do
+            POFILES="$POFILES $srcdirpre$lang.po"
+            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+          done
+          # CATALOGS depends on both $ac_dir and the user's LINGUAS
+          # environment variable.
+          INST_LINGUAS=
+          if test -n "$ALL_LINGUAS"; then
+            for presentlang in $ALL_LINGUAS; do
+              useit=no
+              if test "%UNSET%" != "$LINGUAS"; then
+                desiredlanguages="$LINGUAS"
+              else
+                desiredlanguages="$ALL_LINGUAS"
+              fi
+              for desiredlang in $desiredlanguages; do
+                # Use the presentlang catalog if desiredlang is
+                #   a. equal to presentlang, or
+                #   b. a variant of presentlang (because in this case,
+                #      presentlang can be used as a fallback for messages
+                #      which are not translated in the desiredlang catalog).
+                case "$desiredlang" in
+                  "$presentlang"*) useit=yes;;
+                esac
+              done
+              if test $useit = yes; then
+                INST_LINGUAS="$INST_LINGUAS $presentlang"
+              fi
+            done
+          fi
+          CATALOGS=
+          if test -n "$INST_LINGUAS"; then
+            for lang in $INST_LINGUAS; do
+              CATALOGS="$CATALOGS $lang.gmo"
+            done
+          fi
+          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+          sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+            if test -f "$f"; then
+              case "$f" in
+                *.orig | *.bak | *~) ;;
+                *) cat "$f" >> "$ac_dir/Makefile" ;;
+              esac
+            fi
+          done
+        fi
+        ;;
+      esac
+    done],
+   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+    # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
+    # from automake.
+    eval 'ALL_LINGUAS''="$ALL_LINGUAS"'
+    # Capture the value of LINGUAS because we need it to compute CATALOGS.
+    LINGUAS="${LINGUAS-%UNSET%}"
+   ])
+])
+
+
+dnl Checks for all prerequisites of the intl subdirectory,
+dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
+dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
+AC_DEFUN([AM_INTL_SUBDIR],
+[
+  AC_REQUIRE([AC_PROG_INSTALL])dnl
+  AC_REQUIRE([AM_MKINSTALLDIRS])dnl
+  AC_REQUIRE([AC_PROG_CC])dnl
+  AC_REQUIRE([AC_CANONICAL_HOST])dnl
+  AC_REQUIRE([AC_PROG_RANLIB])dnl
+  AC_REQUIRE([AC_ISC_POSIX])dnl
+  AC_REQUIRE([AC_HEADER_STDC])dnl
+  AC_REQUIRE([AC_C_CONST])dnl
+  AC_REQUIRE([AC_C_INLINE])dnl
+  AC_REQUIRE([AC_TYPE_OFF_T])dnl
+  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+  AC_REQUIRE([AC_FUNC_MMAP])dnl
+  AC_REQUIRE([jm_GLIBC21])dnl
+  AC_REQUIRE([gt_INTDIV0])dnl
+  AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
+  AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
+  AC_REQUIRE([gt_INTTYPES_PRI])dnl
+
+  AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
+stdlib.h string.h unistd.h sys/param.h])
+  AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
+geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
+strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
+
+  AM_ICONV
+  AM_LANGINFO_CODESET
+  if test $ac_cv_header_locale_h = yes; then
+    AM_LC_MESSAGES
+  fi
+
+  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
+  dnl because plural.y uses bison specific features. It requires at least
+  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
+  dnl compile.
+  dnl bison is only needed for the maintainer (who touches plural.y). But in
+  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
+  dnl the rule in general Makefile. Now, some people carelessly touch the
+  dnl files or have a broken "make" program, hence the plural.c rule will
+  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
+  dnl present or too old.
+  AC_CHECK_PROGS([INTLBISON], [bison])
+  if test -z "$INTLBISON"; then
+    ac_verc_fail=yes
+  else
+    dnl Found it, now check the version.
+    AC_MSG_CHECKING([version of bison])
+changequote(<<,>>)dnl
+    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+    case $ac_prog_version in
+      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
+changequote([,])dnl
+         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+    esac
+    AC_MSG_RESULT([$ac_prog_version])
+  fi
+  if test $ac_verc_fail = yes; then
+    INTLBISON=:
+  fi
+])
+
+
+AC_DEFUN([AM_MKINSTALLDIRS],
+[
+  dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+  dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
+  dnl Try to locate is.
+  MKINSTALLDIRS=
+  if test -n "$ac_aux_dir"; then
+    MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+  fi
+  if test -z "$MKINSTALLDIRS"; then
+    MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+  fi
+  AC_SUBST(MKINSTALLDIRS)
+])
+
+
+dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
+AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
diff --git a/common/m4/glib-gettext.m4 b/common/m4/glib-gettext.m4
new file mode 100755 (executable)
index 0000000..5a4ef28
--- /dev/null
@@ -0,0 +1,380 @@
+# Copyright (C) 1995-2002 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003 Red Hat, Inc.
+#
+# This file is free software, distributed under the terms of the GNU
+# General Public License.  As a special exception to the GNU General
+# Public License, this file may be distributed as part of a program
+# that contains a configuration script generated by Autoconf, under
+# the same distribution terms as the rest of that program.
+#
+# This file can be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+#
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995, 1996
+#
+# Modified to never use included libintl. 
+# Owen Taylor <otaylor@redhat.com>, 12/15/1998
+#
+# Major rework to remove unused code
+# Owen Taylor <otaylor@redhat.com>, 12/11/2002
+#
+# Added better handling of ALL_LINGUAS from GNU gettext version 
+# written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
+
+#
+# We need this here as well, since someone might use autoconf-2.5x
+# to configure GLib then an older version to configure a package
+# using AM_GLIB_GNU_GETTEXT
+AC_PREREQ(2.53)
+
+dnl
+dnl We go to great lengths to make sure that aclocal won't 
+dnl try to pull in the installed version of these macros
+dnl when running aclocal in the glib directory.
+dnl
+m4_copy([AC_DEFUN],[glib_DEFUN])
+m4_copy([AC_REQUIRE],[glib_REQUIRE])
+dnl
+dnl At the end, if we're not within glib, we'll define the public
+dnl definitions in terms of our private definitions.
+dnl
+
+# GLIB_LC_MESSAGES
+#--------------------
+glib_DEFUN([GLIB_LC_MESSAGES],
+  [AC_CHECK_HEADERS([locale.h])
+    if test $ac_cv_header_locale_h = yes; then
+    AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
+      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+       am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
+    if test $am_cv_val_LC_MESSAGES = yes; then
+      AC_DEFINE(HAVE_LC_MESSAGES, 1,
+        [Define if your <locale.h> file defines LC_MESSAGES.])
+    fi
+  fi])
+
+# GLIB_PATH_PROG_WITH_TEST
+#----------------------------
+dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+glib_DEFUN([GLIB_PATH_PROG_WITH_TEST],
+[# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+  /*)
+  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in ifelse([$5], , $PATH, [$5]); do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if [$3]; then
+       ac_cv_path_$1="$ac_dir/$ac_word"
+       break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+  ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
+  AC_MSG_RESULT([$]$1)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
+
+# GLIB_WITH_NLS
+#-----------------
+glib_DEFUN([GLIB_WITH_NLS],
+  dnl NLS is obligatory
+  [USE_NLS=yes
+    AC_SUBST(USE_NLS)
+
+    gt_cv_have_gettext=no
+
+    CATOBJEXT=NONE
+    XGETTEXT=:
+    INTLLIBS=
+
+    AC_CHECK_HEADER(libintl.h,
+     [gt_cv_func_dgettext_libintl="no"
+      libintl_extra_libs=""
+
+      #
+      # First check in libc
+      #
+      AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
+        [AC_TRY_LINK([
+#include <libintl.h>
+],
+          [return (int) dgettext ("","")],
+         gt_cv_func_dgettext_libc=yes,
+          gt_cv_func_dgettext_libc=no)
+        ])
+  
+      if test "$gt_cv_func_dgettext_libc" = "yes" ; then
+        AC_CHECK_FUNCS(bind_textdomain_codeset)
+      fi
+
+      #
+      # If we don't have everything we want, check in libintl
+      #
+      if test "$gt_cv_func_dgettext_libc" != "yes" \
+         || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
+        
+        AC_CHECK_LIB(intl, bindtextdomain,
+           [AC_CHECK_LIB(intl, dgettext,
+                         gt_cv_func_dgettext_libintl=yes)])
+
+       if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
+         AC_MSG_CHECKING([if -liconv is needed to use gettext])
+         AC_MSG_RESULT([])
+          AC_CHECK_LIB(intl, dcgettext,
+                      [gt_cv_func_dgettext_libintl=yes
+                       libintl_extra_libs=-liconv],
+                       :,-liconv)
+        fi
+
+        #
+        # If we found libintl, then check in it for bind_textdomain_codeset();
+        # we'll prefer libc if neither have bind_textdomain_codeset(),
+        # and both have dgettext
+        #
+        if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
+          glib_save_LIBS="$LIBS"
+          LIBS="$LIBS -lintl $libintl_extra_libs"
+          unset ac_cv_func_bind_textdomain_codeset
+          AC_CHECK_FUNCS(bind_textdomain_codeset)
+          LIBS="$glib_save_LIBS"
+
+          if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
+            gt_cv_func_dgettext_libc=no
+          else
+            if test "$gt_cv_func_dgettext_libc" = "yes"; then
+              gt_cv_func_dgettext_libintl=no
+            fi
+          fi
+        fi
+      fi
+
+      if test "$gt_cv_func_dgettext_libc" = "yes" \
+       || test "$gt_cv_func_dgettext_libintl" = "yes"; then
+        gt_cv_have_gettext=yes
+      fi
+  
+      if test "$gt_cv_func_dgettext_libintl" = "yes"; then
+        INTLLIBS="-lintl $libintl_extra_libs"
+      fi
+  
+      if test "$gt_cv_have_gettext" = "yes"; then
+       AC_DEFINE(HAVE_GETTEXT,1,
+         [Define if the GNU gettext() function is already present or preinstalled.])
+       GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
+       if test "$MSGFMT" != "no"; then
+          glib_save_LIBS="$LIBS"
+          LIBS="$LIBS $INTLLIBS"
+         AC_CHECK_FUNCS(dcgettext)
+         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
+         GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
+         AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
+                        return _nl_msg_cat_cntr],
+           [CATOBJEXT=.gmo 
+             DATADIRNAME=share],
+           [case $host in
+           *-*-solaris*)
+           dnl On Solaris, if bind_textdomain_codeset is in libc,
+           dnl GNU format message catalog is always supported,
+            dnl since both are added to the libc all together.
+           dnl Hence, we'd like to go with DATADIRNAME=share and
+           dnl and CATOBJEXT=.gmo in this case.
+            AC_CHECK_FUNC(bind_textdomain_codeset,
+             [CATOBJEXT=.gmo 
+               DATADIRNAME=share],
+             [CATOBJEXT=.mo
+               DATADIRNAME=lib])
+           ;;
+           *)
+           CATOBJEXT=.mo
+            DATADIRNAME=lib
+           ;;
+           esac])
+          LIBS="$glib_save_LIBS"
+         INSTOBJEXT=.mo
+       else
+         gt_cv_have_gettext=no
+       fi
+      fi
+    ])
+
+    if test "$gt_cv_have_gettext" = "yes" ; then
+      AC_DEFINE(ENABLE_NLS, 1,
+        [always defined to indicate that i18n is enabled])
+    fi
+
+    dnl Test whether we really found GNU xgettext.
+    if test "$XGETTEXT" != ":"; then
+      dnl If it is not GNU xgettext we define it as : so that the
+      dnl Makefiles still can work.
+      if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+        : ;
+      else
+        AC_MSG_RESULT(
+         [found xgettext program is not GNU xgettext; ignore it])
+        XGETTEXT=":"
+      fi
+    fi
+
+    # We need to process the po/ directory.
+    POSUB=po
+
+    AC_OUTPUT_COMMANDS(
+      [case "$CONFIG_FILES" in *po/Makefile.in*)
+        sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
+      esac])
+
+    dnl These rules are solely for the distribution goal.  While doing this
+    dnl we only have to keep exactly one list of the available catalogs
+    dnl in configure.in.
+    for lang in $ALL_LINGUAS; do
+      GMOFILES="$GMOFILES $lang.gmo"
+      POFILES="$POFILES $lang.po"
+    done
+
+    dnl Make all variables we use known to autoconf.
+    AC_SUBST(CATALOGS)
+    AC_SUBST(CATOBJEXT)
+    AC_SUBST(DATADIRNAME)
+    AC_SUBST(GMOFILES)
+    AC_SUBST(INSTOBJEXT)
+    AC_SUBST(INTLLIBS)
+    AC_SUBST(PO_IN_DATADIR_TRUE)
+    AC_SUBST(PO_IN_DATADIR_FALSE)
+    AC_SUBST(POFILES)
+    AC_SUBST(POSUB)
+  ])
+
+# AM_GLIB_GNU_GETTEXT
+# -------------------
+# Do checks necessary for use of gettext. If a suitable implementation 
+# of gettext is found in either in libintl or in the C library,
+# it will set INTLLIBS to the libraries needed for use of gettext
+# and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable
+# gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST()
+# on various variables needed by the Makefile.in.in installed by 
+# glib-gettextize.
+dnl
+glib_DEFUN([GLIB_GNU_GETTEXT],
+  [AC_REQUIRE([AC_PROG_CC])dnl
+   AC_REQUIRE([AC_HEADER_STDC])dnl
+   
+   GLIB_LC_MESSAGES
+   GLIB_WITH_NLS
+
+   if test "$gt_cv_have_gettext" = "yes"; then
+     if test "x$ALL_LINGUAS" = "x"; then
+       LINGUAS=
+     else
+       AC_MSG_CHECKING(for catalogs to be installed)
+       NEW_LINGUAS=
+       for presentlang in $ALL_LINGUAS; do
+         useit=no
+         if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
+           desiredlanguages="$LINGUAS"
+         else
+           desiredlanguages="$ALL_LINGUAS"
+         fi
+         for desiredlang in $desiredlanguages; do
+          # Use the presentlang catalog if desiredlang is
+           #   a. equal to presentlang, or
+           #   b. a variant of presentlang (because in this case,
+           #      presentlang can be used as a fallback for messages
+           #      which are not translated in the desiredlang catalog).
+           case "$desiredlang" in
+             "$presentlang"*) useit=yes;;
+           esac
+         done
+         if test $useit = yes; then
+           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
+         fi
+       done
+       LINGUAS=$NEW_LINGUAS
+       AC_MSG_RESULT($LINGUAS)
+     fi
+
+     dnl Construct list of names of catalog files to be constructed.
+     if test -n "$LINGUAS"; then
+       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+     fi
+   fi
+
+   dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+   dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
+   dnl Try to locate is.
+   MKINSTALLDIRS=
+   if test -n "$ac_aux_dir"; then
+     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+   fi
+   if test -z "$MKINSTALLDIRS"; then
+     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+   fi
+   AC_SUBST(MKINSTALLDIRS)
+
+   dnl Generate list of files to be processed by xgettext which will
+   dnl be included in po/Makefile.
+   test -d po || mkdir po
+   if test "x$srcdir" != "x."; then
+     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+       posrcprefix="$srcdir/"
+     else
+       posrcprefix="../$srcdir/"
+     fi
+   else
+     posrcprefix="../"
+   fi
+   rm -f po/POTFILES
+   sed -e "/^#/d" -e "/^\$/d" -e "s,.*,        $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+       < $srcdir/po/POTFILES.in > po/POTFILES
+  ])
+
+# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
+# -------------------------------
+# Define VARIABLE to the location where catalog files will
+# be installed by po/Makefile.
+glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
+[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
+glib_save_prefix="$prefix"
+glib_save_exec_prefix="$exec_prefix"
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+test "x$exec_prefix" = xNONE && exec_prefix=$prefix
+if test "x$CATOBJEXT" = "x.mo" ; then
+  localedir=`eval echo "${libdir}/locale"`
+else
+  localedir=`eval echo "${datadir}/locale"`
+fi
+prefix="$glib_save_prefix"
+exec_prefix="$glib_save_exec_prefix"
+AC_DEFINE_UNQUOTED($1, "$localedir",
+  [Define the location where the catalogs will be installed])
+])
+
+dnl
+dnl Now the definitions that aclocal will find
+dnl
+ifdef(glib_configure_in,[],[
+AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
+AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
+])dnl
diff --git a/common/m4/gst-arch.m4 b/common/m4/gst-arch.m4
new file mode 100755 (executable)
index 0000000..8a32bd2
--- /dev/null
@@ -0,0 +1,123 @@
+dnl AG_GST_ARCH
+dnl sets up defines and automake conditionals for host architecture
+dnl checks endianness
+dnl defines HOST_CPU
+
+AC_DEFUN([AG_GST_ARCH],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use host_ variables
+
+  dnl Determine CPU
+  case "x${host_cpu}" in
+    xi?86 | xk? | xi?86_64)
+      HAVE_CPU_I386=yes
+      AC_DEFINE(HAVE_CPU_I386, 1, [Define if the host CPU is an x86])
+  
+      dnl FIXME could use some better detection
+      dnl (ie CPUID)
+      case "x${host_cpu}" in
+        xi386 | xi486) ;;
+        *)
+          AC_DEFINE(HAVE_RDTSC, 1, [Define if RDTSC is available]) ;;
+      esac ;;
+    xpowerpc)
+      HAVE_CPU_PPC=yes
+      AC_DEFINE(HAVE_CPU_PPC, 1, [Define if the host CPU is a PowerPC]) ;;
+    xpowerpc64)
+      HAVE_CPU_PPC64=yes
+      AC_DEFINE(HAVE_CPU_PPC64, 1, [Define if the host CPU is a 64 bit PowerPC]) ;;
+    xalpha*)
+      HAVE_CPU_ALPHA=yes
+      AC_DEFINE(HAVE_CPU_ALPHA, 1, [Define if the host CPU is an Alpha]) ;;
+    xarm*)
+      HAVE_CPU_ARM=yes
+      AC_DEFINE(HAVE_CPU_ARM, 1, [Define if the host CPU is an ARM]) ;;
+    xsparc*)
+      HAVE_CPU_SPARC=yes
+      AC_DEFINE(HAVE_CPU_SPARC, 1, [Define if the host CPU is a SPARC]) ;;
+    xmips*)
+      HAVE_CPU_MIPS=yes
+      AC_DEFINE(HAVE_CPU_MIPS, 1, [Define if the host CPU is a MIPS]) ;;
+    xhppa*)
+      HAVE_CPU_HPPA=yes
+      AC_DEFINE(HAVE_CPU_HPPA, 1, [Define if the host CPU is a HPPA]) ;;
+    xs390*)
+      HAVE_CPU_S390=yes
+      AC_DEFINE(HAVE_CPU_S390, 1, [Define if the host CPU is a S390]) ;;
+    xia64*)
+      HAVE_CPU_IA64=yes
+      AC_DEFINE(HAVE_CPU_IA64, 1, [Define if the host CPU is a IA64]) ;;
+    xm68k*)
+      HAVE_CPU_M68K=yes
+      AC_DEFINE(HAVE_CPU_M68K, 1, [Define if the host CPU is a M68K]) ;;
+    xx86_64)
+      HAVE_CPU_X86_64=yes
+      AC_DEFINE(HAVE_CPU_X86_64, 1, [Define if the host CPU is a x86_64]) ;;
+    xcris)
+      HAVE_CPU_CRIS=yes
+      AC_DEFINE(HAVE_CPU_CRIS, 1, [Define if the host CPU is a CRIS]) ;;
+    xcrisv32)
+      HAVE_CPU_CRISV32=yes
+      AC_DEFINE(HAVE_CPU_CRISV32, 1, [Define if the host CPU is a CRISv32]) ;;
+  esac
+  
+  dnl Determine endianness
+  AC_C_BIGENDIAN
+  
+  AM_CONDITIONAL(HAVE_CPU_I386,       test "x$HAVE_CPU_I386" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_PPC,        test "x$HAVE_CPU_PPC" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_PPC64,      test "x$HAVE_CPU_PPC64" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_ALPHA,      test "x$HAVE_CPU_ALPHA" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_ARM,        test "x$HAVE_CPU_ARM" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_SPARC,      test "x$HAVE_CPU_SPARC" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_HPPA,       test "x$HAVE_CPU_HPPA" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_MIPS,       test "x$HAVE_CPU_MIPS" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_S390,       test "x$HAVE_CPU_S390" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_IA64,       test "x$HAVE_CPU_IA64" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_M68K,       test "x$HAVE_CPU_M68K" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_X86_64,     test "x$HAVE_CPU_X86_64" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_CRIS,       test "x$HAVE_CPU_CRIS" = "xyes")
+  AM_CONDITIONAL(HAVE_CPU_CRISV32,    test "x$HAVE_CPU_CRISV32" = "xyes")
+
+  AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu", [the host CPU])
+])
+
+dnl check if unaligned memory access works correctly
+AC_DEFUN([AG_GST_UNALIGNED_ACCESS], [
+  AC_MSG_CHECKING([if unaligned memory access works correctly])
+  if test x"$as_cv_unaligned_access" = x ; then
+    case $host in
+      alpha*|arm*|hp*|mips*|sh*|sparc*|ia64*)
+        _AS_ECHO_N([(blacklisted) ])
+        as_cv_unaligned_access=no
+       ;;
+      i?86*|powerpc*|m68k*|cris*)
+        _AS_ECHO_N([(whitelisted) ])
+        as_cv_unaligned_access=yes
+       ;;
+    esac
+  else
+    _AS_ECHO_N([(cached) ])
+  fi
+  if test x"$as_cv_unaligned_access" = x ; then
+    AC_TRY_RUN([
+int main(int argc, char **argv)
+{
+  char array[] = "ABCDEFGH";
+  unsigned int iarray[2];
+  memcpy(iarray,array,8);
+#define GET(x) (*(unsigned int *)((char *)iarray + (x)))
+  if(GET(0) != 0x41424344 && GET(0) != 0x44434241) return 1;
+  if(GET(1) != 0x42434445 && GET(1) != 0x45444342) return 1;
+  if(GET(2) != 0x43444546 && GET(2) != 0x46454443) return 1;
+  if(GET(3) != 0x44454647 && GET(3) != 0x47464544) return 1;
+  return 0;
+}
+    ], as_cv_unaligned_access="yes", as_cv_unaligned_access="no")
+  fi
+  AC_MSG_RESULT($as_cv_unaligned_access)
+  if test "$as_cv_unaligned_access" = "yes"; then
+    AC_DEFINE_UNQUOTED(HAVE_UNALIGNED_ACCESS, 1,
+      [defined if unaligned memory access works correctly])
+  fi
+])
diff --git a/common/m4/gst-args.m4 b/common/m4/gst-args.m4
new file mode 100755 (executable)
index 0000000..1781af4
--- /dev/null
@@ -0,0 +1,302 @@
+dnl configure-time options shared among gstreamer modules
+
+dnl AG_GST_ARG_DEBUG
+dnl AG_GST_ARG_PROFILING
+dnl AG_GST_ARG_VALGRIND
+dnl AG_GST_ARG_GCOV
+
+dnl AG_GST_ARG_EXAMPLES
+
+dnl AG_GST_ARG_WITH_PKG_CONFIG_PATH
+dnl AG_GST_ARG_WITH_PACKAGE_NAME
+dnl AG_GST_ARG_WITH_PACKAGE_ORIGIN
+
+dnl AG_GST_ARG_WITH_PLUGINS
+dnl AG_GST_CHECK_PLUGIN
+dnl AG_GST_DISABLE_PLUGIN
+
+dnl AG_GST_ARG_ENABLE_EXTERNAL
+dnl AG_GST_ARG_ENABLE_EXPERIMENTAL
+dnl AG_GST_ARG_ENABLE_BROKEN
+
+AC_DEFUN([AG_GST_ARG_DEBUG],
+[
+  dnl debugging stuff
+  AC_ARG_ENABLE(debug,
+    AC_HELP_STRING([--disable-debug],[disable addition of -g debugging info]),
+    [
+      case "${enableval}" in
+        yes) USE_DEBUG=yes ;;
+        no)  USE_DEBUG=no ;;
+        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
+      esac
+    ],
+    [USE_DEBUG=yes]) dnl Default value
+])
+
+AC_DEFUN([AG_GST_ARG_PROFILING],
+[
+  AC_ARG_ENABLE(profiling,
+    AC_HELP_STRING([--enable-profiling],
+      [adds -pg to compiler commandline, for profiling]),
+    [
+      case "${enableval}" in
+        yes) USE_PROFILING=yes ;;
+        no)  USE_PROFILING=no ;;
+        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-profiling) ;;
+      esac
+    ], 
+    [USE_PROFILING=no]) dnl Default value
+])
+
+AC_DEFUN([AG_GST_ARG_VALGRIND],
+[
+  dnl valgrind inclusion
+  AC_ARG_ENABLE(valgrind,
+    AC_HELP_STRING([--disable-valgrind],[disable run-time valgrind detection]),
+    [
+      case "${enableval}" in
+        yes) USE_VALGRIND="$USE_DEBUG" ;;
+        no)  USE_VALGRIND=no ;;
+        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;;
+      esac
+    ],
+    [USE_VALGRIND="$USE_DEBUG"]) dnl Default value
+  VALGRIND_REQ="2.1"
+  if test "x$USE_VALGRIND" = xyes; then
+    PKG_CHECK_MODULES(VALGRIND, valgrind > $VALGRIND_REQ,
+      USE_VALGRIND="yes",
+      [
+        USE_VALGRIND="no"
+        AC_MSG_RESULT([no])
+      ])
+  fi
+  if test "x$USE_VALGRIND" = xyes; then
+    AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used])
+    AC_MSG_NOTICE(Using extra code paths for valgrind)
+  fi
+])
+
+AC_DEFUN([AG_GST_ARG_GCOV],
+[
+  AC_ARG_ENABLE(gcov,
+    AC_HELP_STRING([--enable-gcov],
+      [compile with coverage profiling instrumentation (gcc only)]),
+    enable_gcov=$enableval,
+    enable_gcov=no)
+  if test x$enable_gcov = xyes ; then
+    if test "x$GCC" != "xyes"
+    then
+      AC_MSG_ERROR([gcov only works if gcc is used])
+    fi
+
+    AS_COMPILER_FLAG(["-fprofile-arcs"],
+      [GCOV_CFLAGS="$GCOV_CFLAGS -fprofile-arcs"],
+      true)
+    AS_COMPILER_FLAG(["-ftest-coverage"],
+      [GCOV_CFLAGS="$GCOV_CFLAGS -ftest-coverage"],
+      true)
+    dnl remove any -O flags - FIXME: is this needed ?
+    GCOV_CFLAGS=`echo "$GCOV_CFLAGS" | sed -e 's/-O[[0-9]]*//g'`
+    dnl libtool 1.5.22 and lower strip -fprofile-arcs from the flags
+    dnl passed to the linker, which is a bug; -fprofile-arcs implicitly
+    dnl links in -lgcov, so we do it explicitly here for the same effect
+    GCOV_LIBS=-lgcov
+    AC_SUBST(GCOV_CFLAGS)
+    AC_SUBST(GCOV_LIBS)
+    GCOV=`echo $CC | sed s/gcc/gcov/g`
+    AC_SUBST(GCOV)
+
+    GST_GCOV_ENABLED=yes
+    AC_DEFINE_UNQUOTED(GST_GCOV_ENABLED, 1,
+      [Defined if gcov is enabled to force a rebuild due to config.h changing])
+    dnl if gcov is used, we do not want default -O2 CFLAGS
+    if test "x$GST_GCOV_ENABLED" = "xyes"
+    then
+      CFLAGS="-O0"
+      AC_SUBST(CFLAGS)
+      CXXFLAGS="-O0"
+      AC_SUBST(CXXFLAGS)
+      FFLAGS="-O0"
+      AC_SUBST(FFLAGS)
+      CCASFLAGS="-O0"
+      AC_SUBST(CCASFLAGS)
+      AC_MSG_NOTICE([gcov enabled, setting CFLAGS and friends to $CFLAGS])
+    fi
+  fi
+  AM_CONDITIONAL(GST_GCOV_ENABLED, test x$enable_gcov = xyes)
+])
+
+AC_DEFUN([AG_GST_ARG_EXAMPLES],
+[
+  AC_ARG_ENABLE(examples,
+    AC_HELP_STRING([--disable-examples], [disable building examples]),
+      [
+        case "${enableval}" in
+          yes) BUILD_EXAMPLES=yes ;;
+          no)  BUILD_EXAMPLES=no ;;
+          *)   AC_MSG_ERROR(bad value ${enableval} for --disable-examples) ;;
+        esac
+      ],
+      [BUILD_EXAMPLES=yes]) dnl Default value
+  AM_CONDITIONAL(BUILD_EXAMPLES,      test "x$BUILD_EXAMPLES" = "xyes")
+])
+
+AC_DEFUN([AG_GST_ARG_WITH_PKG_CONFIG_PATH],
+[
+  dnl possibly modify pkg-config path
+  AC_ARG_WITH(pkg-config-path, 
+     AC_HELP_STRING([--with-pkg-config-path],
+                    [colon-separated list of pkg-config(1) dirs]),
+     [
+       export PKG_CONFIG_PATH=${withval}
+       AC_MSG_NOTICE(Set PKG_CONFIG_PATH to $PKG_CONFIG_PATH)
+     ])
+])
+
+
+dnl This macro requires that GST_CVS is set to yes or no (release)
+AC_DEFUN([AG_GST_ARG_WITH_PACKAGE_NAME],
+[
+  dnl package name in plugins
+  AC_ARG_WITH(package-name,
+    AC_HELP_STRING([--with-package-name],
+      [specify package name to use in plugins]),
+    [
+      case "${withval}" in
+        yes) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
+        no)  AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;;
+        *)   GST_PACKAGE_NAME="${withval}" ;;
+      esac
+    ], 
+    [
+      P=$1
+      if test "x$P" = "x"
+      then
+        P=$PACKAGE_NAME
+      fi
+      
+      dnl default value
+      if test "x$GST_CVS" = "xyes"
+      then
+        dnl nano >= 1
+        GST_PACKAGE_NAME="$P CVS/prerelease"
+      else
+        GST_PACKAGE_NAME="$P source release"
+      fi
+    ]
+  )
+  AC_MSG_NOTICE(Using $GST_PACKAGE_NAME as package name)
+  AC_DEFINE_UNQUOTED(GST_PACKAGE_NAME, "$GST_PACKAGE_NAME",
+      [package name in plugins])
+  AC_SUBST(GST_PACKAGE_NAME)
+])
+
+AC_DEFUN([AG_GST_ARG_WITH_PACKAGE_ORIGIN],
+[
+  dnl package origin URL
+  AC_ARG_WITH(package-origin,
+    AC_HELP_STRING([--with-package-origin],
+      [specify package origin URL to use in plugins]),
+    [
+      case "${withval}" in
+        yes) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
+        no)  AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;;
+        *)   GST_PACKAGE_ORIGIN="${withval}" ;;
+      esac
+    ], 
+    [GST_PACKAGE_ORIGIN="[Unknown package origin]"] dnl Default value
+  )
+  AC_MSG_NOTICE(Using $GST_PACKAGE_ORIGIN as package origin)
+  AC_DEFINE_UNQUOTED(GST_PACKAGE_ORIGIN, "$GST_PACKAGE_ORIGIN",
+      [package origin])
+  AC_SUBST(GST_PACKAGE_ORIGIN)
+])
+
+dnl sets WITH_PLUGINS to the list of plug-ins given as an argument
+dnl also clears GST_PLUGINS_ALL and GST_PLUGINS_SELECTED
+AC_DEFUN([AG_GST_ARG_WITH_PLUGINS],
+[
+  AC_ARG_WITH(plugins,
+    AC_HELP_STRING([--with-plugins],
+      [comma-separated list of dependencyless plug-ins to compile]),
+    [WITH_PLUGINS=$withval],
+    [WITH_PLUGINS=])
+
+  GST_PLUGINS_ALL=""
+  GST_PLUGINS_SELECTED=""
+
+  AC_SUBST(GST_PLUGINS_ALL)
+  AC_SUBST(GST_PLUGINS_SELECTED)
+])
+
+dnl AG_GST_CHECK_PLUGIN(PLUGIN-NAME)
+dnl
+dnl This macro adds the plug-in <PLUGIN-NAME> to GST_PLUGINS_ALL. Then it
+dnl checks if the plug-in is present in WITH_PLUGINS, and if so adds it to
+dnl GST_PLUGINS_SELECTED.
+dnl
+dnl The macro will call AM_CONDITIONAL(USE_PLUGIN_<PLUGIN-NAME>, ...) to allow
+dnl control of what is built in Makefile.ams.
+AC_DEFUN([AG_GST_CHECK_PLUGIN],
+[
+  GST_PLUGINS_ALL="$GST_PLUGINS_ALL [$1]"
+  if [[ -z "$WITH_PLUGINS" ]] || echo " [$WITH_PLUGINS] " | tr , ' ' | grep -i " [$1] " > /dev/null; then
+    GST_PLUGINS_SELECTED="$GST_PLUGINS_SELECTED [$1]"
+  fi
+  AM_CONDITIONAL([USE_PLUGIN_]translit([$1], a-z, A-Z), echo " $GST_PLUGINS_SELECTED " | grep -i " [$1] " > /dev/null)
+])
+
+dnl AG_GST_DISABLE_PLUGIN(PLUGIN-NAME)
+dnl
+dnl This macro disables the plug-in <PLUGIN-NAME> by removing it from
+dnl GST_PLUGINS_SELECTED.
+AC_DEFUN([AG_GST_DISABLE_PLUGIN],
+[
+  GST_PLUGINS_SELECTED=`echo " $GST_PLUGINS_SELECTED " | $SED -e 's/ [$1] / /'`
+  AM_CONDITIONAL([USE_PLUGIN_]translit([$1], a-z, A-Z), false)
+])
+
+AC_DEFUN([AG_GST_ARG_ENABLE_EXTERNAL],
+[
+  AG_GST_CHECK_FEATURE(EXTERNAL, [building of plug-ins with external deps],,
+    HAVE_EXTERNAL=yes, enabled,
+    [
+      AC_MSG_NOTICE(building external plug-ins)
+      BUILD_EXTERNAL="yes"
+    ],[
+      AC_MSG_WARN(all plug-ins with external dependencies will not be built)
+      BUILD_EXTERNAL="no"
+    ])
+  # make BUILD_EXTERNAL available to Makefile.am
+  AM_CONDITIONAL(BUILD_EXTERNAL, test "x$BUILD_EXTERNAL" = "xyes")
+])
+
+dnl experimental plug-ins; stuff that hasn't had the dust settle yet
+dnl read 'builds, but might not work'
+AC_DEFUN([AG_GST_ARG_ENABLE_EXPERIMENTAL],
+[
+  AG_GST_CHECK_FEATURE(EXPERIMENTAL, [building of experimental plug-ins],,
+    HAVE_EXPERIMENTAL=yes, disabled,
+    [
+      AC_MSG_WARN(building experimental plug-ins)
+      BUILD_EXPERIMENTAL="yes"
+    ],[
+      AC_MSG_NOTICE(not building experimental plug-ins)
+      BUILD_EXPERIMENTAL="no"
+    ])
+  # make BUILD_EXPERIMENTAL available to Makefile.am
+  AM_CONDITIONAL(BUILD_EXPERIMENTAL, test "x$BUILD_EXPERIMENTAL" = "xyes")
+])
+
+dnl broken plug-ins; stuff that doesn't seem to build at the moment
+AC_DEFUN([AG_GST_ARG_ENABLE_BROKEN],
+[
+  AG_GST_CHECK_FEATURE(BROKEN, [building of broken plug-ins],,
+    HAVE_BROKEN=yes, disabled,
+    [
+      AC_MSG_WARN([building broken plug-ins -- no bug reports on these, only patches ...])
+    ],[
+      AC_MSG_NOTICE([not building broken plug-ins])
+    ])
+])
diff --git a/common/m4/gst-check.m4 b/common/m4/gst-check.m4
new file mode 100755 (executable)
index 0000000..3f6b8ff
--- /dev/null
@@ -0,0 +1,138 @@
+dnl pkg-config-based checks for GStreamer modules and dependency modules
+
+dnl generic:
+dnl AG_GST_PKG_CHECK_MODULES([PREFIX], [WHICH], [REQUIRED])
+dnl sets HAVE_[$PREFIX], [$PREFIX]_*
+dnl AG_GST_CHECK_MODULES([PREFIX], [MODULE], [MINVER], [NAME], [REQUIRED])
+dnl sets HAVE_[$PREFIX], [$PREFIX]_*
+
+dnl specific:
+dnl AG_GST_CHECK_GST([MAJMIN], [MINVER], [REQUIRED])
+dnl   also sets/ACSUBSTs GST_TOOLS_DIR and GST_PLUGINS_DIR
+dnl AG_GST_CHECK_GST_BASE([MAJMIN], [MINVER], [REQUIRED])
+dnl AG_GST_CHECK_GST_GDP([MAJMIN], [MINVER], [REQUIRED])
+dnl AG_GST_CHECK_GST_CONTROLLER([MAJMIN], [MINVER], [REQUIRED])
+dnl AG_GST_CHECK_GST_CHECK([MAJMIN], [MINVER], [REQUIRED])
+dnl AG_GST_CHECK_GST_PLUGINS_BASE([MAJMIN], [MINVER], [REQUIRED])
+dnl   also sets/ACSUBSTs GSTPB_PLUGINS_DIR
+
+AC_DEFUN([AG_GST_PKG_CHECK_MODULES],
+[
+  which="[$2]"
+  dnl not required by default, since we use this mostly for plugin deps
+  required=ifelse([$3], , "no", [$3])
+
+  PKG_CHECK_MODULES([$1], $which,
+    [
+      HAVE_[$1]="yes"
+    ],
+    [
+      HAVE_[$1]="no"
+      AC_MSG_RESULT(no)
+      if test "x$required" = "xyes"; then
+        AC_MSG_ERROR($[$1]_PKG_ERRORS)
+      else
+        AC_MSG_NOTICE($[$1]_PKG_ERRORS)
+      fi
+    ])
+
+  dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7
+  dnl It gets done automatically in automake >= 1.7, which we now require
+]))
+
+AC_DEFUN([AG_GST_CHECK_MODULES],
+[
+  module=[$2]
+  minver=[$3]
+  name="[$4]"
+  required=ifelse([$5], , "yes", [$5]) dnl required by default
+
+  PKG_CHECK_MODULES([$1], $module >= $minver,
+    [
+      HAVE_[$1]="yes"
+    ],
+    [
+      HAVE_[$1]="no"
+      AC_MSG_RESULT(no)
+      AC_MSG_NOTICE($[$1]_PKG_ERRORS)
+      if test "x$required" = "xyes"; then
+        AC_MSG_ERROR([no $module >= $minver ($name) found])
+      else
+        AC_MSG_NOTICE([no $module >= $minver ($name) found])
+      fi
+    ])
+
+  dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7
+  dnl It gets done automatically in automake >= 1.7, which we now require
+]))
+
+AC_DEFUN([AG_GST_CHECK_GST],
+[
+  AG_GST_CHECK_MODULES(GST, gstreamer-[$1], [$2], [GStreamer], [$3])
+  dnl allow setting before calling this macro to override
+  if test -z $GST_TOOLS_DIR; then
+    GST_TOOLS_DIR=`$PKG_CONFIG --variable=toolsdir gstreamer-[$1]`
+    if test -z $GST_TOOLS_DIR; then
+      AC_MSG_ERROR(
+        [no tools dir set in GStreamer pkg-config file, core upgrade needed.])
+    fi
+  fi
+  AC_MSG_NOTICE([using GStreamer tools in $GST_TOOLS_DIR])
+  AC_SUBST(GST_TOOLS_DIR)
+
+  dnl check for where core plug-ins got installed
+  dnl this is used for unit tests
+  dnl allow setting before calling this macro to override
+  if test -z $GST_PLUGINS_DIR; then
+    GST_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-[$1]`
+    if test -z $GST_PLUGINS_DIR; then
+      AC_MSG_ERROR(
+        [no pluginsdir set in GStreamer pkg-config file, core upgrade needed.])
+    fi
+  fi
+  AC_MSG_NOTICE([using GStreamer plug-ins in $GST_PLUGINS_DIR])
+  AC_SUBST(GST_PLUGINS_DIR)
+])
+
+AC_DEFUN([AG_GST_CHECK_GST_BASE],
+[
+  AG_GST_CHECK_MODULES(GST_BASE, gstreamer-base-[$1], [$2],
+    [GStreamer Base Libraries], [$3])
+])
+  
+AC_DEFUN([AG_GST_CHECK_GST_GDP],
+[
+  AG_GST_CHECK_MODULES(GST_GDP, gstreamer-dataprotocol-[$1], [$2],
+    [GStreamer Data Protocol Library], [$3])
+])
+  
+AC_DEFUN([AG_GST_CHECK_GST_CONTROLLER],
+[
+  AG_GST_CHECK_MODULES(GST_CONTROLLER, gstreamer-controller-[$1], [$2],
+    [GStreamer Controller Library], [$3])
+])  
+
+AC_DEFUN([AG_GST_CHECK_GST_CHECK],
+[
+  AG_GST_CHECK_MODULES(GST_CHECK, gstreamer-check-[$1], [$2],
+    [GStreamer Check unittest Library], [$3])
+])
+
+AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_BASE],
+[
+  AG_GST_CHECK_MODULES(GST_PLUGINS_BASE, gstreamer-plugins-base-[$1], [$2],
+    [GStreamer Base Plug-ins Library], [$3])
+
+  dnl check for where base plug-ins got installed
+  dnl this is used for unit tests
+  dnl allow setting before calling this macro to override
+  if test -z $GSTPB_PLUGINS_DIR; then
+    GSTPB_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-base-[$1]`
+    if test -z $GSTPB_PLUGINS_DIR; then
+      AC_MSG_ERROR(
+        [no pluginsdir set in GStreamer Base Plug-ins pkg-config file])
+    fi
+  fi
+  AC_MSG_NOTICE([using GStreamer Base Plug-ins in $GSTPB_PLUGINS_DIR])
+  AC_SUBST(GSTPB_PLUGINS_DIR)
+])
diff --git a/common/m4/gst-debuginfo.m4 b/common/m4/gst-debuginfo.m4
new file mode 100755 (executable)
index 0000000..b48854d
--- /dev/null
@@ -0,0 +1,46 @@
+AC_DEFUN([AG_GST_DEBUGINFO], [
+AC_ARG_ENABLE(debug,
+AC_HELP_STRING([--disable-debug],[disable addition of -g debugging info]),
+[case "${enableval}" in
+  yes) USE_DEBUG=yes ;;
+  no)  USE_DEBUG=no ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
+esac],
+[USE_DEBUG=yes]) dnl Default value
+
+AC_ARG_ENABLE(DEBUG,
+AC_HELP_STRING([--disable-DEBUG],[disables compilation of debugging messages]),
+[case "${enableval}" in
+  yes) ENABLE_DEBUG=yes ;;
+  no)  ENABLE_DEBUG=no ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-DEBUG) ;;
+esac],
+[ENABLE_DEBUG=yes]) dnl Default value
+if test x$ENABLE_DEBUG = xyes; then
+  AC_DEFINE(GST_DEBUG_ENABLED, 1, [Define if DEBUG statements should be compiled in])
+fi
+
+AC_ARG_ENABLE(INFO,
+AC_HELP_STRING([--disable-INFO],[disables compilation of informational messages]),
+[case "${enableval}" in
+  yes) ENABLE_INFO=yes ;;
+  no)  ENABLE_INFO=no ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-INFO) ;;
+esac],
+[ENABLE_INFO=yes]) dnl Default value
+if test x$ENABLE_INFO = xyes; then
+  AC_DEFINE(GST_INFO_ENABLED, 1, [Define if INFO statements should be compiled in])
+fi
+
+AC_ARG_ENABLE(debug-color,
+AC_HELP_STRING([--disable-debug-color],[disables color output of DEBUG and INFO output]),
+[case "${enableval}" in
+  yes) ENABLE_DEBUG_COLOR=yes ;;
+  no)  ENABLE_DEBUG_COLOR=no ;;
+  *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug-color) ;;
+esac],
+[ENABLE_DEBUG_COLOR=yes]) dnl Default value
+if test "x$ENABLE_DEBUG_COLOR" = xyes; then
+  AC_DEFINE(GST_DEBUG_COLOR, 1, [Define if debugging messages should be colorized])
+fi
+])
diff --git a/common/m4/gst-default.m4 b/common/m4/gst-default.m4
new file mode 100755 (executable)
index 0000000..da1a81c
--- /dev/null
@@ -0,0 +1,45 @@
+dnl default elements used for tests and such
+
+dnl AG_GST_DEFAULT_ELEMENTS
+
+AC_DEFUN([AG_GST_DEFAULT_ELEMENTS],
+[
+  dnl decide on default elements
+  dnl FIXME: provide configure-time options for this
+  dnl FIXME: describe where exactly this gets used
+  dnl FIXME: decide if it's a problem that this could point to sinks from
+  dnl        depending plugin modules
+  DEFAULT_AUDIOSINK="autoaudiosink"
+  DEFAULT_VIDEOSINK="autovideosink"
+  DEFAULT_AUDIOSRC="alsasrc"
+  DEFAULT_VIDEOSRC="v4lsrc"
+  DEFAULT_VISUALIZER="goom"
+  case "$host" in
+    *-sun-* | *pc-solaris* )
+      DEFAULT_AUDIOSINK="sunaudiosink"
+      DEFAULT_VIDEOSINK="ximagesink"
+      DEFAULT_AUDIOSRC="sunaudiosrc"
+      ;;
+    *-darwin* )
+      DEFAULT_AUDIOSINK="osxaudiosink"
+      DEFAULT_AUDIOSRC="osxaudiosrc"
+      DEFAULT_VIDEOSINK="osxvideosink"
+      ;;
+  esac
+  
+  AC_SUBST(DEFAULT_AUDIOSINK)
+  AC_DEFINE_UNQUOTED(DEFAULT_AUDIOSINK, "$DEFAULT_AUDIOSINK",
+    [Default audio sink])
+  AC_SUBST(DEFAULT_AUDIOSRC)
+  AC_DEFINE_UNQUOTED(DEFAULT_AUDIOSRC, "$DEFAULT_AUDIOSRC",
+    [Default audio source])
+  AC_SUBST(DEFAULT_VIDEOSINK)
+  AC_DEFINE_UNQUOTED(DEFAULT_VIDEOSINK, "$DEFAULT_VIDEOSINK",
+    [Default video sink])
+  AC_SUBST(DEFAULT_VIDEOSRC)
+  AC_DEFINE_UNQUOTED(DEFAULT_VIDEOSRC, "$DEFAULT_VIDEOSRC",
+    [Default video source])
+  AC_SUBST(DEFAULT_VISUALIZER)
+  AC_DEFINE_UNQUOTED(DEFAULT_VISUALIZER, "$DEFAULT_VISUALIZER",
+    [Default visualizer])
+])
diff --git a/common/m4/gst-doc.m4 b/common/m4/gst-doc.m4
new file mode 100755 (executable)
index 0000000..7000c17
--- /dev/null
@@ -0,0 +1,148 @@
+AC_DEFUN([AG_GST_DOCBOOK_CHECK],
+[
+  dnl choose a location to install docbook docs in
+  if test "x$PACKAGE_TARNAME" = "x"
+  then
+    AC_MSG_ERROR([Internal error - PACKAGE_TARNAME not set])
+  fi
+  docdir="\$(datadir)/doc/$PACKAGE_TARNAME-$GST_MAJORMINOR"
+
+  dnl enable/disable docbook documentation building
+  AC_ARG_ENABLE(docbook,
+  AC_HELP_STRING([--enable-docbook],
+                 [use docbook to build documentation [default=no]]),,
+                 enable_docbook=no)
+
+  have_docbook=no
+
+  if test x$enable_docbook = xyes; then
+    dnl check if we actually have everything we need
+
+    dnl check for docbook tools
+    AC_CHECK_PROG(HAVE_DOCBOOK2PS, docbook2ps, yes, no)
+    AC_CHECK_PROG(HAVE_DOCBOOK2HTML, docbook2html, yes, no)
+    AC_CHECK_PROG(HAVE_JADETEX, jadetex, yes, no)
+    AC_CHECK_PROG(HAVE_PS2PDF, ps2pdf, yes, no)
+
+    # -V option appeared in 0.6.10
+    docbook2html_min_version=0.6.10
+    if test "x$HAVE_DOCBOOK2HTML" != "xno"; then
+      docbook2html_version=`docbook2html --version`
+      AC_MSG_CHECKING([docbook2html version ($docbook2html_version) >= $docbook2html_min_version])
+      if perl -w <<EOF
+        (\$min_version_major, \$min_version_minor, \$min_version_micro ) = "$docbook2html_min_version" =~ /(\d+)\.(\d+)\.(\d+)/;
+        (\$docbook2html_version_major, \$docbook2html_version_minor, \$docbook2html_version_micro ) = "$docbook2html_version" =~ /(\d+)\.(\d+)\.(\d+)/;
+        exit (((\$docbook2html_version_major > \$min_version_major) ||
+            ((\$docbook2html_version_major == \$min_version_major) &&
+             (\$docbook2html_version_minor >= \$min_version_minor)) ||
+            ((\$docbook2html_version_major == \$min_version_major) &&
+             (\$docbook2html_version_minor >= \$min_version_minor) &&
+             (\$docbook2html_version_micro >= \$min_version_micro)))
+            ? 0 : 1);
+EOF
+      then
+        AC_MSG_RESULT(yes)
+      else
+        AC_MSG_RESULT(no)
+        HAVE_DOCBOOK2HTML=no
+      fi
+    fi
+
+    dnl check if we can process docbook stuff
+    AS_DOCBOOK(have_docbook=yes, have_docbook=no)
+    dnl check for extra tools
+    AC_CHECK_PROG(HAVE_DVIPS, dvips, yes, no)
+    AC_CHECK_PROG(HAVE_XMLLINT, xmllint, yes, no)
+    dnl check for image conversion tools
+    AC_CHECK_PROG(HAVE_FIG2DEV, fig2dev, yes, no)
+    if test "x$HAVE_FIG2DEV" = "xno" ; then
+      AC_MSG_WARN([Did not find fig2dev (from xfig), images will not be generated.])
+    fi
+    dnl The following is a hack: if fig2dev doesn't display an error message
+    dnl for the desired type, we assume it supports it.
+    HAVE_FIG2DEV_EPS=no
+    if test "x$HAVE_FIG2DEV" = "xyes" ; then
+      fig2dev_quiet=`fig2dev -L eps </dev/null 2>&1 >/dev/null`
+      if test "x$fig2dev_quiet" = "x" ; then
+        HAVE_FIG2DEV_EPS=yes
+      fi
+    fi
+    HAVE_FIG2DEV_PNG=no
+    if test "x$HAVE_FIG2DEV" = "xyes" ; then
+      fig2dev_quiet=`fig2dev -L png </dev/null 2>&1 >/dev/null`
+      if test "x$fig2dev_quiet" = "x" ; then
+        HAVE_FIG2DEV_PNG=yes
+      fi
+    fi
+    HAVE_FIG2DEV_PDF=no
+    if test "x$HAVE_FIG2DEV" = "xyes" ; then
+      fig2dev_quiet=`fig2dev -L pdf </dev/null 2>&1 >/dev/null`
+      if test "x$fig2dev_quiet" = "x" ; then
+        HAVE_FIG2DEV_PDF=yes
+      fi
+    fi
+  
+    AC_CHECK_PROG(HAVE_PNGTOPNM, pngtopnm, yes, no)
+    AC_CHECK_PROG(HAVE_PNMTOPS,  pnmtops,  yes, no)
+    AC_CHECK_PROG(HAVE_EPSTOPDF, epstopdf, yes, no)
+  
+    dnl check if we can generate HTML
+    if test "x$HAVE_DOCBOOK2HTML" = "xyes" && \
+       test "x$enable_docbook" = "xyes" && \
+       test "x$HAVE_XMLLINT" = "xyes" && \
+       test "x$HAVE_FIG2DEV_PNG" = "xyes"; then
+      DOC_HTML=yes
+      AC_MSG_NOTICE(Will output HTML documentation)
+     else
+      DOC_HTML=no
+      AC_MSG_NOTICE(Will not output HTML documentation)
+    fi
+    
+    dnl check if we can generate PS
+    if test "x$HAVE_DOCBOOK2PS" = "xyes" && \
+       test "x$enable_docbook" = "xyes" && \
+       test "x$HAVE_XMLLINT" = "xyes" && \
+       test "x$HAVE_JADETEX" = "xyes" && \
+       test "x$HAVE_FIG2DEV_EPS" = "xyes" && \
+       test "x$HAVE_DVIPS" = "xyes" && \
+       test "x$HAVE_PNGTOPNM" = "xyes" && \
+       test "x$HAVE_PNMTOPS" = "xyes"; then
+      DOC_PS=yes
+      AC_MSG_NOTICE(Will output PS documentation)
+    else
+      DOC_PS=no
+      AC_MSG_NOTICE(Will not output PS documentation)
+    fi
+    
+    dnl check if we can generate PDF - using only ps2pdf
+    if test "x$DOC_PS" = "xyes" && \
+       test "x$enable_docbook" = "xyes" && \
+       test "x$HAVE_XMLLINT" = "xyes" && \
+       test "x$HAVE_PS2PDF" = "xyes"; then
+      DOC_PDF=yes
+      AC_MSG_NOTICE(Will output PDF documentation)
+    else
+      DOC_PDF=no
+      AC_MSG_NOTICE(Will not output PDF documentation)
+    fi
+
+    dnl if we don't have everything, we should disable
+    if test "x$have_docbook" != "xyes"; then
+      enable_docbook=no
+    fi
+  fi
+
+  dnl if we're going to install documentation, tell us where
+  if test "x$have_docbook" = "xyes"; then
+    AC_MSG_NOTICE(Installing documentation in $docdir)
+    AC_SUBST(docdir)
+  fi
+
+  AM_CONDITIONAL(ENABLE_DOCBOOK,      test x$enable_docbook = xyes)
+  AM_CONDITIONAL(DOC_HTML,            test x$DOC_HTML = xyes)
+  AM_CONDITIONAL(DOC_PDF,             test x$DOC_PDF = xyes)
+  AM_CONDITIONAL(DOC_PS,              test x$DOC_PS = xyes)
+])
diff --git a/common/m4/gst-error.m4 b/common/m4/gst-error.m4
new file mode 100755 (executable)
index 0000000..f97f9a6
--- /dev/null
@@ -0,0 +1,145 @@
+Dnl handle various error-related things
+
+dnl Thomas Vander Stichele <thomas@apestaart.org>
+dnl Tim-Philipp Müller <tim centricular net>
+
+dnl Last modification: 2008-02-18
+
+dnl AG_GST_SET_ERROR_CFLAGS([ADD-WERROR])
+dnl AG_GST_SET_ERROR_CXXFLAGS([ADD-WERROR])
+dnl AG_GST_SET_LEVEL_DEFAULT([IS-CVS-VERSION])
+
+
+dnl Sets ERROR_CFLAGS to something the compiler will accept.
+dnl AC_SUBST them so they are available in Makefile
+
+dnl -Wall is added if it is supported
+dnl -Werror is added if ADD-WERROR is not "no"
+
+dnl These flags can be overridden at make time:
+dnl make ERROR_CFLAGS=
+AC_DEFUN([AG_GST_SET_ERROR_CFLAGS],
+[
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AS_COMPILER_FLAG])
+
+  
+  dnl if we support -Wall, set it unconditionally
+  AS_COMPILER_FLAG(-Wall,
+                   ERROR_CFLAGS="-Wall",
+                   ERROR_CFLAGS="")
+  
+  dnl if asked for, add -Werror if supported
+  if test "x$1" != "xno"
+  then
+    AS_COMPILER_FLAG(-Werror, ERROR_CFLAGS="$ERROR_CFLAGS -Werror")
+
+    dnl if -Werror isn't suported, try -errwarn=%all (Sun Forte case)
+    if test "x$ERROR_CFLAGS" == "x"
+    then
+      AS_COMPILER_FLAG([-errwarn=%all], [
+          ERROR_CFLAGS="-errwarn=%all"
+          dnl try -errwarn=%all,no%E_EMPTY_DECLARATION,
+          dnl no%E_STATEMENT_NOT_REACHED,no%E_ARGUEMENT_MISMATCH,
+          dnl no%E_MACRO_REDEFINED (Sun Forte case)
+          dnl For Forte we need disable "empty declaration" warning produced by un-needed semicolon 
+          dnl "statement not reached" disabled because there is g_assert_not_reached () in some places
+          dnl "macro redefined" because of gst/gettext.h
+          dnl FIXME: is it really supposed to be 'ARGUEMENT' and not 'ARGUMENT'?
+          for f in 'no%E_EMPTY_DECLARATION' \
+                   'no%E_STATEMENT_NOT_REACHED' \
+                   'no%E_ARGUEMENT_MISMATCH' \
+                   'no%E_MACRO_REDEFINED'
+          do
+            AS_COMPILER_FLAG([-errwarn=%all,$f], [
+              ERROR_CFLAGS="$ERROR_CFLAGS,$f"
+            ])
+          done
+      ])
+    fi
+  fi
+
+  AC_SUBST(ERROR_CFLAGS)
+  AC_MSG_NOTICE([set ERROR_CFLAGS to $ERROR_CFLAGS])
+])
+
+dnl Sets ERROR_CXXFLAGS to something the compiler will accept.
+dnl AC_SUBST them so they are available in Makefile
+
+dnl -Wall is added if it is supported
+dnl -Werror is added if ADD-WERROR is not "no"
+
+dnl These flags can be overridden at make time:
+dnl make ERROR_CXXFLAGS=
+AC_DEFUN([AG_GST_SET_ERROR_CXXFLAGS],
+[
+  AC_REQUIRE([AC_PROG_CXX])
+  AC_REQUIRE([AS_CXX_COMPILER_FLAG])
+
+  
+  dnl if we support -Wall, set it unconditionally
+  AS_CXX_COMPILER_FLAG(-Wall, [
+      ERROR_CXXFLAGS="-Wall"
+  ], [
+      ERROR_CXXFLAGS=""
+  ])
+  
+  dnl if asked for, add -Werror if supported
+  if test "x$1" != "xno"
+  then
+    AS_CXX_COMPILER_FLAG(-Werror, werror_supported=yes, werror_supported=no)
+
+    if test "x$werror_supported" = "xyes"; then
+        ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror"
+
+        dnl add exceptions
+        for f in '-Wno-non-virtual-dtor'
+        do
+          AS_CXX_COMPILER_FLAG([$f], ERROR_CXXFLAGS="$ERROR_CXXFLAGS $f")
+        done
+    else
+      dnl if -Werror isn't suported, try -errwarn=%all
+      AS_CXX_COMPILER_FLAG([-errwarn=%all], errwarnall=yes, errwarnall=no)
+      if test "x$errwarnall" = "xyes"; then
+        ERROR_CXXFLAGS="-errwarn=%all"
+        dnl try -errwarn=%all,no%E_EMPTY_DECLARATION,
+        dnl no%E_STATEMENT_NOT_REACHED,no%E_ARGUEMENT_MISMATCH,
+        dnl no%E_MACRO_REDEFINED (Sun Forte case)
+        dnl For Forte we need disable "empty declaration" warning produced by un-needed semicolon 
+        dnl "statement not reached" disabled because there is g_assert_not_reached () in some places
+        dnl "macro redefined" because of gst/gettext.h
+        dnl FIXME: is it really supposed to be 'ARGUEMENT' and not 'ARGUMENT'?
+        dnl FIXME: do any of these work with the c++ compiler? if not, why
+        dnl do we check at all?
+        for f in 'no%E_EMPTY_DECLARATION' \
+                 'no%E_STATEMENT_NOT_REACHED' \
+                 'no%E_ARGUEMENT_MISMATCH' \
+                 'no%E_MACRO_REDEFINED'
+        do
+          AS_CXX_COMPILER_FLAG([-errwarn=%all,$f], [
+            ERROR_CXXFLAGS="$ERROR_CXXFLAGS,$f"
+          ])
+        done
+      fi
+    fi
+  fi
+
+  AC_SUBST(ERROR_CXXFLAGS)
+  AC_MSG_NOTICE([set ERROR_CXXFLAGS to $ERROR_CXXFLAGS])
+])
+
+dnl Sets the default error level for debugging messages
+AC_DEFUN([AG_GST_SET_LEVEL_DEFAULT],
+[
+  dnl define correct errorlevel for debugging messages. We want to have
+  dnl GST_ERROR messages printed when running cvs builds
+  if test "x[$1]" = "xyes"; then
+    GST_LEVEL_DEFAULT=GST_LEVEL_ERROR
+  else
+    GST_LEVEL_DEFAULT=GST_LEVEL_NONE
+  fi
+  AC_DEFINE_UNQUOTED(GST_LEVEL_DEFAULT, $GST_LEVEL_DEFAULT,
+    [Default errorlevel to use])
+  dnl AC_SUBST so we can use it for win32/common/config.h
+  AC_SUBST(GST_LEVEL_DEFAULT)
+])
diff --git a/common/m4/gst-feature.m4 b/common/m4/gst-feature.m4
new file mode 100755 (executable)
index 0000000..6777029
--- /dev/null
@@ -0,0 +1,286 @@
+dnl Perform a check for a feature for GStreamer
+dnl Richard Boulton <richard-alsa@tartarus.org>
+dnl Thomas Vander Stichele <thomas@apestaart.org> added useful stuff
+dnl Last modification: 25/06/2001
+dnl
+dnl AG_GST_CHECK_FEATURE(FEATURE-NAME, FEATURE-DESCRIPTION,
+dnl                   DEPENDENT-PLUGINS, TEST-FOR-FEATURE,
+dnl                   DISABLE-BY-DEFAULT, ACTION-IF-USE, ACTION-IF-NOTUSE)
+dnl
+dnl This macro adds a command line argument to allow the user to enable
+dnl or disable a feature, and if the feature is enabled, performs a supplied
+dnl test to check if the feature is available.
+dnl
+dnl The test should define HAVE_<FEATURE-NAME> to "yes" or "no" depending
+dnl on whether the feature is available.
+dnl
+dnl The macro will set USE_<FEATURE-NAME> to "yes" or "no" depending on
+dnl whether the feature is to be used.
+dnl Thomas changed this, so that when USE_<FEATURE-NAME> was already set
+dnl to no, then it stays that way.
+dnl
+dnl The macro will call AM_CONDITIONAL(USE_<FEATURE-NAME>, ...) to allow
+dnl the feature to control what is built in Makefile.ams.  If you want
+dnl additional actions resulting from the test, you can add them with the
+dnl ACTION-IF-USE and ACTION-IF-NOTUSE parameters.
+dnl
+dnl FEATURE-NAME        is the name of the feature, and should be in
+dnl                     purely upper case characters.
+dnl FEATURE-DESCRIPTION is used to describe the feature in help text for
+dnl                     the command line argument.
+dnl DEPENDENT-PLUGINS   lists any plug-ins which depend on this feature.
+dnl TEST-FOR-FEATURE    is a test which sets HAVE_<FEATURE-NAME> to "yes"
+dnl                     or "no" depending on whether the feature is
+dnl                     available.
+dnl DISABLE-BY-DEFAULT  if "disabled", the feature is disabled by default,
+dnl                     if any other value, the feature is enabled by default.
+dnl ACTION-IF-USE       any extra actions to perform if the feature is to be
+dnl                     used.
+dnl ACTION-IF-NOTUSE    any extra actions to perform if the feature is not to
+dnl                     be used.
+dnl
+dnl
+dnl thomas :
+dnl we also added a history.
+dnl GST_PLUGINS_YES will contain all plugins to be built
+dnl                 that were checked through AG_GST_CHECK_FEATURE
+dnl GST_PLUGINS_NO will contain those that won't be built
+
+AC_DEFUN([AG_GST_CHECK_FEATURE],
+[echo
+AC_MSG_NOTICE(*** checking feature: [$2] ***)
+if test "x[$3]" != "x"
+then
+  AC_MSG_NOTICE(*** for plug-ins: [$3] ***)
+fi
+dnl
+builtin(define, [gst_endisable], ifelse($5, [disabled], [enable], [disable]))dnl
+dnl if it is set to NO, then don't even consider it for building
+NOUSE=
+if test "x$USE_[$1]" = "xno"; then
+  NOUSE="yes"
+fi
+AC_ARG_ENABLE(translit([$1], A-Z, a-z),
+  [  ]builtin(format, --%-26s gst_endisable %s, gst_endisable-translit([$1], A-Z, a-z), [$2]ifelse([$3],,,: [$3])),
+  [ case "${enableval}" in
+      yes) USE_[$1]=yes;;
+      no) USE_[$1]=no;;
+      *) AC_MSG_ERROR(bad value ${enableval} for --enable-translit([$1], A-Z, a-z)) ;;
+    esac],
+  [ USE_$1=]ifelse($5, [disabled], [no], [yes]))           dnl DEFAULT
+
+dnl *** set it back to no if it was preset to no
+if test "x$NOUSE" = "xyes"; then
+  USE_[$1]="no"
+  AC_MSG_WARN(*** $3 pre-configured not to be built)
+fi
+NOUSE=
+
+dnl *** If it's enabled
+
+if test x$USE_[$1] = xyes; then
+  dnl save compile variables before the test
+
+  gst_check_save_LIBS=$LIBS
+  gst_check_save_LDFLAGS=$LDFLAGS
+  gst_check_save_CFLAGS=$CFLAGS
+  gst_check_save_CPPFLAGS=$CPPFLAGS
+  gst_check_save_CXXFLAGS=$CXXFLAGS
+
+  HAVE_[$1]=no
+  dnl TEST_FOR_FEATURE
+  $4
+
+  LIBS=$gst_check_save_LIBS
+  LDFLAGS=$gst_check_save_LDFLAGS
+  CFLAGS=$gst_check_save_CFLAGS
+  CPPFLAGS=$gst_check_save_CPPFLAGS
+  CXXFLAGS=$gst_check_save_CXXFLAGS
+
+  dnl If it isn't found, unset USE_[$1]
+  if test x$HAVE_[$1] = xno; then
+    USE_[$1]=no
+  else
+    ifelse([$3], , :, [AC_MSG_NOTICE(*** These plugins will be built: [$3])])
+  fi
+fi
+dnl *** Warn if it's disabled or not found
+if test x$USE_[$1] = xyes; then
+  ifelse([$6], , :, [$6])
+  if test "x$3" != "x"; then
+    GST_PLUGINS_YES="\t[$3]\n$GST_PLUGINS_YES"
+  fi
+  AC_DEFINE(HAVE_[$1], , [Define to enable $2]ifelse($3,,, [ (used by $3)]).)
+else
+  ifelse([$3], , :, [AC_MSG_NOTICE(*** These plugins will not be built: [$3])])
+  if test "x$3" != "x"; then
+    GST_PLUGINS_NO="\t[$3]\n$GST_PLUGINS_NO"
+  fi
+  ifelse([$7], , :, [$7])
+fi
+dnl *** Define the conditional as appropriate
+AM_CONDITIONAL(USE_[$1], test x$USE_[$1] = xyes)
+])
+
+dnl Use a -config program which accepts --cflags and --libs parameters
+dnl to set *_CFLAGS and *_LIBS and check existence of a feature.
+dnl Richard Boulton <richard-alsa@tartarus.org>
+dnl Last modification: 26/06/2001
+dnl AG_GST_CHECK_CONFIGPROG(FEATURE-NAME, CONFIG-PROG-FILENAME, MODULES)
+dnl
+dnl This check was written for GStreamer: it should be renamed and checked
+dnl for portability if you decide to use it elsewhere.
+dnl
+AC_DEFUN([AG_GST_CHECK_CONFIGPROG],
+[
+  AC_PATH_PROG([$1]_CONFIG, [$2], no)
+  if test x$[$1]_CONFIG = xno; then
+    [$1]_LIBS=
+    [$1]_CFLAGS=
+    HAVE_[$1]=no
+  else
+    if [$2] --plugin-libs [$3] &> /dev/null; then
+      [$1]_LIBS=`[$2] --plugin-libs [$3]`
+    else
+      [$1]_LIBS=`[$2] --libs [$3]`
+    fi
+    [$1]_CFLAGS=`[$2] --cflags [$3]`
+    HAVE_[$1]=yes
+  fi
+  AC_SUBST([$1]_LIBS)
+  AC_SUBST([$1]_CFLAGS)
+])
+
+dnl Use AC_CHECK_LIB and AC_CHECK_HEADER to do both tests at once
+dnl sets HAVE_module if we have it
+dnl Richard Boulton <richard-alsa@tartarus.org>
+dnl Last modification: 26/06/2001
+dnl AG_GST_CHECK_LIBHEADER(FEATURE-NAME, LIB NAME, LIB FUNCTION, EXTRA LD FLAGS,
+dnl                     HEADER NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
+dnl
+dnl This check was written for GStreamer: it should be renamed and checked
+dnl for portability if you decide to use it elsewhere.
+dnl
+AC_DEFUN([AG_GST_CHECK_LIBHEADER],
+[
+  AC_CHECK_LIB([$2], [$3], HAVE_[$1]=yes, HAVE_[$1]=no,[$4])
+  if test "x$HAVE_[$1]" = "xyes"; then
+    AC_CHECK_HEADER([$5], :, HAVE_[$1]=no)
+    if test "x$HAVE_[$1]" = "xyes"; then
+      dnl execute what needs to be
+      ifelse([$6], , :, [$6])
+    else
+      ifelse([$7], , :, [$7])
+    fi
+  else
+    ifelse([$7], , :, [$7])
+  fi
+  AC_SUBST(HAVE_[$1])
+]
+)
+
+dnl 2004-02-14 Thomas - changed to get set properly and use proper output
+dnl 2003-06-27 Benjamin Otte - changed to make this work with gstconfig.h
+dnl
+dnl Add a subsystem --disable flag and all the necessary symbols and substitions
+dnl
+dnl AG_GST_CHECK_SUBSYSTEM_DISABLE(SYSNAME, [subsystem name])
+dnl
+AC_DEFUN([AG_GST_CHECK_SUBSYSTEM_DISABLE],
+[
+  dnl this define will replace each literal subsys_def occurrence with
+  dnl the lowercase hyphen-separated subsystem
+  dnl e.g. if $1 is GST_DEBUG then subsys_def will be a macro with gst-debug
+  define([subsys_def],translit([$1], _A-Z, -a-z))
+
+  AC_ARG_ENABLE(subsys_def,
+    AC_HELP_STRING(--disable-subsys_def, [disable $2]),
+    [
+      case "${enableval}" in
+        yes) GST_DISABLE_[$1]=no ;;
+        no) GST_DISABLE_[$1]=yes ;;
+        *) AC_MSG_ERROR([bad value ${enableval} for --enable-subsys_def]) ;;
+       esac
+    ],
+    [GST_DISABLE_[$1]=no]) dnl Default value
+
+  if test x$GST_DISABLE_[$1] = xyes; then
+    AC_MSG_NOTICE([disabled subsystem [$2]])
+    GST_DISABLE_[$1]_DEFINE="#define GST_DISABLE_$1 1"
+  else
+    GST_DISABLE_[$1]_DEFINE="/* #undef GST_DISABLE_$1 */"
+  fi
+  AC_SUBST(GST_DISABLE_[$1]_DEFINE)
+  undefine([subsys_def])
+])
+
+
+dnl Parse gstconfig.h for feature and defines add the symbols and substitions
+dnl
+dnl AG_GST_PARSE_SUBSYSTEM_DISABLE(GST_CONFIGPATH, FEATURE)
+dnl
+AC_DEFUN([AG_GST_PARSE_SUBSYSTEM_DISABLE],
+[
+  grep >/dev/null "#undef GST_DISABLE_$2" $1
+  if test $? = 0; then
+    GST_DISABLE_[$2]=0
+  else
+    GST_DISABLE_[$2]=1
+  fi
+  AC_SUBST(GST_DISABLE_[$2])
+])
+
+dnl Parse gstconfig.h and defines add the symbols and substitions
+dnl
+dnl GST_CONFIGPATH=`$PKG_CONFIG --variable=includedir gstreamer-0.10`"/gst/gstconfig.h"
+dnl AG_GST_PARSE_SUBSYSTEM_DISABLES(GST_CONFIGPATH)
+dnl
+AC_DEFUN([AG_GST_PARSE_SUBSYSTEM_DISABLES],
+[
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,GST_DEBUG)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,LOADSAVE)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,PARSE)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,TRACE)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,ALLOC_TRACE)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,REGISTRY)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,ENUMTYPES)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,INDEX)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,PLUGIN)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,URI)
+  AG_GST_PARSE_SUBSYSTEM_DISABLE($1,XML)
+])
+
+
+
+dnl relies on GST_PLUGINS_ALL, GST_PLUGINS_SELECTED, GST_PLUGINS_YES,
+dnl GST_PLUGINS_NO, and BUILD_EXTERNAL
+AC_DEFUN([AG_GST_OUTPUT_PLUGINS], [
+
+printf "configure: *** Plug-ins without external dependencies that will be built:\n"
+( for i in $GST_PLUGINS_SELECTED; do printf '\t'$i'\n'; done ) | sort
+printf "\n"
+
+printf "configure: *** Plug-ins without external dependencies that will NOT be built:\n"
+( for i in $GST_PLUGINS_ALL; do
+    case $GST_PLUGINS_SELECTED in
+      *$i*)
+       ;;
+      *)
+       printf '\t'$i'\n'
+       ;;
+    esac
+  done ) | sort
+printf "\n"
+
+if test "x$BUILD_EXTERNAL" = "xno"; then
+  printf "configure: *** No plug-ins with external dependencies will be built\n"
+else
+  printf "configure: *** Plug-ins with dependencies that will be built:"
+  printf "$GST_PLUGINS_YES\n" | sort
+  printf "\n"
+  printf "configure: *** Plug-ins with dependencies that will NOT be built:"
+  printf "$GST_PLUGINS_NO\n" | sort
+  printf "\n"
+fi
+])
+
diff --git a/common/m4/gst-function.m4 b/common/m4/gst-function.m4
new file mode 100755 (executable)
index 0000000..1216621
--- /dev/null
@@ -0,0 +1,63 @@
+dnl
+dnl Check for compiler mechanism to show functions in debugging
+dnl copied from an Ali patch floating on the internet
+dnl
+AC_DEFUN([AG_GST_CHECK_FUNCTION],[
+  dnl #1: __PRETTY_FUNCTION__
+  AC_MSG_CHECKING(whether $CC implements __PRETTY_FUNCTION__)
+  AC_CACHE_VAL(have_pretty_function,[
+    AC_TRY_LINK([#include <stdio.h>],
+                [printf("%s", __PRETTY_FUNCTION__);],
+                have_pretty_function=yes,
+                have_pretty_function=no)
+  ])
+  AC_MSG_RESULT($have_pretty_function)
+  if test "$have_pretty_function" = yes; then
+    AC_DEFINE(HAVE_PRETTY_FUNCTION, 1,
+              [defined if the compiler implements __PRETTY_FUNCTION__])
+  fi
+
+dnl #2: __FUNCTION__
+  AC_MSG_CHECKING(whether $CC implements __FUNCTION__)
+  AC_CACHE_VAL(have_function,[
+    AC_TRY_LINK([#include <stdio.h>],
+                [printf("%s", __FUNCTION__);],
+                have_function=yes,
+                have_function=no)
+  ])
+  AC_MSG_RESULT($have_function)
+  if test "$have_function" = yes; then
+    AC_DEFINE(HAVE_FUNCTION, 1,
+              [defined if the compiler implements __FUNCTION__])
+  fi
+
+dnl #3: __func__
+  AC_MSG_CHECKING(whether $CC implements __func__)
+  AC_CACHE_VAL(have_func,[
+    AC_TRY_LINK([#include <stdio.h>],
+                [printf("%s", __func__);],
+                have_func=yes,
+                have_func=no)
+  ])
+  AC_MSG_RESULT($have_func)
+  if test "$have_func" = yes; then
+    AC_DEFINE(HAVE_FUNC, 1,
+              [defined if the compiler implements __func__])
+  fi
+
+dnl now define FUNCTION to whatever works, and fallback to ""
+  if test "$have_pretty_function" = yes; then
+    function=__PRETTY_FUNCTION__
+  else
+    if test "$have_function" = yes; then
+      function=__FUNCTION__
+    else
+      if test "$have_func" = yes; then
+        function=__func__
+      else
+        function=\"\"
+      fi
+    fi
+  fi
+  AC_DEFINE_UNQUOTED(GST_FUNCTION, $function, [macro to use to show function name])
+])
diff --git a/common/m4/gst-gettext.m4 b/common/m4/gst-gettext.m4
new file mode 100755 (executable)
index 0000000..a63651b
--- /dev/null
@@ -0,0 +1,21 @@
+dnl gettext setup
+
+dnl AG_GST_GETTEXT([gettext-package])
+dnl defines GETTEXT_PACKAGE and LOCALEDIR
+
+AC_DEFUN([AG_GST_GETTEXT],
+[
+  if test "$USE_NLS" = "yes"; then
+    GETTEXT_PACKAGE=[$1]
+  else
+    GETTEXT_PACKAGE=[NULL]
+  fi
+  AC_SUBST(GETTEXT_PACKAGE)
+  AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE",
+                     [gettext package name])
+
+  dnl define LOCALEDIR in config.h
+  AS_AC_EXPAND(LOCALEDIR, $datadir/locale)
+  AC_DEFINE_UNQUOTED([LOCALEDIR], "$LOCALEDIR",
+                     [gettext locale dir])
+])
diff --git a/common/m4/gst-glib2.m4 b/common/m4/gst-glib2.m4
new file mode 100755 (executable)
index 0000000..3060e5e
--- /dev/null
@@ -0,0 +1,25 @@
+dnl check for a minimum version of GLib
+
+dnl AG_GST_GLIB_CHECK([minimum-version-required])
+
+AC_DEFUN([AG_GST_GLIB_CHECK],
+[
+  dnl Minimum required version of GLib
+  GLIB_REQ=[$1]
+  if test "x$GLIB_REQ" = "x"
+  then
+    AC_MSG_ERROR([Please specify a required version for GLib 2.0])
+  fi
+  AC_SUBST(GLIB_REQ)
+
+  dnl Check for glib with everything
+  AG_GST_PKG_CHECK_MODULES(GLIB,
+    glib-2.0 >= $GLIB_REQ gobject-2.0 gthread-2.0 gmodule-no-export-2.0)
+
+  if test "x$HAVE_GLIB" = "xno"; then
+    AC_MSG_ERROR([This package requires GLib >= $GLIB_REQ to compile.])
+  fi
+
+  dnl for the poor souls who for example have glib in /usr/local
+  AS_SCRUB_INCLUDE(GLIB_CFLAGS)
+])
diff --git a/common/m4/gst-libxml2.m4 b/common/m4/gst-libxml2.m4
new file mode 100755 (executable)
index 0000000..7d978d3
--- /dev/null
@@ -0,0 +1,46 @@
+dnl call this macro with the minimum required version as an argument
+dnl this macro sets and AC_SUBSTs XML_CFLAGS and XML_LIBS
+dnl it also sets LIBXML_PKG, used for the pkg-config file
+
+AC_DEFUN([AG_GST_LIBXML2_CHECK],
+[
+  dnl Minimum required version of libxml2
+  dnl default to 2.4.9 if not specified
+  LIBXML2_REQ=ifelse([$1],,2.4.9,[$1])
+  AC_SUBST(LIBXML2_REQ)
+
+  dnl check for libxml2
+  PKG_CHECK_MODULES(XML, libxml-2.0 >= $LIBXML2_REQ, 
+                    HAVE_LIBXML2=yes, [
+                      AC_MSG_RESULT(no)
+                      HAVE_LIBXML2=no
+                    ])
+  if test "x$HAVE_LIBXML2" = "xyes"; then
+    AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 is available])
+  else
+    AC_MSG_ERROR([Need libxml2 for glib2 builds -- you should be able to do without it -- this needs fixing])
+  fi
+  dnl this is for the .pc file
+  LIBXML_PKG=', libxml-2.0' 
+  AC_SUBST(LIBXML_PKG)
+  AC_SUBST(XML_LIBS)
+  AC_SUBST(XML_CFLAGS)
+
+  dnl XML_LIBS might pull in -lz without zlib actually being on the system, so
+  dnl try linking with these LIBS and CFLAGS
+  ac_save_CFLAGS=$CFLAGS
+  ac_save_LIBS=$LIBS
+  CFLAGS="$CFLAGS $XML_CFLAGS"
+  LIBS="$LIBS $XML_LIBS"
+  AC_TRY_LINK([
+#include <libxml/tree.h>
+#include <stdio.h>
+],[ 
+/* function body */
+],
+    AC_MSG_NOTICE([Test xml2 program linked]),
+    AC_MSG_ERROR([Could not link libxml2 test program.  Check if you have the necessary dependencies.])
+  )
+  CFLAGS="$ac_save_CFLAGS"
+  LIBS="$ac_save_LIBS"
+])
diff --git a/common/m4/gst-parser.m4 b/common/m4/gst-parser.m4
new file mode 100755 (executable)
index 0000000..9cc0981
--- /dev/null
@@ -0,0 +1,63 @@
+AC_DEFUN([AG_GST_BISON_CHECK],
+[
+  dnl FIXME: check if AC_PROG_YACC is suitable here
+  dnl FIXME: make precious
+  AC_PATH_PROG(BISON_PATH, bison, no)
+  if test x$BISON_PATH = xno; then
+    AC_MSG_ERROR(Could not find bison)
+  fi
+
+  dnl check bison version
+  dnl FIXME 0.11: we need version >= 1.875 for the reentrancy support
+  dnl in the parser. If an older version is installed pre-generated
+  dnl sources are used. This should become a hard dependency for 0.11!
+  bison_min_version=1.875
+  bison_version=`$BISON_PATH --version | head -n 1 | sed 's/^.*) //' | sed 's/[[a-zA-Z]]*$//' | cut -d' ' -f1`
+  AC_MSG_CHECKING([bison version $bison_version >= $bison_min_version])
+
+  if perl -w <<EOF
+    exit ($bison_version < $bison_min_version) ? 0 : 1;
+EOF 
+  then 
+    AC_MSG_RESULT([yes])
+    AM_CONDITIONAL(GENERATE_PARSER, test -z $GENERATE_PARSER_TRUE)
+  else 
+    AC_MSG_RESULT([no, using pre-generated parser sources])
+    AM_CONDITIONAL(GENERATE_PARSER, false)
+  fi
+])
+
+AC_DEFUN([AG_GST_FLEX_CHECK],
+[
+  dnl we require flex for building the parser
+  AC_PATH_PROG(FLEX_PATH, flex, no)
+  if test x$FLEX_PATH = xno; then
+    AC_MSG_ERROR(Could not find flex)
+  fi
+  
+  dnl check flex version
+  dnl FIXME 0.11: we need version >= 2.5.31 for the reentrancy support
+  dnl in the parser. If an older version is installed pre-generated
+  dnl sources are used. This should become a hard dependency for 0.11!
+  flex_min_version=2.5.31
+  flex_version=`$FLEX_PATH --version | head -n 1 | sed 's/^.* //' | sed 's/[[a-zA-Z]]*$//' | cut -d' ' -f1`
+  AC_MSG_CHECKING([flex version $flex_version >= $flex_min_version])
+  if perl -w <<EOF
+    (\$min_version_major, \$min_version_minor, \$min_version_micro ) = "$flex_min_version" =~ /(\d+)\.(\d+)\.(\d+)/;
+    (\$flex_version_major, \$flex_version_minor, \$flex_version_micro ) = "$flex_version" =~ /(\d+)\.(\d+)\.(\d+)/;
+    exit (((\$flex_version_major > \$min_version_major) ||
+     ((\$flex_version_major == \$min_version_major) &&
+      (\$flex_version_minor > \$min_version_minor)) ||
+     ((\$flex_version_major == \$min_version_major) &&
+      (\$flex_version_minor == \$min_version_minor) &&
+      (\$flex_version_micro >= \$min_version_micro)))
+     ? 0 : 1);
+EOF
+  then
+    AC_MSG_RESULT(yes)
+    AM_CONDITIONAL(GENERATE_PARSER, test -z $GENERATE_PARSER_TRUE)
+  else
+    AC_MSG_RESULT([no, using pre-generated parser sources])
+    AM_CONDITIONAL(GENERATE_PARSER, false)
+  fi
+])
diff --git a/common/m4/gst-plugin-docs.m4 b/common/m4/gst-plugin-docs.m4
new file mode 100755 (executable)
index 0000000..29ebbd6
--- /dev/null
@@ -0,0 +1,47 @@
+dnl AG_GST_PYXML_CHECK([MINIMUM-PYTHON-VERSION])
+
+AC_DEFUN([AG_GST_PYXML_CHECK],
+[
+  AC_BEFORE([AS_PATH_PYTHON],[$0])dnl find python first
+
+  have_pyxml=no
+  if test "x$PYTHON" != x; then
+    AC_MSG_CHECKING([pyxml])
+    if $PYTHON -c "from xml.dom.ext.reader import Sax2" 2>/dev/null \
+      && $PYTHON -c "from xml.dom.NodeFilter import NodeFilter" 2>/dev/null; then
+      AC_MSG_RESULT(yes)
+      have_pyxml=yes
+    else
+      AC_MSG_RESULT(no)
+    fi
+  fi
+])
+
+dnl AG_GST_PLUGIN_DOCS([MINIMUM-GTK-DOC-VERSION],[MINIMUM-PYTHON-VERSION])
+dnl 
+dnl checks for prerequisites for the common/mangle-tmpl.py script
+dnl used when building the plugin documentation
+
+AC_DEFUN([AG_GST_PLUGIN_DOCS],
+[
+  AC_BEFORE([GTK_DOC_CHECK],[$0])dnl check for gtk-doc first
+
+  if test x$enable_gtk_doc = xyes -a x$have_gtk_doc = xyes; then
+    AG_GST_PYXML_CHECK([$1])
+  fi
+
+  build_plugin_docs=no
+  AC_MSG_CHECKING([whether to build plugin documentation])
+  if test x$enable_gtk_doc = xyes -a x$have_gtk_doc = xyes; then
+    if test "x$have_pyxml" != xyes; then
+      AC_MSG_RESULT([no (pyxml not installed)])
+    else
+      build_plugin_docs=yes
+      AC_MSG_RESULT([yes])
+    fi
+  else
+    AC_MSG_RESULT([no (gtk-doc disabled or not available)])
+  fi
+
+  AM_CONDITIONAL(ENABLE_PLUGIN_DOCS, test x$build_plugin_docs = xyes)
+])
diff --git a/common/m4/gst-plugindir.m4 b/common/m4/gst-plugindir.m4
new file mode 100755 (executable)
index 0000000..09989d0
--- /dev/null
@@ -0,0 +1,17 @@
+dnl AG_GST_SET_PLUGINDIR
+
+dnl AC_DEFINE PLUGINDIR to the full location where plug-ins will be installed
+dnl AC_SUBST plugindir, to be used in Makefile.am's
+
+AC_DEFUN([AG_GST_SET_PLUGINDIR],
+[
+  dnl define location of plugin directory
+  AS_AC_EXPAND(PLUGINDIR, ${libdir}/gstreamer-$GST_MAJORMINOR)
+  AC_DEFINE_UNQUOTED(PLUGINDIR, "$PLUGINDIR",
+    [directory where plugins are located])
+  AC_MSG_NOTICE([Using $PLUGINDIR as the plugin install location])
+
+  dnl plugin directory configure-time variable for use in Makefile.am
+  plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
+  AC_SUBST(plugindir)
+])
diff --git a/common/m4/gst-valgrind.m4 b/common/m4/gst-valgrind.m4
new file mode 100755 (executable)
index 0000000..93c2635
--- /dev/null
@@ -0,0 +1,35 @@
+AC_DEFUN([AG_GST_VALGRIND_CHECK],
+[
+  dnl valgrind inclusion
+  AC_ARG_ENABLE(valgrind,
+    AC_HELP_STRING([--disable-valgrind], [disable run-time valgrind detection]),
+    [
+      case "${enableval}" in
+        yes) USE_VALGRIND="$USE_DEBUG" ;;
+        no)  USE_VALGRIND=no ;;
+        *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;;
+      esac],
+    [
+      USE_VALGRIND="$USE_DEBUG"
+    ]) dnl Default value
+
+  VALGRIND_REQ="2.1"
+  if test "x$USE_VALGRIND" = xyes; then
+    PKG_CHECK_MODULES(VALGRIND, valgrind > $VALGRIND_REQ,
+      USE_VALGRIND="yes",
+      [
+        USE_VALGRIND="no"
+        AC_MSG_RESULT([no])
+      ])
+  fi
+
+  if test "x$USE_VALGRIND" = xyes; then
+    AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used])
+    AC_MSG_NOTICE(Using extra code paths for valgrind)
+  fi
+  AC_SUBST(VALGRIND_CFLAGS)
+  AC_SUBST(VALGRIND_LIBS)
+  
+  AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
+  AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
+])
diff --git a/common/m4/gst.m4 b/common/m4/gst.m4
new file mode 100755 (executable)
index 0000000..04b466f
--- /dev/null
@@ -0,0 +1,10 @@
+dnl AG_GST_INIT
+dnl sets up use of GStreamer configure.ac macros
+dnl all GStreamer autoconf macros are prefixed
+dnl with AG_GST_ for public macros
+dnl with _AG_GST_ for private macros
+
+AC_DEFUN([AG_GST_INIT],
+[
+  m4_pattern_forbid(^_?AG_GST_)
+])
diff --git a/common/m4/gtk-doc.m4 b/common/m4/gtk-doc.m4
new file mode 100755 (executable)
index 0000000..57040aa
--- /dev/null
@@ -0,0 +1,56 @@
+dnl -*- mode: autoconf -*-
+
+# serial 1
+
+dnl Usage:
+dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
+AC_DEFUN([GTK_DOC_CHECK],
+[
+  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+  dnl for overriding the documentation installation directory
+  AC_ARG_WITH(html-dir,
+    AC_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
+    [with_html_dir='${datadir}/gtk-doc/html'])
+  HTML_DIR="$with_html_dir"
+  AC_SUBST(HTML_DIR)
+
+  dnl enable/disable documentation building
+  AC_ARG_ENABLE(gtk-doc,
+    AC_HELP_STRING([--enable-gtk-doc],
+                   [use gtk-doc to build documentation [default=no]]),,
+    enable_gtk_doc=no)
+
+  have_gtk_doc=no
+  if test x$enable_gtk_doc = xyes; then
+    if test -z "$PKG_CONFIG"; then
+      AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+    fi
+    if test "$PKG_CONFIG" != "no" && $PKG_CONFIG --exists gtk-doc; then
+      have_gtk_doc=yes
+    fi
+    if test -z "$SED"; then
+      AC_PROG_SED
+    fi
+
+dnl do we want to do a version check?
+ifelse([$1],[],,
+    [gtk_doc_min_version=$1
+    if test "$have_gtk_doc" = yes; then
+      AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
+      if $PKG_CONFIG --atleast-version $gtk_doc_min_version gtk-doc; then
+        AC_MSG_RESULT(yes)
+      else
+        AC_MSG_RESULT(no)
+        have_gtk_doc=no
+      fi
+    fi
+])
+    if test "$have_gtk_doc" != yes; then
+      enable_gtk_doc=no
+    fi
+  fi
+
+  AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
+  AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
+])
diff --git a/common/m4/iconv.m4 b/common/m4/iconv.m4
new file mode 100755 (executable)
index 0000000..c5f3579
--- /dev/null
@@ -0,0 +1,103 @@
+# iconv.m4 serial AM4 (gettext-0.11.3)
+dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+  dnl those with the standalone portable GNU libiconv installed).
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed libiconv and not disabled its use
+  dnl via --without-libiconv-prefix, he wants to use it. The first
+  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
+  am_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+  AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+      [iconv_t cd = iconv_open("","");
+       iconv(cd,NULL,NULL,NULL,NULL);
+       iconv_close(cd);],
+      am_cv_func_iconv=yes)
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      AC_TRY_LINK([#include <stdlib.h>
+#include <iconv.h>],
+        [iconv_t cd = iconv_open("","");
+         iconv(cd,NULL,NULL,NULL,NULL);
+         iconv_close(cd);],
+        am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes)
+      LIBS="$am_save_LIBS"
+    fi
+  ])
+  if test "$am_cv_func_iconv" = yes; then
+    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    AC_MSG_CHECKING([how to link with libiconv])
+    AC_MSG_RESULT([$LIBICONV])
+  else
+    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+    dnl either.
+    CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+  AC_SUBST(LIBICONV)
+  AC_SUBST(LTLIBICONV)
+])
+
+AC_DEFUN([AM_ICONV],
+[
+  AM_ICONV_LINK
+  if test "$am_cv_func_iconv" = yes; then
+    AC_MSG_CHECKING([for iconv declaration])
+    AC_CACHE_VAL(am_cv_proto_iconv, [
+      AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+    AC_MSG_RESULT([$]{ac_t:-
+         }[$]am_cv_proto_iconv)
+    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+      [Define as const if the declaration of iconv() needs const.])
+  fi
+])
diff --git a/common/m4/isc-posix.m4 b/common/m4/isc-posix.m4
new file mode 100755 (executable)
index 0000000..1319dd1
--- /dev/null
@@ -0,0 +1,26 @@
+# isc-posix.m4 serial 2 (gettext-0.11.2)
+dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# This file is not needed with autoconf-2.53 and newer.  Remove it in 2005.
+
+# This test replaces the one in autoconf.
+# Currently this macro should have the same name as the autoconf macro
+# because gettext's gettext.m4 (distributed in the automake package)
+# still uses it.  Otherwise, the use in gettext.m4 makes autoheader
+# give these diagnostics:
+#   configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
+#   configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
+
+undefine([AC_ISC_POSIX])
+
+AC_DEFUN([AC_ISC_POSIX],
+  [
+    dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
+    AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
+  ]
+)
diff --git a/common/m4/lib-ld.m4 b/common/m4/lib-ld.m4
new file mode 100755 (executable)
index 0000000..ddb5732
--- /dev/null
@@ -0,0 +1,97 @@
+# lib-ld.m4 serial 1 (gettext-0.11)
+dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
+dnl with libtool.m4.
+
+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  acl_cv_prog_gnu_ld=yes
+else
+  acl_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-1.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by GCC])
+  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.
+    [[\\/]* | [A-Za-z]:[\\/]*)]
+      [re_direlt='/[^/][^/]*/\.\./']
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(acl_cv_path_LD,
+[if test -z "$LD"; then
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      acl_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+       test "$with_gnu_ld" != no && break
+      else
+       test "$with_gnu_ld" != yes && break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_LIB_PROG_LD_GNU
+])
diff --git a/common/m4/lib-link.m4 b/common/m4/lib-link.m4
new file mode 100755 (executable)
index 0000000..6b94251
--- /dev/null
@@ -0,0 +1,554 @@
+# lib-link.m4 serial 3 (gettext-0.11.3)
+dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  define([Name],[translit([$1],[./-], [___])])
+  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+    AC_LIB_LINKFLAGS_BODY([$1], [$2])
+    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+  ])
+  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+  dnl results of this search when this library appears as a dependency.
+  HAVE_LIB[]NAME=yes
+  undefine([Name])
+  undefine([NAME])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. If found, it
+dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
+dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  define([Name],[translit([$1],[./-], [___])])
+  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+
+  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed lib[]Name and not disabled its use
+  dnl via --without-lib[]Name-prefix, he wants to use it.
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+    ac_save_LIBS="$LIBS"
+    LIBS="$LIBS $LIB[]NAME"
+    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
+    LIBS="$ac_save_LIBS"
+  ])
+  if test "$ac_cv_lib[]Name" = yes; then
+    HAVE_LIB[]NAME=yes
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
+    AC_MSG_CHECKING([how to link with lib[]$1])
+    AC_MSG_RESULT([$LIB[]NAME])
+  else
+    HAVE_LIB[]NAME=no
+    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+    dnl $INC[]NAME either.
+    CPPFLAGS="$ac_save_CPPFLAGS"
+    LIB[]NAME=
+    LTLIB[]NAME=
+  fi
+  AC_SUBST([HAVE_LIB]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  undefine([Name])
+  undefine([NAME])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
+dnl hardcode_direct, hardcode_minus_L,
+dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec.
+AC_DEFUN([AC_LIB_RPATH],
+[
+  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
+  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
+  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
+  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
+  ])
+  wl="$acl_cv_wl"
+  libext="$acl_cv_libext"
+  shlibext="$acl_cv_shlibext"
+  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  hardcode_direct="$acl_cv_hardcode_direct"
+  hardcode_minus_L="$acl_cv_hardcode_minus_L"
+  sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec"
+  sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec"
+  dnl Determine whether the user wants rpath handling at all.
+  AC_ARG_ENABLE(rpath,
+    [  --disable-rpath         do not hardcode runtime library paths],
+    :, enable_rpath=yes)
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_ARG_WITH([lib$1-prefix],
+[  --with-lib$1-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
+  --without-lib$1-prefix     don't search for lib$1 in includedir and libdir],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/lib"
+      fi
+    fi
+])
+  dnl Search the library and its dependencies in $additional_libdir and
+  dnl $LDFLAGS. Using breadth-first-seach.
+  LIB[]NAME=
+  LTLIB[]NAME=
+  INC[]NAME=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='$1 $2'
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+        dnl or AC_LIB_HAVE_LINKFLAGS call.
+        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+          else
+            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+            dnl that this library doesn't exist. So just drop it.
+            :
+          fi
+        else
+          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+          dnl and the already constructed $LIBNAME/$LTLIBNAME.
+          found_dir=
+          found_la=
+          found_so=
+          found_a=
+          if test $use_additional = yes; then
+            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
+              found_dir="$additional_libdir"
+              found_so="$additional_libdir/lib$name.$shlibext"
+              if test -f "$additional_libdir/lib$name.la"; then
+                found_la="$additional_libdir/lib$name.la"
+              fi
+            else
+              if test -f "$additional_libdir/lib$name.$libext"; then
+                found_dir="$additional_libdir"
+                found_a="$additional_libdir/lib$name.$libext"
+                if test -f "$additional_libdir/lib$name.la"; then
+                  found_la="$additional_libdir/lib$name.la"
+                fi
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIB[]NAME; do
+              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
+                    found_dir="$dir"
+                    found_so="$dir/lib$name.$shlibext"
+                    if test -f "$dir/lib$name.la"; then
+                      found_la="$dir/lib$name.la"
+                    fi
+                  else
+                    if test -f "$dir/lib$name.$libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/lib$name.$libext"
+                      if test -f "$dir/lib$name.la"; then
+                        found_la="$dir/lib$name.la"
+                      fi
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+            dnl Found the library.
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+              dnl Linking with a shared library. We attempt to hardcode its
+              dnl directory into the executable's runpath, unless it's the
+              dnl standard /usr/lib.
+              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
+                dnl No hardcoding is needed.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+              else
+                dnl Use an explicit option to hardcode DIR into the resulting
+                dnl binary.
+                dnl Potentially add DIR to ltrpathdirs.
+                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                dnl The hardcoding into $LIBNAME is system dependent.
+                if test "$hardcode_direct" = yes; then
+                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+                  dnl resulting binary.
+                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                else
+                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
+                    dnl Use an explicit option to hardcode DIR into the resulting
+                    dnl binary.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    dnl Potentially add DIR to rpathdirs.
+                    dnl The rpathdirs will be appended to $LIBNAME at the end.
+                    haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                    dnl Rely on "-L$found_dir".
+                    dnl But don't add it if it's already contained in the LDFLAGS
+                    dnl or the already constructed $LIBNAME
+                    haveit=
+                    for x in $LDFLAGS $LIB[]NAME; do
+                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+                    fi
+                    if test "$hardcode_minus_L" != no; then
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    else
+                      dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
+                      dnl here, because this doesn't fit in flags passed to the
+                      dnl compiler. So give up. No hardcoding. This affects only
+                      dnl very old systems.
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                dnl Linking with a static library.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+              else
+                dnl We shouldn't come here, but anyway it's good to have a
+                dnl fallback.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+              fi
+            fi
+            dnl Assume the include files are nearby.
+            additional_includedir=
+            case "$found_dir" in
+              */lib | */lib/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+              dnl Potentially add $additional_includedir to $INCNAME.
+              dnl But don't add it
+              dnl   1. if it's the standard /usr/include,
+              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
+              dnl   3. if it's already present in $CPPFLAGS or the already
+              dnl      constructed $INCNAME,
+              dnl   4. if it doesn't exist as a directory.
+              if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux*) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INC[]NAME; do
+                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                      dnl Really add $additional_includedir to $INCNAME.
+                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+            dnl Look for dependencies.
+            if test -n "$found_la"; then
+              dnl Read the .la file. It defines the variables
+              dnl dlname, library_names, old_library, dependency_libs, current,
+              dnl age, revision, installed, dlopen, dlpreopen, libdir.
+              save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+              dnl We use only dependency_libs.
+              for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+                    dnl But don't add it
+                    dnl   1. if it's the standard /usr/lib,
+                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
+                    dnl   3. if it's already present in $LDFLAGS or the already
+                    dnl      constructed $LIBNAME,
+                    dnl   4. if it doesn't exist as a directory.
+                    if test "X$additional_libdir" != "X/usr/lib"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/lib"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux*) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LIBNAME.
+                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LTLIBNAME.
+                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                      dnl Potentially add DIR to rpathdirs.
+                      dnl The rpathdirs will be appended to $LIBNAME at the end.
+                      haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                      dnl Potentially add DIR to ltrpathdirs.
+                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                      haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                    dnl Handle this in the next round.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                    dnl Handle this in the next round. Throw away the .la's
+                    dnl directory; it is already contained in a preceding -L
+                    dnl option.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                    dnl Most likely an immediate library name.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+            dnl Didn't find the library; assume it is in the system directories
+            dnl known to the linker and runtime loader. (All the system
+            dnl directories known to the linker should also be known to the
+            dnl runtime loader, otherwise the system is severely misconfigured.)
+            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$hardcode_libdir_separator"; then
+      dnl Weird platform: only the last -rpath option counts, the user must
+      dnl pass all path elements in one option. We can arrange that for a
+      dnl single library, but not when more than one $LIBNAMEs are used.
+      alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
+      done
+      dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
+      acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+    else
+      dnl The -rpath options are cumulative.
+      for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+    dnl When using libtool, the option that works for both libraries and
+    dnl executables is -R. The -R options are cumulative.
+    for found_dir in $ltrpathdirs; do
+      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+    done
+  fi
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+  for element in [$2]; do
+    haveit=
+    for x in $[$1]; do
+      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      [$1]="${[$1]}${[$1]:+ }$element"
+    fi
+  done
+])
diff --git a/common/m4/lib-prefix.m4 b/common/m4/lib-prefix.m4
new file mode 100755 (executable)
index 0000000..b8b79ab
--- /dev/null
@@ -0,0 +1,148 @@
+# lib-prefix.m4 serial 1 (gettext-0.11)
+dnl Copyright (C) 2001-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_ARG_WITH([lib-prefix],
+[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+  --without-lib-prefix    don't search for libraries in includedir and libdir],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/lib"
+      fi
+    fi
+])
+  if test $use_additional = yes; then
+    dnl Potentially add $additional_includedir to $CPPFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/include,
+    dnl   2. if it's already present in $CPPFLAGS,
+    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_includedir" != "X/usr/include"; then
+      haveit=
+      for x in $CPPFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-I$additional_includedir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_includedir" = "X/usr/local/include"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux*) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_includedir"; then
+            dnl Really add $additional_includedir to $CPPFLAGS.
+            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+          fi
+        fi
+      fi
+    fi
+    dnl Potentially add $additional_libdir to $LDFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/lib,
+    dnl   2. if it's already present in $LDFLAGS,
+    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_libdir" != "X/usr/lib"; then
+      haveit=
+      for x in $LDFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-L$additional_libdir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_libdir" = "X/usr/local/lib"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux*) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_libdir"; then
+            dnl Really add $additional_libdir to $LDFLAGS.
+            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+          fi
+        fi
+      fi
+    fi
+  fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+  dnl Unfortunately, prefix and exec_prefix get only finally determined
+  dnl at the end of configure.
+  if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
+  else
+    acl_final_prefix="$prefix"
+  fi
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  $1
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+])
diff --git a/common/m4/libtool.m4 b/common/m4/libtool.m4
new file mode 100644 (file)
index 0000000..a3fee53
--- /dev/null
@@ -0,0 +1,7377 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 56 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+                  [m4_fatal([Libtool version $1 or higher is required],
+                            63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\    *)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+_LT_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+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'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+       [m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+       [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+       [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+          m4_quote(lt_decl_varnames),
+       m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+                       lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+                                          [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+       dnl If the libtool generation code has been placed in $CONFIG_LT,
+       dnl instead of duplicating it all over again into config.status,
+       dnl then we will have config.status run $CONFIG_LT later, so it
+       dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\[$]0 --fallback-echo"')dnl "
+  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
+  ;;
+esac
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+cat >"$CONFIG_LT" <<_LTEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
+
+lt_cl_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AS_SHELL_SANITIZE
+_AS_PREPARE
+
+exec AS_MESSAGE_FD>&1
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+if test "$no_create" != yes; then
+  lt_cl_success=:
+  test "$silent" = yes &&
+    lt_config_lt_args="$lt_config_lt_args --quiet"
+  exec AS_MESSAGE_LOG_FD>/dev/null
+  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+  exec AS_MESSAGE_LOG_FD>>config.log
+  $lt_cl_success || AS_EXIT(1)
+fi
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_XSI_SHELLFNS
+
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],                 [_LT_LANG(C)],
+  [C++],               [_LT_LANG(CXX)],
+  [Java],              [_LT_LANG(GCJ)],
+  [Fortran 77],                [_LT_LANG(F77)],
+  [Fortran],           [_LT_LANG(FC)],
+  [Windows Resource],  [_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+       [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+       [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+       [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+       # By default we will add the -single_module flag. You can override
+       # by either setting the environment variable LT_MULTI_MODULE
+       # non-empty at configure time, or by adding -multi_module to the
+       # link flags.
+       rm -rf libconftest.dylib*
+       echo "int foo(void){return 1;}" > conftest.c
+       echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+       $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+         -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+       if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+         lt_cv_apple_cc_single_mod=yes
+       else
+         cat conftest.err >&AS_MESSAGE_LOG_FD
+       fi
+       rm -rf libconftest.dylib*
+       rm -f conftest.*
+      fi])
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+       [lt_cv_ld_exported_symbols_list=yes],
+       [lt_cv_ld_exported_symbols_list=no])
+       LDFLAGS="$save_LDFLAGS"
+    ])
+    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" != ":"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_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=echo
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX
+# -----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+       /^0/ {
+           s/^0  *\(.*\)$/\1/
+           p
+       }
+    }'
+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 "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+            [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+        [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_SHELL_INIT
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[_LT_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<_LT_EOF
+[$]*
+_LT_EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+  if test "X${echo_test_string+set}" != Xset; then
+    # find a string as large as possible, as long as the shell can cope with it
+    for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+        { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+      then
+        break
+      fi
+    done
+  fi
+
+  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+     test "X$echo_testing_string" = "X$echo_test_string"; then
+    :
+  else
+    # The Solaris, AIX, and Digital Unix default echo programs unquote
+    # backslashes.  This makes it impossible to quote backslashes using
+    #   echo "$something" | sed 's/\\/\\\\/g'
+    #
+    # So, first we look for a working echo in the user's PATH.
+
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for dir in $PATH /usr/ucb; do
+      IFS="$lt_save_ifs"
+      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        ECHO="$dir/echo"
+        break
+      fi
+    done
+    IFS="$lt_save_ifs"
+
+    if test "X$ECHO" = Xecho; then
+      # We didn't find a better echo, so look for alternatives.
+      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        # This shell has a builtin print -r that does the trick.
+        ECHO='print -r'
+      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+          test "X$CONFIG_SHELL" != X/bin/ksh; then
+        # If we have ksh, try running configure again with it.
+        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+        export ORIGINAL_CONFIG_SHELL
+        CONFIG_SHELL=/bin/ksh
+        export CONFIG_SHELL
+        exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+      else
+        # Try using printf.
+        ECHO='printf %s\n'
+        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+          echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+          test "X$echo_testing_string" = "X$echo_test_string"; then
+         # Cool, printf works
+         :
+        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+            test "X$echo_testing_string" = 'X\t' &&
+            echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+            test "X$echo_testing_string" = "X$echo_test_string"; then
+         CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+         export CONFIG_SHELL
+         SHELL="$CONFIG_SHELL"
+         export SHELL
+         ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+            test "X$echo_testing_string" = 'X\t' &&
+            echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+            test "X$echo_testing_string" = "X$echo_test_string"; then
+         ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        else
+         # maybe with a smaller string...
+         prev=:
+
+         for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+           if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+           then
+             break
+           fi
+           prev="$cmd"
+         done
+
+         if test "$prev" != 'sed 50q "[$]0"'; then
+           echo_test_string=`eval $prev`
+           export echo_test_string
+           exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+         else
+           # Oops.  We lost completely, so just stick with echo.
+           ECHO=echo
+         fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(lt_ECHO)
+])
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1],
+    [An echo program that does not interpret backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "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 AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+       HPUX_IA64_MODE="32"
+       ;;
+      *ELF-64*)
+       HPUX_IA64_MODE="64"
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -melf32bsmip"
+         ;;
+       *N32*)
+         LD="${LD-ld} -melf32bmipn32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -melf64bmip"
+       ;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -32"
+         ;;
+       *N32*)
+         LD="${LD-ld} -n32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -64"
+         ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*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 AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_i386_fbsd"
+           ;;
+         x86_64-*linux*)
+           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"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+       if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+         LD="${LD-ld} -64"
+       fi
+       ;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[AC_CHECK_TOOL(AR, ar, false)
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1])
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#              [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536      # usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[        ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    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"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+                = "XX$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
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL          RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL                DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL                0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW           RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW         DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW       RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW     DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW     0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "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
+    AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+         [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+           [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+       [AC_CHECK_FUNC([dlopen],
+             [lt_cv_dlopen="dlopen"],
+         [AC_CHECK_LIB([dl], [dlopen],
+               [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+           [AC_CHECK_LIB([svld], [dlopen],
+                 [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+             [AC_CHECK_LIB([dld], [dld_link],
+                   [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+             ])
+           ])
+         ])
+       ])
+      ])
+    ;;
+  esac
+
+  if test "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"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+         lt_cv_dlopen_self, [dnl
+         _LT_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+           lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+         lt_cv_dlopen_self_static, [dnl
+         _LT_TRY_DLOPEN_SELF(
+           lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+           lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+        [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+        [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+        [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+       [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != 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, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = 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
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+       [], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+  # 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; }
+}'`
+  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+          echo ' yes '
+          echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+       :
+      else
+       can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  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=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+    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="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+       if test "$lt_cv_prog_gnu_ld" = yes; then
+               version_type=linux
+       else
+               version_type=irix
+       fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  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
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+       [shlibpath_overrides_runpath=yes])])
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/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;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=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
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  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'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+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
+
+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
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+        [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+       [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_DECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# 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.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    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
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+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 Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=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
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method == "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       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])
+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.
+  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+       [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$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'"
+
+# 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};"\
+"     /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
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+       if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<_LT_EOF > conftest.$ac_ext
+#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.  */
+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
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+         # Now try linking the two files.
+         mv conftest.$ac_objext conftstm.$ac_objext
+         lt_save_LIBS="$LIBS"
+         lt_save_CFLAGS="$CFLAGS"
+         LIBS="conftstm.$ac_objext"
+         CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+         if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS="$lt_save_LIBS"
+         CFLAGS="$lt_save_CFLAGS"
+       else
+         echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+       [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+       # All AIX code is PIC.
+       if test "$host_cpu" = ia64; then
+         # AIX 5 now supports IA64 processor
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+       else
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+           if test "$host_cpu" != ia64; then
+             _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+           fi
+           ;;
+         aCC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           ;;
+         ecpc* )
+           # old Intel C++ for x86_64 which still supported -KPIC.
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
+         icpc* )
+           # Intel C++, used to be incompatible with GCC.
+           # ICC 10 doesn't accept -KPIC any more.
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+           ;;
+         pgCC* | pgcpp*)
+           # Portland Group C++ compiler
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         xlc* | xlC*)
+           # IBM XL 8.0 on PPC
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+             _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+             _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      netbsd* | netbsdelf*-gnu)
+       ;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+       ;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+       [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       ;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+       [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+       ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl*)
+       # IBM XL C 8.0/Fortran 10.1 on PPC
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+       ;;
+      *)
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ C*)
+         # Sun C 5.9
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         ;;
+       *Sun\ F*)
+         # Sun Fortran 8.3 passes all unrecognized flags to the linker
+         _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+         ;;
+       esac
+       ;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+       [How to pass a linker flag through the compiler])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+       [Additional compiler flags for building library objects])
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+       [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw* | cegcc*)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+  ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$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
+    ;;
+  linux* | k*bsd*-gnu)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 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
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       _LT_TAGVAR(archive_expsym_cmds, $1)='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
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$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=
+       tmp_sharedflag='-shared'
+       case $cc_basename,$host_cpu in
+        pgcc*)                         # Portland Group C compiler
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       lf95*)                          # Lahey Fortran 8.1
+         _LT_TAGVAR(whole_archive_flag_spec, $1)=
+         tmp_sharedflag='--shared' ;;
+       xl[[cC]]*)                      # IBM XL C 8.0 on PPC (deal with xlf below)
+         tmp_sharedflag='-qmkshrobj'
+         tmp_addflag= ;;
+       esac
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ C*)                       # Sun C 5.9
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(compiler_needs_object, $1)=yes
+         tmp_sharedflag='-G' ;;
+       *Sun\ F*)                       # Sun Fortran 8.3
+         tmp_sharedflag='-G' ;;
+       esac
+       _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+           cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+           echo "local: *; };" >> $output_objdir/$libname.ver~
+           $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+       case $cc_basename in
+       xlf*)
+         # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+         _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+         _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+         if test "x$supports_anon_versioning" = xyes; then
+           _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+             cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+             echo "local: *; };" >> $output_objdir/$libname.ver~
+             $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+         fi
+         ;;
+       esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 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
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         else
+           _LT_TAGVAR(ld_shlibs, $1)=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       _LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+       # On IA64, the linker does run time linking by default, so we don't
+       # have to do anything special.
+       aix_use_runtimelinking=no
+       exp_sym_flag='-Bexport'
+       no_entry_flag=""
+      else
+       # If we're using GNU nm, then we don't want the "-C" option.
+       # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+         _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+       else
+         _LT_TAGVAR(export_symbols_cmds, $1)='$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.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      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
+         _LT_TAGVAR(hardcode_direct, $1)=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         _LT_TAGVAR(hardcode_minus_L, $1)=yes
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+         _LT_TAGVAR(hardcode_libdir_separator, $1)=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+       _LT_TAGVAR(link_all_deplibs, $1)=no
+      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
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+       if test "$host_cpu" = ia64; then
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+         _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+         _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+         _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+         # Exported symbols can be pulled into shared objects from archives
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+         _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         _LT_TAGVAR(archive_expsym_cmds, $1)="\$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
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$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
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+       _LT_TAGVAR(hardcode_direct, $1)=yes
+       _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         _LT_TAGVAR(hardcode_direct, $1)=no
+         _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+         ;;
+       *)
+         _LT_TAGVAR(hardcode_direct, $1)=yes
+         _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         _LT_TAGVAR(hardcode_minus_L, $1)=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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.
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        AC_LINK_IFELSE(int foo(void) {},
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+        )
+        LDFLAGS="$save_LDFLAGS"
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+       _LT_TAGVAR(hardcode_direct, $1)=yes
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+       else
+         case $host_os in
+          openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+            _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+            ;;
+          *)
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+            ;;
+         esac
+       fi
+      else
+       _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$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'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+       _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+       $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+       case `$CC -V 2>&1` in
+       *"Compilers 5.0"*)
+         wlarc=''
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+         ;;
+       *)
+         wlarc='${wl}'
+         _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+         ;;
+       esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+       # The compiler driver will combine and reorder linker options,
+       # but understands `-z linker_flag'.  GCC discards it without `$wl',
+       # but is careful enough not to reorder.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       if test "$GCC" = yes; then
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+       else
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+       fi
+       ;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "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.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+         _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+       motorola)
+         _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       _LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We 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.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+       ;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+       pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+        _LT_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+        then
+         _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+         _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+    [[If ld is used when linking, flag to hardcode $libdir into a binary
+    during linking.  This must work even if $libdir does not exist]])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [fix_srcfile_path], [1],
+    [Fix the shell variable $srcfile for the compiler])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$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
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_PROG_CXX
+# ------------
+# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
+# compiler, we have our own version here.
+m4_defun([_LT_PROG_CXX],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
+AC_PROG_CXX
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_CXX
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_CXX], [])
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[AC_REQUIRE([_LT_PROG_CXX])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+         $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+           for ld_flag in $LDFLAGS; do
+             case $ld_flag in
+             *-brtl*)
+               aix_use_runtimelinking=yes
+               break
+               ;;
+             esac
+           done
+           ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+            strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+           # We have reworked collect2
+           :
+         else
+           # We have old collect2
+           _LT_TAGVAR(hardcode_direct, $1)=unsupported
+           # It fails to find uninstalled libraries when the uninstalled
+           # path is not listed in the libpath.  Setting hardcode_minus_L
+           # to unsupported forces relinking
+           _LT_TAGVAR(hardcode_minus_L, $1)=yes
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=
+         fi
+          esac
+          shared_flag='-shared'
+         if test "$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
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+       # export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+           _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+           _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+           # Determine the default libpath from the value encoded in an
+           # empty executable.
+           _LT_SYS_MODULE_PATH_AIX
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+           # Warning - without using the other run time loading flags,
+           # -berok will link without error, but may produce a broken library.
+           _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+           _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+           # Exported symbols can be pulled into shared objects from archives
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+           _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+           # This is similar to how AIX traditionally builds its shared
+           # libraries.
+           _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+         _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+         # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+         # support --undefined.  This deserves some investigation.  FIXME
+         _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       else
+         _LT_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+         # FIXME: insert proper C++ library support
+         _LT_TAGVAR(ld_shlibs, $1)=no
+         ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+        # as there is no search path for DLLs.
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+        _LT_TAGVAR(always_export_symbols, $1)=no
+        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          # If the export-symbols file already is a .def file (1st line
+          # is EXPORTS), use it as is; otherwise, prepend...
+          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+           cp $export_symbols $output_objdir/$soname.def;
+          else
+           echo EXPORTS > $output_objdir/$soname.def;
+           cat $export_symbols >> $output_objdir/$soname.def;
+          fi~
+          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        else
+          _LT_TAGVAR(ld_shlibs, $1)=no
+        fi
+        ;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+       ;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          ghcx*)
+           # Green Hills C++ Compiler
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+        esac
+        ;;
+
+      freebsd[[12]]*)
+        # C++ shared libraries reported to be fairly broken before
+       # switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                            # but as the default
+                                            # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+             _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+                                                # but as the default
+                                                # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          aCC*)
+           case $host_cpu in
+             hppa*64*)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             ia64*)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             *)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+           esac
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+           ;;
+          *)
+           if test "$GXX" = yes; then
+             if test $with_gnu_ld = no; then
+               case $host_cpu in
+                 hppa*64*)
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 ia64*)
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 *)
+                   _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+               esac
+             fi
+           else
+             # FIXME: insert proper C++ library support
+             _LT_TAGVAR(ld_shlibs, $1)=no
+           fi
+           ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+       _LT_TAGVAR(hardcode_direct, $1)=no
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+       # Instead, shared libraries are loaded at an image base (0x10000000 by
+       # default) and relocated if they conflict, which is a slow very memory
+       # consuming and fragmenting process.  To avoid this, we pick a random,
+       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       ;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+           # SGI C++
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+
+           # Archives containing C++ object files must be created using
+           # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+           ;;
+          *)
+           if test "$GXX" = yes; then
+             if test "$with_gnu_ld" = no; then
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+             else
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+             fi
+           fi
+           _LT_TAGVAR(link_all_deplibs, $1)=yes
+           ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+           # Archives containing C++ object files must be created using
+           # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+           ;;
+         icpc* | ecpc* )
+           # Intel C++
+           with_gnu_ld=yes
+           # version 8.0 and above of icpc choke on multiply defined symbols
+           # if we add $predep_objects and $postdep_objects, however 7.1 and
+           # earlier do not add the objects themselves.
+           case `$CC -V 2>&1` in
+             *"Version 7."*)
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+             *)  # Version 8.0 or newer
+               tmp_idyn=
+               case $host_cpu in
+                 ia64*) tmp_idyn=' -i_dynamic';;
+               esac
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+           esac
+           _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+           case `$CC -V` in
+           *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
+             _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+               compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+             _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+               $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+               $RANLIB $oldlib'
+             _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+             ;;
+           *) # Version 6 will use weak symbols
+             _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+             ;;
+           esac
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+         cxx*)
+           # Compaq C++
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+           runpath_var=LD_RUN_PATH
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+           ;;
+         xl*)
+           # IBM XL 8.0 on PPC, with GNU ld
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           if test "x$supports_anon_versioning" = xyes; then
+             _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+               cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+               echo "local: *; };" >> $output_objdir/$libname.ver~
+               $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+           fi
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+             _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+             _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+             # Not sure whether something based on
+             # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+             # would be better.
+             output_verbose_link_cmd='echo'
+
+             # Archives containing C++ object files must be created using
+             # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+             # necessary to make sure instantiated templates are included
+             # in the archive.
+             _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       ;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+       ;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+         *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+       esac
+       ;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+         _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+         wlarc=
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+         _LT_TAGVAR(hardcode_direct, $1)=yes
+         _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       fi
+       # Workaround some broken pre-1.5 toolchains
+       output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+       ;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+       ;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+       _LT_TAGVAR(ld_shlibs, $1)=no
+       ;;
+
+      openbsd*)
+       if test -f /usr/libexec/ld.so; then
+         _LT_TAGVAR(hardcode_direct, $1)=yes
+         _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+         _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+         if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+           _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+         fi
+         output_verbose_link_cmd=echo
+       else
+         _LT_TAGVAR(ld_shlibs, $1)=no
+       fi
+       ;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+           # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+           # KCC will only create a shared library if the output file
+           # ends with ".so" (or ".sl" for HP-UX), so rename the library
+           # to its proper name (with version) after linking.
+           _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+           # Archives containing C++ object files must be created using
+           # the KAI C++ compiler.
+           case $host in
+             osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+             *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+           esac
+           ;;
+          RCC*)
+           # Rational C++ 2.4.1
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          cxx*)
+           case $host in
+             osf3*)
+               _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+               _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+               ;;
+             *)
+               _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+                 echo "-hidden">> $lib.exp~
+                 $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+                 $RM $lib.exp'
+               _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+               ;;
+           esac
+
+           _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+           ;;
+         *)
+           if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+             _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+             case $host in
+               osf3*)
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 ;;
+               *)
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 ;;
+             esac
+
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+             _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+             # Commands to make compiler produce verbose output that lists
+             # what "hidden" libraries, object files and flags are used when
+             # linking a shared library.
+             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+           else
+             # FIXME: insert proper C++ library support
+             _LT_TAGVAR(ld_shlibs, $1)=no
+           fi
+           ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+           # Sun C++ 4.x
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          lcc*)
+           # Lucid
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+           _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+             $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+           _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+           case $host_os in
+             solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+             *)
+               # The compiler driver will combine and reorder linker options,
+               # but understands `-z linker_flag'.
+               # Supported since Solaris 2.6 (maybe 2.5.1?)
+               _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+               ;;
+           esac
+           _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+           output_verbose_link_cmd='echo'
+
+           # Archives containing C++ object files must be created using
+           # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+           ;;
+          gcx*)
+           # Green Hills C++ Compiler
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+           # The C++ compiler must be used to create the archive.
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+           ;;
+          *)
+           # GNU C++ compiler with Solaris linker
+           if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+             _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+             if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                 $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+             else
+               # g++ 2.7 appears to require `-G' NOT `-shared' on this
+               # platform.
+               _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+             fi
+
+             _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+             case $host_os in
+               solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+               *)
+                 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+                 ;;
+             esac
+           fi
+           ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+       # Note: We 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.
+       _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+       _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+       _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+       _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+       _LT_TAGVAR(link_all_deplibs, $1)=yes
+       _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+       runpath_var='LD_RUN_PATH'
+
+       case $cc_basename in
+          CC*)
+           _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           ;;
+         *)
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           ;;
+       esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+           # NonStop-UX NCC 3.20
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           _LT_TAGVAR(ld_shlibs, $1)=no
+           ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+        prev=$p
+        continue
+       else
+        prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        case $p in
+        -L* | -R*)
+          # Internal compiler library paths should come after those
+          # provided the user.  The postdeps already come after the
+          # user supplied libs so there is no need to process them.
+          if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+            _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+          else
+            _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+          _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+        else
+          _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+        fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+          _LT_TAGVAR(predep_objects, $1)="$p"
+        else
+          _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+        fi
+       else
+        if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+          _LT_TAGVAR(postdep_objects, $1)="$p"
+        else
+          _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_PROG_F77
+# ------------
+# Since AC_PROG_F77 is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_F77],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
+AC_PROG_F77
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_F77
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_F77], [])
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_REQUIRE([_LT_PROG_F77])dnl
+AC_LANG_PUSH(Fortran 77)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  CC=${F77-"f77"}
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$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
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_PROG_FC
+# -----------
+# Since AC_PROG_FC is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_FC],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
+AC_PROG_FC
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_FC
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_FC], [])
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_REQUIRE([_LT_PROG_FC])dnl
+AC_LANG_PUSH(Fortran)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  CC=${FC-"f95"}
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$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
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC="$lt_save_CC"
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_XSI_SHELLFNS
+# ---------------------
+# Bourne and XSI compatible variants of some useful shell functions.
+m4_defun([_LT_PROG_XSI_SHELLFNS],
+[case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+  func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=${1%%=*}
+  func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  case ${1} in
+    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+    *)    func_lo2o_result=${1} ;;
+  esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=$(( $[*] ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=${#1}
+}
+
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+dnl func_dirname_and_basename
+dnl A portable version of this function is already defined in general.m4sh
+dnl so there is no need for it here.
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+  esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[[^=]]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=`expr "$[@]"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$[1]+=\$[2]"
+}
+_LT_EOF
+    ;;
+  *)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$[1]=\$$[1]\$[2]"
+}
+
+_LT_EOF
+    ;;
+  esac
+])
diff --git a/common/m4/ltoptions.m4 b/common/m4/ltoptions.m4
new file mode 100644 (file)
index 0000000..34151a3
--- /dev/null
@@ -0,0 +1,368 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+           [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+                     [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+                  [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [0], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+       [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+       [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+       [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+       [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+        [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+       [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+                [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+                [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+                [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+                [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+                [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/common/m4/ltsugar.m4 b/common/m4/ltsugar.m4
new file mode 100644 (file)
index 0000000..9000a05
--- /dev/null
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+          m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+            [m4_foreach([_Lt_suffix],
+               ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+       [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+         [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+                [lt_append([$1], [$2], [$3])$4],
+                [$5])],
+         [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+       m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+       [$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+                     [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/common/m4/ltversion.m4 b/common/m4/ltversion.m4
new file mode 100644 (file)
index 0000000..f3c5309
--- /dev/null
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers                      -*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# Generated from ltversion.in.
+
+# serial 3017 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.2.6b'
+macro_revision='1.3017'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/common/m4/lt~obsolete.m4 b/common/m4/lt~obsolete.m4
new file mode 100644 (file)
index 0000000..637bb20
--- /dev/null
@@ -0,0 +1,92 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 4 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],  [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],             [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],        [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],         [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],    [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],           [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],             [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],    [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],           [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],       [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],               [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],        [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],    [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],    [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],         [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],            [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],  [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],             [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],            [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],    [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],   [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],          [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],            [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],           [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],  [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],    [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],          [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],          [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],                [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],     [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],          [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],   [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],           [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],           [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],           [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_RC],             [AC_DEFUN([AC_LIBTOOL_RC])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],  [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],      [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],    [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],    [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],    [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],     [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],         [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],       [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
diff --git a/common/m4/pkg.m4 b/common/m4/pkg.m4
new file mode 100755 (executable)
index 0000000..3c20213
--- /dev/null
@@ -0,0 +1,135 @@
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# 
+# Copyright Â© 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=m4_ifval([$1], [$1], [0.9.0])
+       AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               PKG_CONFIG=""
+       fi
+               
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$PKG_CONFIG"; then
+    if test -n "$$1"; then
+        pkg_cv_[]$1="$$1"
+    else
+        PKG_CHECK_EXISTS([$3],
+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+                        [pkg_failed=yes])
+    fi
+else
+       pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+if test $pkg_failed = yes; then
+       $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD
+
+       ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met.
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables
+to avoid the need to call pkg-config.  See the pkg-config man page for
+more details.])],
+               [$4])
+elif test $pkg_failed = untried; then
+       ifelse([$4], , [AC_MSG_FAILURE(dnl
+[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 $1_CFLAGS and $1_LIBS environment variables
+to avoid the need to call pkg-config.  See the pkg-config man page for
+more details.
+
+To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
+               [$4])
+else
+       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+       ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
diff --git a/common/m4/progtest.m4 b/common/m4/progtest.m4
new file mode 100755 (executable)
index 0000000..443c8e3
--- /dev/null
@@ -0,0 +1,59 @@
+# progtest.m4 serial 2 (gettext-0.10.40)
+dnl Copyright (C) 1996-2002 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License.  As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+# Search path for a program which passes the given test.
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN([AM_PATH_PROG_WITH_TEST],
+[# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL(ac_cv_path_$1,
+[case "[$]$1" in
+  /*)
+  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in ifelse([$5], , $PATH, [$5]); do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if [$3]; then
+       ac_cv_path_$1="$ac_dir/$ac_word"
+       break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+  ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
+  AC_MSG_RESULT([$]$1)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_SUBST($1)dnl
+])
diff --git a/common/mangle-tmpl.py b/common/mangle-tmpl.py
new file mode 100755 (executable)
index 0000000..d319040
--- /dev/null
@@ -0,0 +1,155 @@
+# -*- Mode: Python -*-
+# vi:si:et:sw=4:sts=4:ts=4
+
+"""
+use the output from gst-xmlinspect.py to mangle tmpl/*.sgml and
+insert/overwrite Short Description and Long Description
+"""
+
+# FIXME: right now it uses pygst and scans on its own;
+# we really should use inspect/*.xml instead since the result of
+# gst-xmlinspect.py is commited by the docs maintainer, who can be
+# expected to have pygst, but this step should be done for every docs build,
+# so no pygst allowed
+
+# read in inspect/*.xml
+# for every tmpl/element-(name).xml: mangle with details from element
+
+import glob
+import re
+import sys
+import os
+
+class Tmpl:
+    def __init__(self, filename):
+        self.filename = filename
+        self._sectionids = []
+        self._sections = {}
+
+    def read(self):
+        """
+        Read and parse the sections from the given file.
+        """
+        lines = open(self.filename).readlines()
+        matcher = re.compile("<!-- ##### SECTION (\S+) ##### -->\n")
+        id = None
+
+        for line in lines:
+            match = matcher.search(line)
+            if match:
+                id = match.expand("\\1")
+                self._sectionids.append(id)
+                self._sections[id] = []
+            else:
+                if not id:
+                    sys.stderr.write(
+                        "WARNING: line before a SECTION header: %s" % line)
+                else:
+                    self._sections[id].append(line)
+
+    def get_section(self, id):
+        """
+        Get the content from the given section.
+        """
+        return self._sections[id]
+
+    def set_section(self, id, content):
+        """
+        Replace the given section id with the given content.
+        """
+        self._sections[id] = content
+
+    def output(self):
+        """
+        Return the output of the current template in the tmpl/*.sgml format.
+        """
+        lines = []
+        for id in self._sectionids:
+            lines.append("<!-- ##### SECTION %s ##### -->\n" % id)
+            for line in self._sections[id]:
+                lines.append(line)
+
+        return "".join(lines)
+
+    def write(self, backup=False):
+        """
+        Write out the template file again, backing up the previous one.
+        """
+        if backup:
+            target = self.filename + ".mangle.bak"
+            os.rename(self.filename, target)
+
+        handle = open(self.filename, "w")
+        handle.write(self.output())
+        handle.close()
+
+from xml.dom.ext.reader import Sax2
+from xml.dom.NodeFilter import NodeFilter
+
+def get_elements(file):
+    elements = {}
+    handle = open(file)
+    reader = Sax2.Reader()
+    doc = reader.fromStream(handle)
+    handle.close()
+
+    walker = doc.createTreeWalker(doc.documentElement,
+        NodeFilter.SHOW_ELEMENT, None, 0)
+    while walker.currentNode and walker.currentNode.tagName != 'elements':
+        walker.nextNode()
+        
+    # we're at elements now
+    el = walker.firstChild()
+    while walker.currentNode:
+        element = walker.firstChild()
+        # loop over children of <element>
+        name = None
+        description = None
+        while walker.currentNode:
+            if walker.currentNode.tagName == 'name':
+                name = walker.currentNode.firstChild.data.encode('UTF-8')
+            if walker.currentNode.tagName == 'description':
+                description = walker.currentNode.firstChild.data.encode('UTF-8')
+            if not walker.nextSibling(): break
+        # back up to <element>
+        walker.parentNode()
+        elements[name] = {'description': description}
+
+        if not walker.nextSibling(): break
+
+    return elements
+
+        
+def main():
+    if not len(sys.argv) == 3:
+        sys.stderr.write('Please specify the inspect/ dir and the tmpl/ dir')
+        sys.exit(1)
+
+    inspectdir = sys.argv[1]
+    tmpldir = sys.argv[2]
+
+    # parse all .xml files; build map of element name -> short desc
+    #for file in glob.glob("inspect/plugin-*.xml"):
+    elements = {}
+    for file in glob.glob("%s/plugin-*.xml" % inspectdir):
+        elements.update(get_elements(file))
+
+    for file in glob.glob("%s/element-*.sgml" % tmpldir):
+        base = os.path.basename(file)
+        element = base[len("element-"):-len(".sgml")]
+        tmpl = Tmpl(file)
+        tmpl.read()
+        if element in elements.keys():
+            description = elements[element]['description']
+            tmpl.set_section("Short_Description", "%s\n\n" % description)
+
+        # put in an include if not yet there
+        line = '<include xmlns="http://www.w3.org/2003/XInclude" href="' + \
+            'element-' + element + '-details.xml" />\n'
+        section = tmpl.get_section("Long_Description")
+        if not section[0]  == line:
+            section.insert(0, line)
+        tmpl.set_section("Long_Description", section)
+        tmpl.write()
+
+main()
diff --git a/common/plugins.xsl b/common/plugins.xsl
new file mode 100755 (executable)
index 0000000..150087f
--- /dev/null
@@ -0,0 +1,200 @@
+<?xml version='1.0'?> <!--*- mode: xml -*-->
+
+<xsl:stylesheet
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:exsl="http://exslt.org/common"
+  extension-element-prefixes="exsl"
+  version="1.0">
+<xsl:output method="xml" indent="yes"
+            doctype-public ="-//OASIS//DTD DocBook XML V4.1.2//EN"
+            doctype-system = "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/> 
+
+<xsl:param name="module" />
+
+  <xsl:template match="element">
+    <xsl:element name="varlistentry">
+      <xsl:element name="term">
+        <xsl:element name="link">
+          <xsl:attribute name="linkend"><xsl:value-of select="$module" />-plugins-<xsl:value-of select="name"/></xsl:attribute>
+          <xsl:value-of select="name" />
+        </xsl:element>
+      </xsl:element>
+      <xsl:element name="listitem">
+        <xsl:element name="simpara"><xsl:value-of select="description" /></xsl:element>
+      </xsl:element>
+    </xsl:element>
+    <xsl:variable name="name"><xsl:copy-of select="name"/></xsl:variable>
+    <!-- here we write an element-(name)-details.xml file for the element -->
+    <exsl:document href="{concat ('xml/element-', $name, '-details.xml')}" method="xml" indent="yes">
+
+      <xsl:element name="refsect2">
+        <xsl:element name="title">Element Information</xsl:element>
+        <xsl:element name="variablelist">
+        
+          <!-- plugin name and link -->
+          <xsl:element name="varlistentry">
+            <xsl:element name="term">plugin</xsl:element>
+            <xsl:element name="listitem">
+              <xsl:element name="simpara">
+                <xsl:element name="link">
+                  <xsl:attribute name="linkend">plugin-<xsl:value-of select="../../name"/></xsl:attribute>
+                  <xsl:value-of select="../../name" />
+                </xsl:element>
+              </xsl:element>
+            </xsl:element>
+          </xsl:element>
+        
+          <xsl:element name="varlistentry">
+            <xsl:element name="term">author</xsl:element>
+            <xsl:element name="listitem">
+              <xsl:element name="simpara"><xsl:value-of select="author" /></xsl:element>
+            </xsl:element>
+          </xsl:element>
+        
+          <xsl:element name="varlistentry">
+            <xsl:element name="term">class</xsl:element>
+            <xsl:element name="listitem">
+              <xsl:element name="simpara"><xsl:value-of select="class" /></xsl:element>
+            </xsl:element>
+          </xsl:element>
+                      
+        </xsl:element> <!-- variablelist -->
+
+        <xsl:element name="title">Element Pads</xsl:element>
+        <!-- process all caps -->
+        <xsl:for-each select="pads/caps">
+          <xsl:element name="variablelist">
+            <xsl:element name="varlistentry">
+              <xsl:element name="term">name</xsl:element>
+              <xsl:element name="listitem">
+                <xsl:element name="simpara"><xsl:value-of select="name" /></xsl:element>
+              </xsl:element>
+            </xsl:element>
+            
+            <xsl:element name="varlistentry">
+              <xsl:element name="term">direction</xsl:element>
+              <xsl:element name="listitem">
+                <xsl:element name="simpara"><xsl:value-of select="direction" /></xsl:element>
+              </xsl:element>
+            </xsl:element>
+            
+            <xsl:element name="varlistentry">
+              <xsl:element name="term">presence</xsl:element>
+              <xsl:element name="listitem">
+                <xsl:element name="simpara"><xsl:value-of select="presence" /></xsl:element>
+              </xsl:element>
+            </xsl:element>
+            
+            <xsl:element name="varlistentry">
+              <xsl:element name="term">details</xsl:element>
+              <xsl:element name="listitem">
+                <xsl:element name="simpara"><xsl:value-of select="details" /></xsl:element>
+              </xsl:element>
+            </xsl:element>
+
+          </xsl:element> <!-- variablelist -->
+
+          <!--xsl:element name="programlisting"><xsl:value-of select="details" /></xsl:element-->
+
+        </xsl:for-each>
+      </xsl:element>
+
+    </exsl:document>
+  </xsl:template>
+
+  <xsl:template match="plugin">
+    <xsl:element name="refentry">
+      <xsl:attribute name="id"><xsl:value-of select="$module" />-plugins-plugin-<xsl:value-of select="name"/></xsl:attribute>
+
+      <xsl:element name="refmeta">
+        <xsl:element name="refentrytitle">
+          <xsl:value-of select="name"/>
+        </xsl:element>
+        <xsl:element name="manvolnum">3</xsl:element>
+        <xsl:element name="refmiscinfo">FIXME Library</xsl:element>
+      </xsl:element> <!-- refmeta -->
+
+      <xsl:element name="refnamediv">
+        <xsl:element name="refname">
+          <xsl:element name="anchor">
+            <xsl:attribute name="id">plugin-<xsl:value-of select="name"/></xsl:attribute>
+            <xsl:value-of select="name"/>
+          </xsl:element>
+        </xsl:element>
+  
+        <xsl:element name="refpurpose">
+          <xsl:value-of select="description"/>
+        </xsl:element>
+      </xsl:element>
+
+      <xsl:element name="refsect1">
+        <xsl:element name="title">Plugin Information</xsl:element>
+        <xsl:element name="variablelist">
+
+          <xsl:element name="varlistentry">
+            <xsl:element name="term">filename</xsl:element>
+            <xsl:element name="listitem">
+              <xsl:element name="simpara"><xsl:value-of select="basename" /></xsl:element>
+            </xsl:element>
+          </xsl:element>
+
+          <xsl:element name="varlistentry">
+            <xsl:element name="term">version</xsl:element>
+            <xsl:element name="listitem">
+              <xsl:element name="simpara"><xsl:value-of select="version" /></xsl:element>
+            </xsl:element>
+          </xsl:element>
+
+          <xsl:element name="varlistentry">
+            <xsl:element name="term">run-time license</xsl:element>
+            <xsl:element name="listitem">
+              <xsl:element name="simpara"><xsl:value-of select="license" /></xsl:element>
+            </xsl:element>
+          </xsl:element>
+
+          <xsl:element name="varlistentry">
+            <xsl:element name="term">package</xsl:element>
+            <xsl:element name="listitem">
+              <xsl:element name="simpara"><xsl:value-of select="package" /></xsl:element>
+            </xsl:element>
+          </xsl:element>
+
+          <xsl:element name="varlistentry">
+            <xsl:element name="term">origin</xsl:element>
+            <xsl:element name="listitem">
+              <xsl:element name="simpara">
+                <!-- only show origin as link if it starts with http -->
+                <xsl:choose>
+                  <xsl:when test="substring(@href, 1, 4) = 'http'">
+                    <xsl:element name="ulink">
+                      <xsl:attribute name="url"><xsl:value-of select="origin" /></xsl:attribute>
+                      <xsl:value-of select="origin" />
+                    </xsl:element>
+                  </xsl:when>
+                  <xsl:otherwise>
+                    <xsl:value-of select="origin" />
+                  </xsl:otherwise>
+                </xsl:choose>
+              </xsl:element>
+            </xsl:element>
+          </xsl:element>
+
+        </xsl:element>
+      </xsl:element>
+
+      <xsl:element name="refsect1">
+        <xsl:element name="title">Elements</xsl:element>
+        <!-- process all elements -->
+        <xsl:element name="variablelist">
+          <xsl:apply-templates select="elements"/>
+        </xsl:element>
+      </xsl:element>
+
+    </xsl:element>
+
+  </xsl:template>
+
+  <!-- ignore -->
+  <xsl:template match="gst-plugin-paths" />
+
+</xsl:stylesheet>
diff --git a/common/po.mak b/common/po.mak
new file mode 100755 (executable)
index 0000000..e019fac
--- /dev/null
@@ -0,0 +1,4 @@
+# rule to download the latest .po files
+download-po: $(top_srcdir)/common/download-translations
+       $(top_srcdir)/common/download-translations $(PACKAGE)
+
diff --git a/common/release.mak b/common/release.mak
new file mode 100755 (executable)
index 0000000..afb0c8c
--- /dev/null
@@ -0,0 +1,25 @@
+# include this snippet to add a common release: target by using
+# include $(top_srcdir)/common/release.mak
+
+# make bz2 as well
+AUTOMAKE_OPTIONS = dist-bzip2
+
+release: dist
+       $(MAKE) $(PACKAGE)-$(VERSION).tar.gz.md5
+       $(MAKE) $(PACKAGE)-$(VERSION).tar.bz2.md5
+
+# generate md5 sum files
+%.md5: %
+       md5sum $< > $@
+
+# check that no marshal or enumtypes files are included
+# this in turn ensures that distcheck fails for missing .list files which is currently
+# shadowed when the corresponding .c and .h files are included.
+distcheck-hook:
+       @test "x" = "x`find $(distdir) -name \*-enumtypes.[ch] | grep -v win32`" && \
+       test "x" = "x`find $(distdir) -name \*-marshal.[ch]`" || \
+       ( $(ECHO) "*** Leftover enumtypes or marshal files in the tarball." && \
+          $(ECHO) "*** Make sure the following files are not disted:" && \
+          find $(distdir) -name \*-enumtypes.[ch] | grep -v win32 && \
+          find $(distdir) -name \*-marshal.[ch] && \
+          false )
diff --git a/common/scangobj-merge.py b/common/scangobj-merge.py
new file mode 100755 (executable)
index 0000000..4917255
--- /dev/null
@@ -0,0 +1,226 @@
+#!/usr/bin/python
+# -*- Mode: Python -*-
+# vi:si:et:sw=4:sts=4:ts=4
+
+"""
+parse, update and write .signals and .args files
+"""
+
+from twisted.python import util
+
+import sys
+import os
+
+def debug(*args):
+    pass
+
+class Object:
+    def __init__(self, name):
+        self._signals = util.OrderedDict()
+        self._args = util.OrderedDict()
+        self.name = name
+
+    def __repr__(self):
+        return "<Object %s>" % self.name
+
+    def add_signal(self, signal, overwrite=True):
+        if not overwrite and self._signals.has_key(signal.name):
+            raise IndexError, "signal %s already in %r" % (signal.name, self)
+        self._signals[signal.name] = signal
+
+    def add_arg(self, arg, overwrite=True):
+        if not overwrite and self._args.has_key(arg.name):
+            raise IndexError, "arg %s already in %r" % (arg.name, self)
+        self._args[arg.name] = arg
+        
+class Docable:
+    def __init__(self, **kwargs):
+        for key in self.attrs:
+            setattr(self, key, kwargs[key])
+        self.dict = kwargs
+
+    def __repr__(self):
+        return "<%r %s>" % (str(self.__class__), self.name)
+
+class Signal(Docable):
+    attrs = ['name', 'returns', 'args']
+
+class Arg(Docable):
+    attrs = ['name', 'type', 'range', 'flags', 'nick', 'blurb', 'default']
+
+class GDoc:
+    def load_file(self, filename):
+        try:
+            lines = open(filename).readlines()
+            self.load_data("".join(lines))
+        except IOError:
+            print "WARNING - could not read from %s" % filename
+
+    def save_file(self, filename, backup=False):
+        """
+        Save the signals information to the given .signals file if the
+        file content changed.
+        """
+        olddata = None
+        try:
+            lines = open(filename).readlines()
+            olddata = "".join(lines)
+        except IOError:
+            print "WARNING - could not read from %s" % filename
+        newdata = self.get_data()
+        if olddata and olddata == newdata:
+            return
+
+        if olddata:
+            if backup:
+                os.rename(filename, filename + '.bak')
+
+        handle = open(filename, "w")
+        handle.write(newdata)
+        handle.close()
+
+class Signals(GDoc):
+    def __init__(self):
+        self._objects = util.OrderedDict()
+
+    def load_data(self, data):
+        """
+        Load the .signals lines, creating our list of objects and signals.
+        """
+        import re
+        smatcher = re.compile(
+            '(?s)'                                      # make . match \n
+            '<SIGNAL>\n(.*?)</SIGNAL>\n'
+            )
+        nmatcher = re.compile(
+            '<NAME>'
+            '(?P<object>\S*)'                           # store object
+            '::'
+            '(?P<signal>\S*)'                           # store signal
+            '</NAME>'
+        )
+        rmatcher = re.compile(
+            '(?s)'                                      # make . match \n
+            '<RETURNS>(?P<returns>\S*)</RETURNS>\n'     # store returns
+            '(?P<args>.*)'                              # store args
+        )
+        for block in smatcher.findall(data):
+            nmatch = nmatcher.search(block)
+            if nmatch:
+                o = nmatch.group('object')
+                debug("Found object", o)
+                debug("Found signal", nmatch.group('signal'))
+                if not self._objects.has_key(o):
+                    object = Object(o)
+                    self._objects[o] = object
+
+                rmatch = rmatcher.search(block)
+                if rmatch:
+                    dict = rmatch.groupdict().copy()
+                    dict['name'] = nmatch.group('signal')
+                    signal = Signal(**dict)
+                    self._objects[o].add_signal(signal)
+
+    def get_data(self):
+        lines = []
+        for o in self._objects.values():
+            for s in o._signals.values():
+                block = """<SIGNAL>
+<NAME>%(object)s::%(name)s</NAME>
+<RETURNS>%(returns)s</RETURNS>
+%(args)s</SIGNAL>
+"""
+                d = s.dict.copy()
+                d['object'] = o.name
+                lines.append(block % d)
+
+        return "\n".join(lines) + '\n'
+
+class Args(GDoc):
+    def __init__(self):
+        self._objects = util.OrderedDict()
+
+    def load_data(self, data):
+        """
+        Load the .args lines, creating our list of objects and args.
+        """
+        import re
+        amatcher = re.compile(
+            '(?s)'                                      # make . match \n
+            '<ARG>\n(.*?)</ARG>\n'
+            )
+        nmatcher = re.compile(
+            '<NAME>'
+            '(?P<object>\S*)'                           # store object
+            '::'
+            '(?P<arg>\S*)'                              # store arg
+            '</NAME>'
+        )
+        rmatcher = re.compile(
+            '(?s)'                                      # make . match \n
+            '<TYPE>(?P<type>\S*)</TYPE>\n'              # store type
+            '<RANGE>(?P<range>.*?)</RANGE>\n'           # store range
+            '<FLAGS>(?P<flags>\S*)</FLAGS>\n'           # store flags
+            '<NICK>(?P<nick>.*?)</NICK>\n'              # store nick
+            '<BLURB>(?P<blurb>.*?)</BLURB>\n'           # store blurb
+            '<DEFAULT>(?P<default>.*?)</DEFAULT>\n'     # store default
+        )
+        for block in amatcher.findall(data):
+            nmatch = nmatcher.search(block)
+            if nmatch:
+                o = nmatch.group('object')
+                debug("Found object", o)
+                debug("Found arg", nmatch.group('arg'))
+                if not self._objects.has_key(o):
+                    object = Object(o)
+                    self._objects[o] = object
+
+                rmatch = rmatcher.search(block)
+                if rmatch:
+                    dict = rmatch.groupdict().copy()
+                    dict['name'] = nmatch.group('arg')
+                    arg = Arg(**dict)
+                    self._objects[o].add_arg(arg)
+                else:
+                    print "ERROR: could not match arg from block %s" % block
+
+    def get_data(self):
+        lines = []
+        for o in self._objects.values():
+            for a in o._args.values():
+                block = """<ARG>
+<NAME>%(object)s::%(name)s</NAME>
+<TYPE>%(type)s</TYPE>
+<RANGE>%(range)s</RANGE>
+<FLAGS>%(flags)s</FLAGS>
+<NICK>%(nick)s</NICK>
+<BLURB>%(blurb)s</BLURB>
+<DEFAULT>%(default)s</DEFAULT>
+</ARG>
+"""
+                d = a.dict.copy()
+                d['object'] = o.name
+                lines.append(block % d)
+
+        return "\n".join(lines) + '\n'
+
+def main(argv):
+    modulename = None
+    try:
+        modulename = argv[1]
+    except IndexError:
+        sys.stderr.write('Pleae provide a documentation module name\n')
+        sys.exit(1)
+
+    print "Merging scangobj output for %s" % modulename
+    signals = Signals()
+    signals.load_file(modulename + '.signals')
+    signals.load_file(modulename + '.signals.new')
+    signals.save_file(modulename + '.signals', backup=True)
+
+    args = Args()
+    args.load_file(modulename + '.args')
+    args.load_file(modulename + '.args.new')
+    args.save_file(modulename + '.args', backup=True)
+
+main(sys.argv)
diff --git a/common/upload.mak b/common/upload.mak
new file mode 100755 (executable)
index 0000000..60731e5
--- /dev/null
@@ -0,0 +1,33 @@
+# this snippet is to be included by both our docbook manuals
+# and gtk-doc API references
+
+# it adds an upload target to each of these dir's Makefiles
+
+# each Makefile.am should define the following variables:
+# - DOC: the base name of the documentation
+#        (faq, manual, pwg, gstreamer, gstreamer-libs)
+# - FORMATS: the formats in which DOC is output
+#            (html ps pdf)
+
+# if you want to use it, make sure your $HOME/.ssh/config file contains the
+# correct User entry for the Host entry for the DOC_SERVER
+
+# these variables define the location of the online docs
+DOC_SERVER = gstreamer.freedesktop.org
+DOC_BASE = /srv/gstreamer.freedesktop.org/www/data/doc
+DOC_URL = $(DOC_SERVER):$(DOC_BASE)
+
+upload: $(FORMATS)
+       @if test "x$(PACKAGE_VERSION_NANO)" = x0; then \
+            export DOCVERSION=$(VERSION); \
+        else export DOCVERSION=head; \
+        fi; \
+        export DIR=$(DOC_BASE)/gstreamer/$$DOCVERSION/$(DOC); \
+       ssh $(DOC_SERVER) mkdir -p $$DIR; \
+       if echo $(FORMATS) | grep html > /dev/null; then export SRC="$$SRC html"; fi; \
+       if echo $(FORMATS) | grep ps > /dev/null; then export SRC="$$SRC $(DOC).ps"; fi; \
+       if echo $(FORMATS) | grep pdf > /dev/null; then export SRC="$$SRC $(DOC).pdf"; fi; \
+       echo Uploading $$SRC to $(DOC_SERVER):$$DIR; \
+       rsync -rv -e ssh --delete $$SRC $(DOC_SERVER):$$DIR; \
+       ssh $(DOC_SERVER) chmod -R g+w $$DIR; \
+       echo Done
diff --git a/common/win32.mak b/common/win32.mak
new file mode 100755 (executable)
index 0000000..63b1310
--- /dev/null
@@ -0,0 +1,54 @@
+# various tests to make sure we dist the win32 stuff (for MSVC builds) right
+
+# the MANIFEST contains all win32 related files that should be disted
+win32 = $(shell cat $(top_srcdir)/win32/MANIFEST)
+
+# wildcard is apparently not portable to other makes, hence the use of find
+# these are library .def files with the symbols to export
+win32defs = $(shell find $(top_srcdir)/win32/common -name '*.def')
+
+# wildcard is apparently not portable to other makes, hence the use of find
+# these are files that need to be disted with CRLF line endings:
+win32crlf = $(shell find $(top_srcdir)/win32 -name '*.dsw' -o -name '*.dsp')
+
+win32-debug:
+       @echo; \
+       echo win32     = $(win32); \
+       echo; \
+       echo win32defs = $(win32defs); \
+       echo; \
+       echo win32crlf = $(win32crlf); \
+       echo
+
+win32-check-crlf:
+       @echo Checking win32 files for CR LF line endings ...; \
+       fail=0 ; \
+       for each in $(win32crlf) ; do \
+         if ! (file $$each | grep CRLF >/dev/null) ; then \
+           echo $$each must be fixed to have CRLF line endings ; \
+           fail=1; \
+         fi ; \
+       done ; \
+       exit $$fail
+
+# make sure all symbols we export on linux are defined in the win32 .def too
+# (don't care about other unixes for now, it's enough if it works on one of
+# the linux build bots; we assume .so )
+check-exports:
+       fail=0 ; \
+       for l in $(win32defs); do \
+         libbase=`basename "$$l" ".def"`; \
+         libso=`find "$(top_builddir)" -name "$$libbase-@GST_MAJORMINOR@.so"`; \
+         libdef="$(top_srcdir)/win32/common/$$libbase.def"; \
+         if test "x$$libso" != "x"; then \
+           echo Checking symbols in $$libso; \
+           if ! ($(top_srcdir)/common/check-exports $$libdef $$libso) ; then \
+             fail=1; \
+           fi; \
+         fi; \
+       done
+
+
+dist-hook: check-exports win32-check-crlf
+
+
diff --git a/configure.ac b/configure.ac
new file mode 100755 (executable)
index 0000000..c57ef7f
--- /dev/null
@@ -0,0 +1,388 @@
+
+AC_INIT(extension, 1.0)
+dnl versions of gstreamer and plugins-base
+GST_MAJORMINOR=0.10
+GST_REQUIRED=0.10.0
+GSTPB_REQUIRED=0.10.0
+EFL_REQUIRED=1.0.0
+
+dnl fill in your package name and version here
+dnl the fourth (nano) number should be 0 for a release, 1 for CVS,
+dnl and 2... for a prerelease
+
+dnl when going to/from release please set the nano correctly !
+dnl releases only do Wall, cvs and prerelease does Werror too
+AS_VERSION(gst-plugin, GST_PLUGIN_VERSION, 0, 10, 0, 1,
+    GST_PLUGIN_CVS="no", GST_PLUGIN_CVS="yes")
+
+dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode
+AM_MAINTAINER_MODE
+
+#AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+AM_INIT_AUTOMAKE
+
+#AC_CONFIG_MACRO_DIR([m4])
+
+dnl make aclocal work in maintainer mode
+dnl AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
+
+dnl Add parameters for aclocal
+AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I common/m4")
+
+AM_CONFIG_HEADER(config.h)
+
+dnl check for tools
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_LIBTOOL
+
+dnl decide on error flags
+AS_COMPILER_FLAG(-Wall, GST_WALL="yes", GST_WALL="no")
+                                                                                
+if test "x$GST_WALL" = "xyes"; then
+   GST_ERROR="$GST_ERROR -Wall"
+                                                                                
+#   if test "x$GST_PLUGIN_CVS" = "xyes"; then
+#     AS_COMPILER_FLAG(-Werror,GST_ERROR="$GST_ERROR -Werror",GST_ERROR="$GST_ERROR")
+#   fi
+fi
+
+dnl Check for pkgconfig first
+AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
+
+dnl Give error and exit if we don't have pkgconfig
+if test "x$HAVE_PKGCONFIG" = "xno"; then
+  AC_MSG_ERROR(you need to have pkgconfig installed !)
+fi
+
+dnl Now we're ready to ask for gstreamer libs and cflags
+dnl And we can also ask for the right version of gstreamer
+AM_CONDITIONAL([IS_VODA_SDK], [test "x$DISTRO" = "xvodafone-sdk"])
+AM_CONDITIONAL([ISPROTECTOR_VODA_SDK], [test "x$DISTRO" = "xvodafone-sdk" && test "x$MACHINE" = "xprotector"])
+AM_CONDITIONAL([ISVOLANS_VODA_SDK], [test "x$DISTRO" = "xvodafone-sdk" && test "x$MACHINE" = "xvolans"])
+AM_CONDITIONAL([ISPROTECTOR_TARGET], [test "x$ARCH" = "xarm" && test "x$MACHINE" = "xprotector"])
+AM_CONDITIONAL([ISVOLANS_TARGET], [test "x$ARCH" = "xarm" && test "x$MACHINE" = "xvolans"])
+
+PKG_CHECK_MODULES(GST, \
+  gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED,
+  HAVE_GST=yes,HAVE_GST=no)
+
+dnl Give error and exit if we don't have gstreamer
+if test "x$HAVE_GST" = "xno"; then
+  AC_MSG_ERROR(you need gstreamer development packages installed !)
+fi
+
+dnl append GST_ERROR cflags to GST_CFLAGS
+GST_CFLAGS="$GST_CFLAGS $GST_ERROR"
+
+dnl make GST_CFLAGS and GST_LIBS available
+PKG_CHECK_MODULES(GST, gstreamer-0.10 >= 0.10)
+AC_SUBST(GST_CFLAGS)
+AC_SUBST(GST_LIBS)
+
+dnl make GST_MAJORMINOR available in Makefile.am
+AC_SUBST(GST_MAJORMINOR)
+
+dnl If we need them, we can also use the base class libraries
+PKG_CHECK_MODULES(GST_BASE, gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED,
+                  HAVE_GST_BASE=yes, HAVE_GST_BASE=no)
+
+dnl Give a warning if we don't have gstreamer libs
+dnl you can turn this into an error if you need them
+if test "x$HAVE_GST_BASE" = "xno"; then
+  AC_MSG_NOTICE(no GStreamer base class libraries found (gstreamer-base-$GST_MAJORMINOR))
+fi
+
+dnl make _CFLAGS and _LIBS available
+AC_SUBST(GST_BASE_CFLAGS)
+AC_SUBST(GST_BASE_LIBS)
+
+dnl If we need them, we can also use the gstreamer-plugins-base libraries
+PKG_CHECK_MODULES(GSTPB_BASE,
+                  gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPB_REQUIRED,
+                  HAVE_GSTPB_BASE=yes, HAVE_GSTPB_BASE=no)
+
+dnl Give a warning if we don't have gstreamer libs
+dnl you can turn this into an error if you need them
+if test "x$HAVE_GSTPB_BASE" = "xno"; then
+  AC_MSG_NOTICE(no GStreamer Plugins Base libraries found (gstreamer-plugins-base-$GST_MAJORMINOR))
+fi
+
+dnl make _CFLAGS and _LIBS available
+AC_SUBST(GSTPB_BASE_CFLAGS)
+AC_SUBST(GSTPB_BASE_LIBS)
+
+dnl If we need them, we can also use the gstreamer-controller libraries
+PKG_CHECK_MODULES(GSTCTRL,
+                  gstreamer-controller-$GST_MAJORMINOR >= $GSTPB_REQUIRED,
+                  HAVE_GSTCTRL=yes, HAVE_GSTCTRL=no)
+
+dnl Give a warning if we don't have gstreamer-controller
+dnl you can turn this into an error if you need them
+if test "x$HAVE_GSTCTRL" = "xno"; then
+  AC_MSG_NOTICE(no GStreamer Controller libraries found (gstreamer-controller-$GST_MAJORMINOR))
+fi
+
+dnl make _CFLAGS and _LIBS available
+AC_SUBST(GSTCTRL_CFLAGS)
+AC_SUBST(GSTCTRL_LIBS)
+
+dnl set the plugindir where plugins should be installed
+if test "x${prefix}" = "x$HOME"; then
+  plugindir="$HOME/.gstreamer-$GST_MAJORMINOR/plugins"
+else
+  plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
+fi
+AC_SUBST(plugindir)
+
+dnl set proper LDFLAGS for plugins
+#GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
+GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\|FIR_\|arkamys_malloc\|arkamys_free\).*'
+#GST_PLUGIN_LDFLAGS='-module -avoid-version'
+AC_SUBST(GST_PLUGIN_LDFLAGS)
+
+
+PKG_CHECK_MODULES(GST_AUDIO, gstreamer-audio-$GST_MAJORMINOR >= $GST_REQUIRED )
+
+
+dnl make _CFLAGS and _LIBS available
+AC_SUBST(GST_AUDIO_CFLAGS)
+AC_SUBST(GST_AUDIO_LIBS)
+
+PKG_CHECK_MODULES(GST_VIDEO, gstreamer-video-$GST_MAJORMINOR >= $GST_REQUIRED)
+
+dnl make _CFLAGS and _LIBS available
+AC_SUBST(GST_VIDEO_CFLAGS)
+AC_SUBST(GST_VIDEO_LIBS)
+
+PKG_CHECK_MODULES(GST_INTERFACES, gstreamer-interfaces-$GST_MAJORMINOR >= $GST_REQUIRED)
+AC_SUBST(GST_INTERFACES_CFLAGS)
+AC_SUBST(GST_INTERFACES_LIBS)
+
+dnl xvimagesrc _CFLAGS and _LIB available
+
+PKG_CHECK_MODULES(DRI2, libdri2)
+AC_SUBST(DRI2_CFLAGS)
+AC_SUBST(DRI2_LIBS)
+
+PKG_CHECK_MODULES(X11, x11)
+AC_SUBST(X11_CFLAGS)
+AC_SUBST(X11_LIBS)
+
+PKG_CHECK_MODULES(XEXT, xext)
+AC_SUBST(XEXT_CFLAGS)
+AC_SUBST(XEXT_LIBS)
+
+PKG_CHECK_MODULES(XV, xv)
+AC_SUBST(XV_CFLAGS)
+AC_SUBST(XV_LIBS)
+
+PKG_CHECK_MODULES(XDAMAGE, xdamage)
+AC_SUBST(XDAMAGE_CFLAGS)
+AC_SUBST(XDAMAGE_LIBS)
+
+PKG_CHECK_MODULES(DRM, libdrm)
+AC_SUBST(DRM_CFLAGS)
+AC_SUBST(DRM_LIBS)
+
+PKG_CHECK_MODULES(DRM, libdrm-devel)
+AC_SUBST(DRM_DEVEL_CFLAGS)
+AC_SUBST(DRM_DEVEL_LIBS)
+
+PKG_CHECK_MODULES(DRM_SLP, libdrm_slp)
+AC_SUBST(DRM_SLP_CFLAGS)
+AC_SUBST(DRM_SLP_LIBS)
+
+dnl use time analysis module
+PKG_CHECK_MODULES(MMTA, mm-ta)
+AC_SUBST(MMTA_CFLAGS)
+AC_SUBST(MMTA_LIBS)
+
+dnl required package for evasimagesink
+PKG_CHECK_MODULES(EFL, [
+  evas >= $EFL_REQUIRED
+  ecore >= $EFL_REQUIRED
+  ecore-x >= $EFL_REQUIRED
+], [
+  AC_SUBST(EFL_CFLAGS)
+  AC_SUBST(EFL_LIBS)
+], [
+  AC_MSG_ERROR([
+      You need to install or upgrade the EFL development
+      packages on your system. On debian-based systems these are
+      libevas-dev and libecore-dev.
+      The minimum version required is $EFL_REQUIRED.
+  ])
+])
+
+dnl PKG_CHECK_MODULES(UDEVMGR, unified-dev-mgr)
+dnl AC_SUBST(UDEVMGR_CFLAGS)
+dnl AC_SUBST(UDEVMGR_LIBS)
+
+dnl use ext-encodebin --------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-encodebin, AC_HELP_STRING([--enable-ext-encodebin], [using encodebin]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_ENCODEBIN=yes ;;
+      no)  GST_EXT_USE_EXT_ENCODEBIN=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-encodebin) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_ENCODEBIN=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_ENCODEBIN, test "x$GST_EXT_USE_EXT_ENCODEBIN" = "xyes")
+
+dnl use ext-avsystem --------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-avsystem, AC_HELP_STRING([--enable-ext-avsystem], [using avsystem]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_AVSYSTEM=yes ;;
+      no)  GST_EXT_USE_EXT_AVSYSTEM=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-avsystem) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_AVSYSTEM=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_AVSYSTEM, test "x$GST_EXT_USE_EXT_AVSYSTEM" = "xyes")
+
+dnl use ext-evasimagesink --------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-evasimagesink, AC_HELP_STRING([--enable-ext-evasimagesink], [using evasimagesink]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_EVASIMAGESINK=yes ;;
+      no)  GST_EXT_USE_EXT_EVASIMAGESINK=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-evasimagesink) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_EVASIMAGESINK=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_EVASIMAGESINK, test "x$GST_EXT_USE_EXT_EVASIMAGESINK" = "xyes")
+
+dnl use ext-xvimagesrc--------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-xvimagesrc, AC_HELP_STRING([--enable-ext-xvimagesrc], [using xvimagesrc]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_XVIMAGESRC=yes ;;
+      no)  GST_EXT_USE_EXT_XVIMAGESRC=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-xvimagesrc) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_XVIMAGESRC=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_XVIMAGESRC, test "x$GST_EXT_USE_EXT_XVIMAGESRC" = "xyes")
+
+dnl use ext-gstreamer-audio -------------------------------------------------------------------
+AC_ARG_ENABLE(ext-gstreamer-audio, AC_HELP_STRING([--enable-ext-gstreamer-audio], [using gstreamer-audio]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_AVSYSAUDIO=yes ;;
+      no)  GST_EXT_USE_EXT_AVSYSAUDIO=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-gstreamer-audio) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_AVSYSAUDIO=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_AVSYSAUDIO, test "x$GST_EXT_USE_EXT_AVSYSAUDIO" = "xyes")
+
+if test "x$GST_EXT_USE_EXT_AVSYSAUDIO" = "xyes"; then
+       HAVE_AVSYSAUDIO=NO
+       PKG_CHECK_MODULES(AVSYSAUDIO, avsysaudio, HAVE_AVSYSAUDIO="yes", [
+           HAVE_AVSYSAUDIO="no"
+           AC_MSG_RESULT(no)
+         ])
+       if test "x$HAVE_AVSYSAUDIO" = "xno"; then
+         AC_MSG_ERROR(no avsysaudio package found)
+       fi
+       AC_SUBST(AVSYSAUDIO_CFLAGS)
+       AC_SUBST(AVSYSAUDIO_LIBS)
+fi     
+
+dnl use ext-drmsrc --------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-drmsrc, AC_HELP_STRING([--enable-ext-drmsrc], [using drmsrc]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_DRMSRC=yes ;;
+      no)  GST_EXT_USE_EXT_DRMSRC=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-drmsrc) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_DRMSRC=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_DRMSRC, test "x$GST_EXT_USE_EXT_DRMSRC" = "xyes")
+dnl use ext-toggle --------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-toggle, AC_HELP_STRING([--enable-ext-toggle], [using toggle]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_TOGGLE=yes ;;
+      no)  GST_EXT_USE_EXT_TOGGLE=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-toggle) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_TOGGLE=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_TOGGLE, test "x$GST_EXT_USE_EXT_TOGGLE" = "xyes")
+
+dnl for i386 --------------------------------------------------------------------------
+AC_ARG_ENABLE(i386, AC_HELP_STRING([--enable-i386], [i386 build]),
+       [
+        case "${enableval}" in
+         yes) IS_I386=yes ;;
+         no)  IS_I386=no ;;
+         *)   AC_MSG_ERROR(bad value ${enableval} for --enable-i386) ;;
+        esac
+       ],
+       [IS_I386=no])
+AM_CONDITIONAL([IS_I386], [test "x$IS_I386" = "xyes"])
+
+dnl use ext-pdpushsrc --------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-pdpushsrc, AC_HELP_STRING([--enable-ext-pdpushsrc], [using pdpushsrc]),
+[
+ case "${enableval}" in
+        yes) GST_EXT_USE_EXT_PD_PUSHSRC=yes ;;
+        no)  GST_EXT_USE_EXT_PD_PUSHSRC=no ;;
+        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-pdpushsrc) ;;
+ esac
+ ],
+ [GST_EXT_USE_EXT_PD_PUSHSRC=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_PD_PUSHSRC, test "x$GST_EXT_USE_EXT_PD_PUSHSRC" = "xyes")
+dnl use ext-audiotp --------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-audiotp, AC_HELP_STRING([--enable-ext-audiotp], [using audiotp]),
+[
+ case "${enableval}" in
+        yes) GST_EXT_USE_EXT_AUDIOTP=yes ;;
+        no)  GST_EXT_USE_EXT_AUDIOTP=no ;;
+        *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-audiotp) ;;
+ esac
+ ],
+ [GST_EXT_USE_EXT_AUDIOTP=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_AUDIOTP, test "x$GST_EXT_USE_EXT_AUDIOTP" = "xyes")
+
+dnl use ext-audioeq --------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-audioeq, AC_HELP_STRING([--enable-ext-audioeq], [using audioeq]),
+[
+ case "${enableval}" in
+         yes) GST_EXT_USE_EXT_AUDIOEQ=yes ;;
+         no)  GST_EXT_USE_EXT_AUDIOEQ=no ;;
+         *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-audioeq) ;;
+ esac    
+ ],
+ [GST_EXT_USE_EXT_AUDIOEQ=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_AUDIOEQ, test "x$GST_EXT_USE_EXT_AUDIOEQ" = "xyes")
+
+AC_OUTPUT(
+Makefile
+common/Makefile
+common/m4/Makefile
+avsystem/Makefile
+pdpushsrc/Makefile
+pdpushsrc/src/Makefile
+avsystem/src/Makefile
+encodebin/Makefile
+encodebin/src/Makefile
+evasimagesink/Makefile
+evasimagesink/src/Makefile
+xvimagesrc/Makefile
+xvimagesrc/src/Makefile
+toggle/Makefile
+toggle/src/Makefile
+drmsrc/Makefile
+drmsrc/src/Makefile
+audiotp/Makefile
+audiotp/src/Makefile
+audioeq/Makefile
+audioeq/src/Makefile
+)
diff --git a/drmsrc/Makefile.am b/drmsrc/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/drmsrc/src/Makefile.am b/drmsrc/src/Makefile.am
new file mode 100755 (executable)
index 0000000..37eb3bb
--- /dev/null
@@ -0,0 +1,27 @@
+# plugindir is set in configure
+
+##############################################################################
+# change libgstplugin.la to something more suitable, e.g. libmysomething.la  #
+##############################################################################
+plugin_LTLIBRARIES = libgstdrmsrc.la
+
+##############################################################################
+# for the next set of variables, rename the prefix if you renamed the .la,   #
+#  e.g. libgstplugin_la_SOURCES => libmysomething_la_SOURCES                 #
+#       libgstplugin_la_CFLAGS  => libmysomething_la_CFLAGS                  #
+#       libgstplugin_la_LIBADD  => libmysomething_la_LIBADD                  #
+#       libgstplugin_la_LDFLAGS => libmysomething_la_LDFLAGS                 #
+##############################################################################
+
+# sources used to compile this plug-in
+libgstdrmsrc_la_SOURCES = gstdrmsrc.c
+
+# flags used to compile this plugin
+# add other _CFLAGS and _LIBS as needed
+libgstdrmsrc_la_CFLAGS = $(GST_CFLAGS) $(MMTA_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+libgstdrmsrc_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(MMTA_LIBS)
+libgstdrmsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+# headers we need but don't want installed
+noinst_HEADERS = gstdrmsrc.h
+
diff --git a/drmsrc/src/gstdrmsrc.c b/drmsrc/src/gstdrmsrc.c
new file mode 100644 (file)
index 0000000..92916f2
--- /dev/null
@@ -0,0 +1,625 @@
+/*
+ * drmsrc
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "gstdrmsrc.h"
+
+#define LOG_TRACE(message)  //g_print("DRM_SRC: %s: %d: %s - %s \n", __FILE__, __LINE__, __FUNCTION__, message);
+
+#define GST_TAG_PLAYREADY "playready_file_path"
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,GST_STATIC_CAPS_ANY);
+
+
+GST_DEBUG_CATEGORY_STATIC (gst_drm_src_debug);
+#define GST_CAT_DEFAULT gst_drm_src_debug
+
+enum
+{
+       ARG_0,
+       ARG_LOCATION,
+       ARG_FD
+};
+static void gst_drm_src_finalize (GObject * object);
+static void gst_drm_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_drm_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
+static gboolean gst_drm_src_start (GstBaseSrc * basesrc);
+static gboolean gst_drm_src_stop (GstBaseSrc * basesrc);
+static gboolean gst_drm_src_is_seekable (GstBaseSrc * src);
+static gboolean gst_drm_src_get_size (GstBaseSrc * src, guint64 * size);
+static GstFlowReturn gst_drm_src_create (GstBaseSrc * src, guint64 offset, guint length, GstBuffer ** buffer);
+static void gst_drm_src_uri_handler_init (gpointer g_iface, gpointer iface_data);
+
+/**
+ * This function does the following:
+ *  1. Initializes GstDrmSrc ( defines gst_drm_get_type)
+ *
+ * @param   drmsrc_type    [out]  GType
+ *
+ * @return  void
+ */
+static void _do_init (GType drmsrc_type)
+{
+       // 1. Initializes GstDrmSrc ( defines gst_drm_get_type)
+       static const GInterfaceInfo urihandler_info = {
+               gst_drm_src_uri_handler_init,
+               NULL,
+               NULL
+       };
+
+       g_type_add_interface_static (drmsrc_type, GST_TYPE_URI_HANDLER, &urihandler_info);
+       GST_DEBUG_CATEGORY_INIT (gst_drm_src_debug, "drmsrc", 0, "drmsrc element");
+}
+GST_BOILERPLATE_FULL (GstDrmSrc, gst_drm_src, GstBaseSrc, GST_TYPE_BASE_SRC,   _do_init);
+/**
+ * This function does the following:
+ *  1. Sets the class details
+ *  2. Adds the source pad template
+ *
+ * @param   g_class    [out]   gpointer
+ *
+ * @return  void
+ */
+static void gst_drm_src_base_init (gpointer g_class)
+{
+       GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+       // 1. Sets the class details
+       gst_element_class_set_details_simple (gstelement_class,
+               "DRM Source",
+               "Source/File",
+               "Read from arbitrary point in a standard/DRM file",
+               "Kishore Arepalli  <kishore.a@samsung.com> and Sadanand Dodawadakar <sadanand.d@samsung.com>");
+      // 2. Adds the source pad template
+       gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&srctemplate));
+}
+/**
+ * This function does the following:
+ *  1. Installs the properties
+ *  2. Assigns the function pointers GObject class attributes
+ *
+ * @param   klass    [out]   GstDrmSrcClass Structure
+ *
+ * @return  void
+ */
+static void gst_drm_src_class_init (GstDrmSrcClass * klass)
+{
+       GObjectClass *gobject_class;
+       GstBaseSrcClass *gstbasesrc_class;
+       gobject_class = G_OBJECT_CLASS (klass);
+       gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
+       // Assigns the function pointers GObject class attributes
+       gobject_class->set_property = gst_drm_src_set_property;
+       gobject_class->get_property = gst_drm_src_get_property;
+       //  1. Installs the properties
+       g_object_class_install_property (gobject_class, ARG_FD,
+               g_param_spec_int ("fd", "File-descriptor",
+               "File-descriptor for the file being mmap()d", 0, G_MAXINT, 0,
+               G_PARAM_READABLE));
+       g_object_class_install_property (gobject_class, ARG_LOCATION,
+               g_param_spec_string ("location", "File Location",
+               "Location of the file to read", NULL, G_PARAM_READWRITE));
+
+       // 2. Assigns the function pointers GObject class attributes
+       gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_drm_src_finalize);
+       gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_drm_src_start);
+       gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_drm_src_stop);
+       gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_drm_src_is_seekable);
+       gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_drm_src_get_size);
+       gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_drm_src_create);
+
+
+       gst_tag_register (GST_TAG_PLAYREADY, GST_TAG_FLAG_META,
+                       G_TYPE_STRING,
+                       "PlayReady File Path",
+                       "a tag that is specific to PlayReady File",
+                       NULL);
+}
+/**
+ * This function does the following:
+ *  1. Initilizes the parameters of GstDrmSrc
+ *
+ * @param   src    [out]   GstDrmSrc structure
+ * @param   g_class    [in]   GstDrmSrcClass structure
+ *
+ * @return  gboolean   Returns TRUE on success and FALSE on ERROR
+ */
+static void gst_drm_src_init (GstDrmSrc * src, GstDrmSrcClass * g_class)
+{
+       // 1. Initilizes the parameters of GstDrmSrc
+       src->filename = NULL;
+       src->fd = 0;
+       src->uri = NULL;
+       src->is_regular = FALSE;
+       src->seekable = FALSE;
+       PROFILE_INIT;
+}
+/**
+ * This function does the following:
+ *  1. deallocates the filename and uri
+ *  2. calls the parent class->finalize
+ *
+ * @param   object    [in]   GObject Structure
+ *
+ * @return  void
+ */
+static void gst_drm_src_finalize (GObject * object)
+{
+       GstDrmSrc *src;
+
+       src = GST_DRM_SRC (object);
+       //  1. deallocates the filename and uri
+       g_free (src->filename);
+       g_free (src->uri);
+       // 2. calls the parent class->finalize
+       G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+/**
+ * This function does the following:
+ *  1. Checks the state
+ *  2. Checks the filename
+ *  3. Sets the filename
+ *
+ * @param   src    [in]   GstDrmSrc Structure
+ * @param   location    [in]   location of the file
+ *
+ * @return  gboolean   Returns TRUE on success and FALSE on ERROR
+ */
+static gboolean gst_drm_src_set_location (GstDrmSrc * src, const gchar * location)
+{
+       GstState state;
+
+       GST_OBJECT_LOCK (src);
+       //  1. Checks the state
+       state = GST_STATE (src);
+       if (state != GST_STATE_READY && state != GST_STATE_NULL)
+       {
+               GST_DEBUG_OBJECT (src, "setting location in wrong state");
+               GST_OBJECT_UNLOCK (src);
+               return FALSE;
+       }
+       GST_OBJECT_UNLOCK (src);
+       g_free (src->filename);
+       g_free (src->uri);
+       //  2. Checks the filename
+       if (location == NULL)
+       {
+               src->filename = NULL;
+               src->uri = NULL;
+       }
+       else
+       {
+               // 3. Sets the filename
+               src->filename = g_strdup (location);
+               src->uri = gst_uri_construct ("file", src->filename);
+       }
+       g_object_notify (G_OBJECT (src), "location");
+       gst_uri_handler_new_uri (GST_URI_HANDLER (src), src->uri);
+       return TRUE;
+}
+/**
+ * This function does the following:
+ *  1. Sets the location of the file.
+ *
+ * @param   object    [in]   GObject Structure
+ * @param   prop_id    [in]   id of the property
+ * @param   value    [in]   property value
+ * @param   pspec    [in]  GParamSpec Structure
+ *
+ * @return  void
+ */
+static void gst_drm_src_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+       GstDrmSrc *src;
+
+       g_return_if_fail (GST_IS_DRM_SRC (object));
+       src = GST_DRM_SRC (object);
+       switch (prop_id)
+       {
+               //  1. Sets the location of the file.
+               case ARG_LOCATION:
+                       gst_drm_src_set_location (src, g_value_get_string (value));
+                       break;
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                       break;
+       }
+}
+/**
+ * This function does the following:
+ *  1. Provides the location of the file.
+ *  2. Provides the file descriptor.
+ *
+ * @param   object    [in]   GObject Structure
+ * @param   prop_id    [in]   id of the property
+ * @param   value    [out]   property value
+ * @param   pspec    [in]  GParamSpec Structure
+ *
+ * @return  void
+ */
+static void gst_drm_src_get_property (GObject * object, guint prop_id, GValue * value,GParamSpec * pspec)
+{
+       GstDrmSrc *src;
+
+       g_return_if_fail (GST_IS_DRM_SRC (object));
+       src = GST_DRM_SRC (object);
+       switch (prop_id)
+       {
+               //  1. Provides the location of the file.
+               case ARG_LOCATION:
+                       g_value_set_string (value, src->filename);
+                       break;
+               // 2. Provides the file descriptor.
+               case ARG_FD:
+                       g_value_set_int (value, src->fd);
+                       break;
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                       break;
+       }
+}
+
+/**
+ * This function does the following:
+ *  1. Seeks to the specified position.
+ *  2. Allocates a buffer to push the data
+ *  3. Reads from the file and sets the related params
+ *
+ * @param   src    [in]   GstDrmSrc Structure
+ * @param   offset    [in]   offset of the file to seek
+ * @param   length    [in]   size of the data in bytes
+ * @param   buffer    [out]   GstBuffer to hold the contents
+ *
+ * @return  GstFlowReturn   Returns GST_FLOW_OK on success and ERROR on failure
+ */
+static GstFlowReturn gst_drm_src_create_read (GstDrmSrc * src, guint64 offset, guint length, GstBuffer ** buffer)
+{
+       int ret;
+       GstBuffer *buf;
+       // 1. Seeks to the specified position.
+       if (G_UNLIKELY (src->read_position != offset))
+       {
+               off_t res;
+               res = lseek (src->fd, offset, SEEK_SET);
+               if (G_UNLIKELY (res < 0 || res != offset))
+               {
+                       GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+                       return GST_FLOW_ERROR;
+               }
+               src->read_position = offset;
+       }
+       // 2. Allocates a buffer to push the data
+       buf = gst_buffer_new_and_alloc (length);
+       GST_LOG_OBJECT (src, "Reading %d bytes", length);
+       // 3. Reads from the file and sets the related params
+       ret = read (src->fd, GST_BUFFER_DATA (buf), length);
+       if (G_UNLIKELY (ret < 0))
+       {
+               GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+               gst_buffer_unref (buf);
+               return GST_FLOW_ERROR;
+       }
+       if (G_UNLIKELY ((guint) ret < length && src->seekable))
+       {
+               GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),("unexpected end of file."));
+               gst_buffer_unref (buf);
+               return GST_FLOW_ERROR;
+       }
+       if (G_UNLIKELY (ret == 0 && length > 0))
+       {
+               GST_DEBUG ("non-regular file hits EOS");
+               gst_buffer_unref (buf);
+               return GST_FLOW_UNEXPECTED;
+       }
+       length = ret;
+       GST_BUFFER_SIZE (buf) = length;
+       GST_BUFFER_OFFSET (buf) = offset;
+       GST_BUFFER_OFFSET_END (buf) = offset + length;
+       *buffer = buf;
+       src->read_position += length;
+       return GST_FLOW_OK;
+}
+/**
+ * This function does the following:
+ *  1. Calls DRM file read chain method for drm files.
+ *  2. Calls normal file read chain method for standard files.
+ *
+ * @param   basesrc    [in]   BaseSrc Structure
+ * @param   size    [out]   Size of the file
+ *
+ * @return  gboolean   Returns TRUE on success and FALSE on ERROR
+ */
+static GstFlowReturn gst_drm_src_create (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** buffer)
+{
+       GstDrmSrc *src = GST_DRM_SRC (basesrc);
+
+       // 1. Calls DRM file read chain method for drm files.
+
+       // 2. Calls normal file read chain method for standard files.
+       return gst_drm_src_create_read (src, offset, length, buffer);
+}
+/**
+ *
+ * @param   basesrc    [in]   BaseSrc Structure
+ *
+ * @return  gboolean   Returns TRUE if the file is seekable and FALSE if the file is not seekable
+ */
+static gboolean gst_drm_src_is_seekable (GstBaseSrc * basesrc)
+{
+       GstDrmSrc *src = GST_DRM_SRC (basesrc);
+       return src->seekable;
+}
+/**
+ * This function does the following:
+ *  1. Gets the filesize for drm file by using seek oprations
+ *  2. Gets the file size for standard file by using statistics
+ *
+ * @param   basesrc    [in]   BaseSrc Structure
+ * @param   size    [in]   Size of the file
+ *
+ * @return  gboolean   Returns TRUE on success and FALSE on ERROR
+ */
+static gboolean gst_drm_src_get_size (GstBaseSrc * basesrc, guint64 * size)
+{
+       struct stat stat_results;
+       GstDrmSrc *src = GST_DRM_SRC (basesrc);
+       unsigned int offset;
+
+       //  1. Gets the filesize for drm file by using seek oprations
+
+       // 2. Gets the file size for standard file by using statistics
+       if (fstat (src->fd, &stat_results) < 0)
+               return FALSE;
+       *size = stat_results.st_size;
+       return TRUE;
+}
+/**
+ * This function does the following:
+ *  1. Checks the filename
+ *  2. Opens the file and check statistics of the file
+ *  7. Checks the seeking for standard files
+ *
+ * @param   basesrc    [in]   BaseSrc Structure
+ *
+ * @return  gboolean   Returns TRUE on success and FALSE on ERROR
+ */
+static gboolean gst_drm_src_start (GstBaseSrc * basesrc)
+{
+       GstDrmSrc *src = GST_DRM_SRC (basesrc);
+       struct stat stat_results;
+       off_t ret;
+PROFILE_FUNC_BEGIN;
+       // 1. Checks the filename
+       if (src->filename == NULL || src->filename[0] == '\0')
+       {
+               GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,("No file name specified for reading."), (NULL));
+               return FALSE;
+       }
+       // 2. Opens the file and check statistics of the file
+       GST_INFO_OBJECT (src, "opening file %s", src->filename);
+       src->fd = open (src->filename, O_RDONLY | O_BINARY);
+       if (src->fd < 0)
+       {
+               if(errno == ENOENT)
+               {
+                       GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),("No such file \"%s\"", src->filename));
+                       return FALSE;
+               }
+               GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("Could not open file \"%s\" for reading.", src->filename), GST_ERROR_SYSTEM);
+               return FALSE;
+       }
+       if (fstat (src->fd, &stat_results) < 0)
+       {
+               GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("Could not get info on \"%s\".", src->filename), (NULL));
+               close (src->fd);
+               return FALSE;
+       }
+       if (S_ISDIR (stat_results.st_mode))
+       {
+               GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("\"%s\" is a directory.", src->filename), (NULL));
+               close (src->fd);
+               return FALSE;
+       }
+       if (S_ISSOCK (stat_results.st_mode))
+       {
+               GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, ("File \"%s\" is a socket.", src->filename), (NULL));
+               close (src->fd);
+               return FALSE;
+       }
+       src->read_position = 0;
+
+       // 7. Checks the seeking for standard files
+       if (S_ISREG (stat_results.st_mode))
+               src->is_regular = TRUE;
+       ret = lseek (src->fd, 0, SEEK_END);
+       if (ret < 0)
+       {
+               GST_LOG_OBJECT (src, "disabling seeking, not in mmap mode and lseek "
+                       "failed: %s", g_strerror (errno));
+               src->seekable = FALSE;
+       }
+       else
+       {
+               src->seekable = TRUE;
+       }
+       lseek (src->fd, 0, SEEK_SET);
+       src->seekable = src->seekable && src->is_regular;
+       PROFILE_FUNC_END;
+       return TRUE;
+}
+/**
+ * This function does the following:
+ *  1. Closes the file desciptor and resets the flags
+ *
+ * @param   basesrc    [in]   BaseSrc Structure
+ *
+ * @return  gboolean   Returns TRUE on success and FALSE on ERROR
+ */
+static gboolean gst_drm_src_stop (GstBaseSrc * basesrc)
+{
+       GstDrmSrc *src = GST_DRM_SRC (basesrc);
+
+       // 1. Closes the file desciptor and resets the flags
+       if(src->fd > 0)
+               close (src->fd);
+       src->fd = 0;
+       src->is_regular = FALSE;
+//     PROFILE_SHOW_RESULT;
+       return TRUE;
+}
+/**
+ *
+ * @param   void
+ *
+ * @return  GstURIType   Returns GST_URI_SRC
+ */
+
+static GstURIType gst_drm_src_uri_get_type (void)
+{
+       return GST_URI_SRC;
+}
+
+/**
+ * This function does the following:
+ *  1. Defines the list of protocols
+ *
+ * @param   void
+ *
+ * @return  gchar **   Returns the protocol list
+ */
+
+static gchar ** gst_drm_src_uri_get_protocols (void)
+{
+       static gchar *protocols[] = { "file", NULL };
+       return protocols;
+}
+/**
+ *
+ * @param   handler [in] GstURIHandler structure
+ *
+ * @return  gchar*   Returns the uri
+ */
+static const gchar * gst_drm_src_uri_get_uri (GstURIHandler *handler)
+{
+       GstDrmSrc *src = GST_DRM_SRC (handler);
+       return src->uri;
+}
+/**
+ * This function does the following:
+ *  1. Checks the protocol
+ *  2. Checks the whether it is absolute or not
+ *  3 sets the location
+ *
+ * @param   handler [in] GstURIHandler structure
+ * @param   uri [in] uri string
+ *
+ * @return  gboolean   Returns TRUE on success and FALSE on Error
+ */
+static gboolean gst_drm_src_uri_set_uri (GstURIHandler *handler, const gchar * uri)
+{
+       gchar *protocol, *location;
+       gboolean ret;
+       GstDrmSrc *src = GST_DRM_SRC (handler);
+       // 1. Checks the protocol
+       protocol = gst_uri_get_protocol (uri);
+       if (strcmp (protocol, "file") != 0)
+       {
+               g_free (protocol);
+               return FALSE;
+       }
+       g_free (protocol);
+       if (g_str_has_prefix (uri, "file://localhost/"))
+       {
+               char *tmp;
+               tmp = g_strconcat ("file://", uri + 16, NULL);
+               location = gst_uri_get_location (tmp);
+               g_free (tmp);
+       }
+       else if (strcmp (uri, "file://") == 0)
+       {
+               gst_drm_src_set_location (src, NULL);
+               return TRUE;
+       }
+       else
+       {
+               location = gst_uri_get_location (uri);
+       }
+       if (!location)
+               return FALSE;
+       // 2. Checks the whether it is absolute or not
+       if (!g_path_is_absolute (location))
+       {
+               g_free (location);
+               return FALSE;
+       }
+       // 3 sets the location
+       ret = gst_drm_src_set_location (src, location);
+       g_free (location);
+       return ret;
+}
+/**
+ * This function does the following:
+ *  1. Assignes the function pointer for URI related stuff
+ *
+ * @param   g_iface [in] an interface to URI handler
+ * @param   iface_data [in] a gpointer
+ *
+ * @return  void
+ */
+static void gst_drm_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
+{
+       GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
+       // 1. Assigning the function pointer for URI related stuff
+       iface->get_type = gst_drm_src_uri_get_type;
+       iface->get_protocols = gst_drm_src_uri_get_protocols;
+       iface->get_uri = gst_drm_src_uri_get_uri;
+       iface->set_uri = gst_drm_src_uri_set_uri;
+}
+/**
+ * This function does the following:
+ *  1. Registers an element as drmsrc
+ *
+ * @param   i_pPlugin [in] a plug-in structure
+ *
+ * @return  gboolean TRUE on SUCCESS and FALSE on Error
+ */
+static gboolean plugin_init(GstPlugin* i_pPlugin)
+{
+       return gst_element_register(i_pPlugin, "drmsrc", GST_RANK_NONE, GST_TYPE_DRM_SRC);;
+}
+/**
+ * This function does the following:
+ *  1. plugin defination
+ *
+ */
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+                                                GST_VERSION_MINOR,
+                                                "drmsrc",
+                                                "Plugin to read data from standad/DRM File",
+                                                plugin_init,
+                                                VERSION,
+                                                "LGPL",
+                                                "Samsung Electronics Co",
+                                                "http://www.samsung.com/")
+
diff --git a/drmsrc/src/gstdrmsrc.h b/drmsrc/src/gstdrmsrc.h
new file mode 100755 (executable)
index 0000000..e47802e
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * drmsrc
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+
+#ifndef __GST_DRM_SRC_H__
+#define __GST_DRM_SRC_H__
+
+#include <sys/types.h>
+#include <gst/gst.h>
+#include <gst/base/gstbasesrc.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#ifndef S_ISREG
+#define S_ISREG(mode) ((mode)&_S_IFREG)
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(mode) ((mode)&_S_IFDIR)
+#endif
+#ifndef S_ISSOCK
+#define S_ISSOCK(x) (0)
+#endif
+#ifndef O_BINARY
+#define O_BINARY (0)
+#endif
+
+#define ENABLE_PROFILING_INFO
+#ifdef ENABLE_PROFILING_INFO
+#define   PROFILE_FUNC_BEGIN\
+       char *newname; \
+       newname=__FUNCTION__; \ 
+       gst_ta_accum_item_begin(newname,FALSE,__FILE__,__LINE__);       
+       
+#define PROFILE_FUNC_END  \    
+       gst_ta_accum_item_end(newname,FALSE,__FILE__,__LINE__);
+
+#define PROFILE_BLOCK_BEGIN(name)              gst_ta_accum_item_begin(name,FALSE,__FILE__,__LINE__);
+#define PROFILE_BLOCK_END(name)                gst_ta_accum_item_end(name,FALSE,__FILE__,__LINE__);
+#define PROFILE_INIT                                           gst_ta_init();
+#define PROFILE_SHOW_RESULT                    gst_ta_accum_show_result(0);//MMTA_SHOW_FILE);  
+#define PROFILE_CLEAR_DATA                             gst_ta_release();
+#else
+#define PROFILE_FUNC_BEGIN
+#define PROFILE_FUNC_END
+#define PROFILE_BLOCK_BEGIN(name)
+#define PROFILE_BLOCK_END(name)
+#define PROFILE_INIT
+#define PROFILE_SHOW_RESULT
+#define PROFILE_CLEAR_DATA 
+#endif
+G_BEGIN_DECLS
+
+#define GST_TYPE_DRM_SRC (gst_drm_src_get_type())
+#define GST_DRM_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DRM_SRC,GstDrmSrc))
+#define GST_DRM_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DRM_SRC,GstDrmSrcClass))
+#define GST_IS_DRM_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DRM_SRC))
+#define GST_IS_DRM_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DRM_SRC))
+
+typedef struct _GstDrmSrc GstDrmSrc;
+typedef struct _GstDrmSrcClass GstDrmSrcClass;
+
+struct _GstDrmSrc 
+{
+       GstBaseSrc element;
+       gchar *filename;                        
+       gchar *uri;                              
+       gint fd;                                 
+       guint64 read_position;  
+      gboolean seekable;      
+       gboolean is_regular;    
+};
+
+struct _GstDrmSrcClass 
+{
+       GstBaseSrcClass parent_class;
+};
+
+GType gst_drm_src_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_DRM_SRC_H__ */
diff --git a/encodebin/Makefile.am b/encodebin/Makefile.am
new file mode 100644 (file)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/encodebin/src/Makefile.am b/encodebin/src/Makefile.am
new file mode 100644 (file)
index 0000000..c855890
--- /dev/null
@@ -0,0 +1,30 @@
+glib_enum_define=GST_RECORD
+glib_enum_prefix=gst_record
+
+plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
+
+plugin_LTLIBRARIES = libgstencodebin.la 
+libgstencodebin_la_SOURCES = gstencodebin.c
+nodist_libgstencodebin_la_SOURCES = $(built_sources)
+libgstencodebin_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
+libgstencodebin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstencodebin_la_LIBADD = \
+       $(GST_LIBS)\
+        $(GST_BASE_LIBS) \
+        $(GST_LIBS)
+if ISPROTECTOR_TARGET
+libgstencodebin_la_CFLAGS += -DUSE_ENCODER_QUEUE_SET 
+libgstencodebin_la_CFLAGS += -DVIDEO_ENC_QUE_TIME=4 -DAUDIO_ENC_QUE_TIME=4
+endif
+
+if ISVOLANS_TARGET
+libgstencodebin_la_CFLAGS += -DUSE_ENCODER_QUEUE_SET 
+libgstencodebin_la_CFLAGS += -DVIDEO_ENC_QUE_TIME=4 -DAUDIO_ENC_QUE_TIME=4
+endif
+
+BUILT_SOURCES = $(built_headers) $(built_sources)
+
+CLEANFILES = $(BUILT_SOURCES)
+
+include $(top_srcdir)/common/glib-gen.mak
+
diff --git a/encodebin/src/gstencodebin.c b/encodebin/src/gstencodebin.c
new file mode 100644 (file)
index 0000000..9539702
--- /dev/null
@@ -0,0 +1,3278 @@
+/*
+ * GStreamer encodebin
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include <gst/gst.h>
+#include <gst/video/video.h>
+
+#include "gstencodebin.h"
+
+#ifdef GST_EXT_PAD_LINK_UNCHECKED
+#define _GST_ELEMENT_LINK_MANY                 gst_element_link_many_unchecked
+#define _GST_ELEMENT_LINK                      gst_element_link_unchecked
+#define _GST_PAD_LINK                          gst_pad_link_unchecked
+#else
+#define _GST_ELEMENT_LINK_MANY                 gst_element_link_many
+#define _GST_ELEMENT_LINK                      gst_element_link
+#define _GST_PAD_LINK                          gst_pad_link
+#endif
+
+#ifndef VIDEO_ENC_QUE_TIME
+#define VIDEO_ENC_QUE_TIME             1
+#endif
+#ifndef AUDIO_ENC_QUE_TIME
+#define AUDIO_ENC_QUE_TIME     1
+#endif
+
+//define USE_ENCODER_QUEUE_SET
+#ifdef USE_ENCODER_QUEUE_SET
+#define ENCODER_QUEUE_SET(x_queue, x_byte, x_buffer, x_time /*sec*/) \
+{\
+g_object_set(G_OBJECT(x_queue), \
+                       "max-size-bytes", (guint)x_byte, \
+                       "max-size-buffers", (guint)x_buffer, \  
+                       "max-size-time", (guint64)(x_time*GST_SECOND), \
+                       NULL); \
+                       GST_INFO("Set to [%s], max [%d] byte, max [%d] buffer, max [%d] time(sec) ", GST_OBJECT_NAME(x_queue), x_byte, x_buffer, x_time);\
+}
+#else
+#define ENCODER_QUEUE_SET(x_queue, x_byte, x_buffer, x_time) 
+#endif
+
+#define _GST_PAD_LINK_UNREF( srcpad, sinkpad, if_fail_goto )\
+{\
+      GstPadLinkReturn ret = _GST_PAD_LINK( srcpad, sinkpad );\
+      gst_object_unref( srcpad ); srcpad = NULL;\
+      gst_object_unref( sinkpad ); sinkpad = NULL;\
+      if( ret != GST_PAD_LINK_OK) goto if_fail_goto;\
+}
+
+#define _GST_PAD_UNLINK_UNREF( srcpad, sinkpad)\
+{\
+      gst_pad_unlink( srcpad, sinkpad );\
+      gst_object_unref( srcpad ); srcpad = NULL;\
+      gst_object_unref( sinkpad ); sinkpad = NULL;\
+}
+
+#define DEFAULT_PROP_PROFILE             0
+#define DEFAULT_PROP_HIGH_SPEED                0
+#define DEFAULT_PROP_VENC_NAME "ffenc_h263"
+#define DEFAULT_PROP_AENC_NAME "secenc_amr"
+#define DEFAULT_PROP_IENC_NAME "jpegenc"
+#define DEFAULT_PROP_MUX_NAME  "ffmux_3gp" 
+
+/* props */
+enum
+{
+       PROP_0,
+       // encodebin mode :  a/v, audio only, stillshot
+       PROP_PROFILE,
+       //support slow motion capture
+       PROP_HIGH_SPEED,
+       //elements name
+       PROP_VENC_NAME,
+       PROP_AENC_NAME,
+       PROP_IENC_NAME, 
+       PROP_MUX_NAME, 
+       //caps
+       PROP_VCAPS,
+       PROP_ACAPS,
+       PROP_ICAPS,
+       //functions
+       PROP_AUTO_AUDIO_CONVERT,
+       PROP_AUTO_AUDIO_RESAMPLE,
+       PROP_AUTO_COLORSPACE,
+       PROP_BLOCK,
+       PROP_PAUSE,
+       PROP_VENC_QUEUE,        
+       PROP_AENC_QUEUE,
+       //elements pointer
+       PROP_VIDEO_ENC,
+       PROP_AUDIO_ENC,
+       PROP_IMAGE_ENC,
+       PROP_MUX,
+       //options
+       PROP_USE_VIDEO_TOGGLE,
+};
+
+#ifdef GST_ENCODE_BIN_SIGNAL_ENABLE
+/* signals */
+enum
+{
+  SIGNAL_STREAM_BLOCK,
+  SIGNAL_STREAM_UNBLOCK,       
+  SIGNAL_STREAM_PAUSE,
+  SIGNAL_STREAM_RESUME,  
+  LAST_SIGNAL
+};
+#endif
+
+typedef enum {
+       ENCODEBIN_ELEMENT_VENC,
+       ENCODEBIN_ELEMENT_AENC,
+       ENCODEBIN_ELEMENT_IENC,
+       ENCODEBIN_ELEMENT_MUX
+}GstEncodeBinElement;
+
+typedef enum {
+       ENCODEBIN_MUX_AUDIO_SINK,
+       ENCODEBIN_MUX_VIDEO_SINK,
+}GstEncodeBinMuxSinkPad;
+
+
+/* FIX ME */
+
+#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
+# define ENDIANNESS   "LITTLE_ENDIAN, BIG_ENDIAN"
+#else
+# define ENDIANNESS   "BIG_ENDIAN, LITTLE_ENDIAN"
+#endif
+
+/* generic templates */
+#define STATIC_AUDIO_CAPS \
+GST_STATIC_CAPS ( \
+  "audio/x-raw-float, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, 8 ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 64;" \
+  "audio/x-raw-float, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, 8 ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 32;" \
+  "audio/x-raw-int, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, 8 ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 32, " \
+    "depth = (int) [ 1, 32 ], " \
+    "signed = (boolean) { true, false }; " \
+  "audio/x-raw-int, "   \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, 8 ], "       \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, "        \
+    "width = (int) 24, "        \
+    "depth = (int) [ 1, 24 ], " "signed = (boolean) { true, false }; "  \
+  "audio/x-raw-int, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, 8 ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 16, " \
+    "depth = (int) [ 1, 16 ], " \
+    "signed = (boolean) { true, false }; " \
+  "audio/x-raw-int, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, 8 ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 8, " \
+    "depth = (int) [ 1, 8 ], " \
+    "signed = (boolean) { true, false } " \
+)
+
+#define STATIC_VIDEO_CAPS \
+GST_STATIC_CAPS ( \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) I420;" \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) YV12;" \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) YUY2;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 24," \
+    "depth = (int) 24," \
+    "red_mask = (int) 16711680," \
+    "green_mask = (int) 65280," \
+    "blue_mask = (int) 255," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 24," \
+    "depth = (int) 24," \
+    "red_mask = (int) 255," \
+    "green_mask = (int) 65280," \
+    "blue_mask = (int) 16711680," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) Y42B;" \
+    "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) Y444;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 32," \
+    "depth = (int) 32," \
+    "red_mask = (int) 65280," \
+    "green_mask = (int) 16711680," \
+    "blue_mask = (int) -16777216," \
+    "alpha_mask = (int) 255," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 32," \
+    "depth = (int) 32," \
+    "red_mask = (int) 16711680," \
+    "green_mask = (int) 65280," \
+    "blue_mask = (int) 255," \
+    "alpha_mask = (int) -16777216," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 32," \
+    "depth = (int) 32," \
+    "red_mask = (int) 255," \
+    "green_mask = (int) 65280," \
+    "blue_mask = (int) 16711680," \
+    "alpha_mask = (int) -16777216," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 32," \
+    "depth = (int) 32," \
+    "red_mask = (int) -16777216," \
+    "green_mask = (int) 16711680," \
+    "blue_mask = (int) 65280," \
+    "alpha_mask = (int) 255," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 32," \
+    "depth = (int) 24," \
+    "red_mask = (int) 65280," \
+    "green_mask = (int) 16711680," \
+    "blue_mask = (int) -16777216," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 32," \
+    "depth = (int) 24," \
+    "red_mask = (int) 255," \
+    "green_mask = (int) 65280," \
+    "blue_mask = (int) 16711680," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 32," \
+    "depth = (int) 24," \
+    "red_mask = (int) 16711680," \
+    "green_mask = (int) 65280," \
+    "blue_mask = (int) 255," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 32," \
+    "depth = (int) 24," \
+    "red_mask = (int) -16777216," \
+    "green_mask = (int) 16711680," \
+    "blue_mask = (int) 65280," \
+    "endianness = (int) 4321;" \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) YUV9;" \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) YVU9;" \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) Y41B;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 16," \
+    "depth = (int) 16," \
+    "red_mask = (int) 63488," \
+    "green_mask = (int) 2016," \
+    "blue_mask = (int) 31," \
+    "endianness = (int) 1234;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 16," \
+    "depth = (int) 15," \
+    "red_mask = (int) 31744," \
+    "green_mask = (int) 992," \
+    "blue_mask = (int) 31," \
+    "endianness = (int) 1234;" \
+  "video/x-raw-gray," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 8," \
+    "depth = (int) 8;" \
+  "video/x-raw-rgb," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "bpp = (int) 8," \
+    "depth = (int) 8," \
+    "endianness = (int) 1234;" \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) UYVY;" \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) IYU1;" \
+  "video/x-raw-yuv," \
+    "width = (int) [ 1, 2147483647 ]," \
+    "height = (int) [ 1, 2147483647 ]," \
+    "framerate = (fraction) [ 0/1, 2147483647/1 ]," \
+    "format = (fourcc) AYUV " \
+)      
+
+
+static GstStaticPadTemplate encoder_bin_src_template =
+GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate encoder_bin_video_sink_template =
+GST_STATIC_PAD_TEMPLATE ("video",
+    GST_PAD_SINK,
+    GST_PAD_REQUEST,
+    STATIC_VIDEO_CAPS
+    );
+
+static GstStaticPadTemplate encoder_bin_audio_sink_template =
+GST_STATIC_PAD_TEMPLATE ("audio",
+    GST_PAD_SINK,
+    GST_PAD_REQUEST,
+    STATIC_AUDIO_CAPS
+    );
+
+static GstStaticPadTemplate encoder_bin_image_sink_template =
+GST_STATIC_PAD_TEMPLATE ("image",
+    GST_PAD_SINK,
+    GST_PAD_REQUEST,
+    GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+    );
+
+GST_DEBUG_CATEGORY_STATIC (gst_encode_bin_debug);
+#define GST_CAT_DEFAULT gst_encode_bin_debug
+
+static void gst_encode_bin_class_init (GstEncodeBinClass *klass);
+static void gst_encode_bin_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
+static void gst_encode_bin_set_property (GObject * object,  guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_encode_bin_init (GstEncodeBin * encodebin);
+static void gst_encode_bin_dispose (GObject * object);
+static void gst_encode_bin_finalize (GObject * object);
+static GstPad *gst_encode_bin_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name);
+
+static GstStateChangeReturn gst_encode_bin_change_state (GstElement * element, GstStateChange transition);
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+static void gst_encode_bin_release_pad (GstElement * element, GstPad * pad);
+static gint pad_compare_name (GstPad * pad1, const gchar * name);
+static gboolean gst_encode_bin_add_element_by_name (GstEncodeBin *encodebin, GstEncodeBinElement type, const gchar *name);
+#if 0 //disable unused function
+static gboolean gst_encode_bin_change_profile(GstEncodeBin *encodebin, gboolean profile);
+static void gst_encode_bin_replace_element (GstEncodeBin *encodebin, gint type, GstElement * newelement);
+static gboolean gst_encode_bin_replace_element_by_name(GstEncodeBin *encodebin, GstEncodeBinElement type, const gchar *name);
+static gboolean gst_encode_bin_replace_element_by_object(GstEncodeBin *encodebin, GstEncodeBinElement type, GstElement * element);
+#endif //disable unused function
+static gboolean gst_encode_bin_remove_element (GstEncodeBin *encodebin, GstElement * element);
+static gboolean gst_encode_bin_link_elements (GstEncodeBin *encodebin);
+static gboolean gst_encode_bin_unlink_elements (GstEncodeBin *encodebin);
+static gboolean gst_encode_bin_init_video_elements (GstElement *element, gpointer user_data);
+static gboolean gst_encode_bin_init_audio_elements (GstElement *element, gpointer user_data);
+static gboolean gst_encode_bin_init_image_elements (GstElement *element, gpointer user_data);
+static gboolean gst_encode_bin_block(GstEncodeBin *encodebin, gboolean value);
+static gboolean gst_encode_bin_pause(GstEncodeBin *encodebin, gboolean value);
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+static gboolean gst_encode_bin_release_pipeline (GstElement *element, gpointer user_data);
+static gboolean gst_encode_bin_audsink_set_caps (GstPad * pad, GstCaps * vscaps);
+static gboolean gst_encode_bin_vidsink_set_caps (GstPad * pad, GstCaps * vscaps);
+static gboolean gst_encode_bin_imgsink_set_caps (GstPad * pad, GstCaps * vscaps);
+static GstPad* gst_encode_bin_get_mux_sink_pad(GstElement *mux, GstEncodeBinMuxSinkPad type);
+
+//Data probe
+static gboolean gst_encode_bin_video_probe(GstPad *pad, GstBuffer *buffer, GstEncodeBin *encodebin);
+static gboolean gst_encode_bin_audio_probe(GstPad *pad, GstBuffer *buffer, GstEncodeBin *encodebin);
+static gboolean gst_encode_bin_video_probe_hs(GstPad *pad, GstBuffer *buffer, GstEncodeBin *encodebin);
+
+static GstElementClass *parent_class;
+
+#ifdef GST_ENCODE_BIN_SIGNAL_ENABLE
+static guint gst_encode_bin_signals[LAST_SIGNAL] = { 0 };
+#endif
+
+static const GstElementDetails gst_encode_bin_details =
+GST_ELEMENT_DETAILS ("Samsung Electronics Co. Encoder Bin",
+       "Generic/Bin/Encoder",
+       "Autoplug and encode to muxed media",
+       "Jeonghoon Park <jh1979.park@samsung.com>, Wonhyung Cho <wh01.cho@samsung.com>, Sangho Park <sangho.g.park@samsung.com>");
+
+typedef enum {
+       GST_ENCODE_BIN_PROFILE_AV,
+       GST_ENCODE_BIN_PROFILE_AUDIO,
+       GST_ENCODE_BIN_PROFILE_IMAGE,
+} GstEncodeBinProfile;
+
+GType
+gst_encode_bin_profile_get_type (void)
+{
+       static GType encode_bin_profile_type = 0;
+       static const GEnumValue profile_types[] = {
+               {GST_ENCODE_BIN_PROFILE_AV, "Audio and Video Recording", "A/V"},
+               {GST_ENCODE_BIN_PROFILE_AUDIO, "Audio Only Recording", "Audio"},
+               {GST_ENCODE_BIN_PROFILE_IMAGE, "Image Stillshot", "Image"},
+               {0, NULL, NULL}
+       };
+
+       if (!encode_bin_profile_type) {
+               encode_bin_profile_type =
+               g_enum_register_static ("GstEncodeBinProfile",profile_types);
+       }
+       return encode_bin_profile_type;
+}
+
+GType
+gst_encode_bin_get_type (void)
+{
+       static GType gst_encode_bin_type = 0;
+
+       if (!gst_encode_bin_type) {
+               static const GTypeInfo gst_encode_bin_info = {
+                       sizeof (GstEncodeBinClass),
+                       NULL,
+                       NULL,
+                       (GClassInitFunc) gst_encode_bin_class_init,
+                       NULL,
+                       NULL,
+                       sizeof (GstEncodeBin),
+                       0,
+                       (GInstanceInitFunc) gst_encode_bin_init,
+                       NULL
+       };
+
+       gst_encode_bin_type =
+               g_type_register_static (GST_TYPE_BIN, "GstEncodeBin",
+               &gst_encode_bin_info, 0);
+  }
+
+       return gst_encode_bin_type;
+}
+
+static void
+queue_overun_cb (GstElement * queue, GstEncodeBin *encodebin)
+{
+#if 0
+       guint queue_size = 0;
+       guint queue_bufnum = 0;
+//     guint64 queue_time= (guint64)0;
+
+       GstClockTime now = gst_util_get_timestamp ();
+
+       g_object_get(G_OBJECT(queue), "current-level-bytes", &queue_size, 
+                                                               "current-level-buffers", &queue_bufnum,
+       //                                                      "current-level-time", &queue_time,
+                                                               NULL);
+       GST_ELEMENT_WARNING (encodebin, STREAM, TOO_LAZY,
+           ("[%" GST_TIME_FORMAT "][%s], [%u b], [%u]", 
+           GST_TIME_ARGS(now), GST_OBJECT_NAME(queue), queue_size, queue_bufnum), (NULL)); 
+#else
+       GST_ELEMENT_WARNING (encodebin, STREAM, TOO_LAZY,
+           ("%s overrun", GST_OBJECT_NAME(queue)), (NULL)); 
+#endif
+}
+
+static void
+gst_encode_bin_get_property (GObject * object,
+    guint prop_id, GValue * value, GParamSpec * pspec)
+{
+       GstEncodeBin *encodebin;
+
+       encodebin = GST_ENCODE_BIN (object);
+
+       switch (prop_id) {
+               case PROP_PROFILE:
+                       g_value_set_enum (value, encodebin->profile);
+                       break;
+               case PROP_HIGH_SPEED:
+                       g_value_set_int (value, encodebin->high_speed_fps);
+                       break;
+               //elements name
+               case PROP_VENC_NAME:
+                       g_value_set_string (value, encodebin->venc_name);
+                       break;
+               case PROP_AENC_NAME:
+                       g_value_set_string (value, encodebin->aenc_name);
+                       break;
+               case PROP_IENC_NAME:
+                       g_value_set_string (value, encodebin->ienc_name);
+                       break; 
+               case PROP_MUX_NAME:
+                       g_value_set_string (value, encodebin->mux_name);
+                       break; 
+               //caps
+               case PROP_VCAPS:
+                       gst_value_set_caps (value, encodebin->vcaps);
+                       break;
+               case PROP_ACAPS:
+                       gst_value_set_caps (value, encodebin->acaps);
+                       break;
+               case PROP_ICAPS:
+                       gst_value_set_caps (value, encodebin->icaps);
+                       break;
+               //functions
+               case PROP_AUTO_AUDIO_CONVERT:
+                       g_value_set_boolean (value, encodebin->auto_audio_convert);
+                       break;
+               case PROP_AUTO_AUDIO_RESAMPLE:
+                       g_value_set_boolean (value, encodebin->auto_audio_resample);
+                       break;
+               case PROP_AUTO_COLORSPACE:
+                       g_value_set_boolean (value, encodebin->auto_color_space);
+                       break;
+               case PROP_BLOCK:
+                       g_value_set_boolean (value, encodebin->block);
+                       break;
+               case PROP_PAUSE:
+                       g_value_set_boolean (value, encodebin->pause);
+                       break;
+               case PROP_VENC_QUEUE:
+//                     g_value_set_boolean (value, encodebin->use_venc_queue);
+                       if((encodebin->video_encode_queue == NULL) && (encodebin->profile == GST_ENCODE_BIN_PROFILE_AV)) {
+                               encodebin->video_encode_queue = gst_element_factory_make ("queue", "video_encode_queue");
+                               if(encodebin->video_encode_queue != NULL) 
+                                       gst_bin_add(GST_BIN(encodebin), encodebin->video_encode_queue);
+                       }
+                       g_value_set_object (value, encodebin->video_encode_queue);              
+                       break;          
+               case PROP_AENC_QUEUE:
+//                     g_value_set_boolean (value, encodebin->use_aenc_queue);
+                       if((encodebin->audio_encode_queue == NULL) && (encodebin->profile <= GST_ENCODE_BIN_PROFILE_AUDIO)) {
+                               encodebin->audio_encode_queue = gst_element_factory_make ("queue", "audio_encode_queue");
+                               if(encodebin->audio_encode_queue != NULL) 
+                                       gst_bin_add(GST_BIN(encodebin), encodebin->audio_encode_queue);
+                       }
+                       g_value_set_object (value, encodebin->audio_encode_queue);                                      
+                       break;                                          
+               //elements pointer
+               case PROP_VIDEO_ENC:
+                       if((encodebin->video_encode == NULL) && (encodebin->profile == GST_ENCODE_BIN_PROFILE_AV)) {
+                               encodebin->video_encode = gst_element_factory_make (encodebin->venc_name, "video_encode");
+                               if(encodebin->video_encode != NULL) 
+                                       gst_bin_add(GST_BIN(encodebin), encodebin->video_encode);
+                       }
+                       g_value_set_object (value, encodebin->video_encode);
+                       break;
+               case PROP_AUDIO_ENC:
+                       if(encodebin->audio_encode == NULL && (encodebin->profile <= GST_ENCODE_BIN_PROFILE_AUDIO)) {
+                               encodebin->audio_encode = gst_element_factory_make (encodebin->aenc_name, "audio_encode");
+                               if(encodebin->audio_encode != NULL) 
+                                       gst_bin_add(GST_BIN(encodebin), encodebin->audio_encode);
+                       }
+                       g_value_set_object (value, encodebin->audio_encode);
+                       break;
+               case PROP_IMAGE_ENC:
+                       if(encodebin->image_encode == NULL && (encodebin->profile == GST_ENCODE_BIN_PROFILE_IMAGE)) {
+                               encodebin->image_encode = gst_element_factory_make (encodebin->ienc_name, "image_encode");
+                               if(encodebin->image_encode != NULL) 
+                                       gst_bin_add(GST_BIN(encodebin), encodebin->image_encode);
+                       }
+                       g_value_set_object (value, encodebin->image_encode);
+                       break;  
+               case PROP_MUX:
+                       if(encodebin->mux == NULL && (encodebin->profile <= GST_ENCODE_BIN_PROFILE_AUDIO)) {
+                               encodebin->mux = gst_element_factory_make (encodebin->mux_name, "mux");
+                               if(encodebin->mux != NULL) 
+                                       gst_bin_add(GST_BIN(encodebin), encodebin->mux);
+                       }
+                       g_value_set_object (value, encodebin->mux);
+                       break;
+               case PROP_USE_VIDEO_TOGGLE:
+                       g_value_set_boolean( value, encodebin->use_video_toggle );
+                       break;
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                       break;
+       }
+}
+
+static void
+gst_encode_bin_set_property (GObject * object,
+    guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+       GstEncodeBin *encodebin;
+
+       encodebin = GST_ENCODE_BIN (object);
+
+       switch (prop_id) {
+               case PROP_PROFILE:
+                       encodebin->profile = g_value_get_enum (value);
+                       /*
+                       gboolean newprofile = g_value_get_enum (value);
+                       if(encodebin->profile != newprofile) {
+                         gst_encode_bin_change_profile(encodebin, newprofile);
+                       encodebin->profile = newprofile;
+                               }      
+                       */
+                       break;
+               case PROP_HIGH_SPEED:
+                       encodebin->high_speed_fps = g_value_get_int (value);
+                       break;
+               case PROP_VENC_NAME: {
+                       const gchar  *new_name;
+                       if(encodebin->profile > GST_ENCODE_BIN_PROFILE_AV) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match, change profile first!");
+                               break;
+                       }
+                       new_name = g_value_get_string (value);
+
+                       if(encodebin->video_encode == NULL) {
+                               if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_VENC, new_name))             
+                                       encodebin->venc_name = g_strdup (new_name);
+                       } else {
+                               if(strcmp (encodebin->venc_name, new_name)) {
+                                       gst_encode_bin_remove_element(encodebin, encodebin->video_encode);
+                                       if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_VENC, new_name))             
+                                       encodebin->venc_name = g_strdup (new_name);
+                               }
+                       }
+                       break;
+               }  
+               case PROP_AENC_NAME: {
+                       const gchar  *new_name;
+                       if(encodebin->profile > GST_ENCODE_BIN_PROFILE_AUDIO) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match, change profile first!");
+                               break;
+                       }
+                       new_name = g_value_get_string (value);
+
+                       if(encodebin->audio_encode == NULL) {
+                               if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_AENC, new_name))             
+                                       encodebin->aenc_name = g_strdup (new_name);
+                       } else {
+                               if(strcmp (encodebin->aenc_name, new_name)) {
+                                       gst_encode_bin_remove_element(encodebin, encodebin->audio_encode);
+                                       if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_AENC, new_name))             
+                                       encodebin->aenc_name = g_strdup (new_name);
+                               }
+                       }
+                       break;
+               }
+               case PROP_IENC_NAME: {
+                       const gchar  *new_name;
+                       if(encodebin->profile < GST_ENCODE_BIN_PROFILE_IMAGE) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match, change profile first!");
+                               break;
+                       }
+                       new_name = g_value_get_string (value);
+
+                       if(encodebin->image_encode == NULL) {
+                               if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_IENC, new_name))             
+                                       encodebin->ienc_name = g_strdup (new_name);
+                       } else {
+                               if(strcmp (encodebin->ienc_name, new_name)) {
+                                       gst_encode_bin_remove_element(encodebin, encodebin->image_encode);
+                                       if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_IENC, new_name))             
+                                       encodebin->ienc_name = g_strdup (new_name);
+                               }
+                       }
+                       break; 
+               }
+               case PROP_MUX_NAME: {
+                       const gchar  *new_name;
+                       if(encodebin->profile > GST_ENCODE_BIN_PROFILE_AUDIO) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match");
+                               break;
+                       }
+                       new_name = g_value_get_string (value);
+
+                       if(encodebin->mux == NULL) {
+                               if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_MUX, new_name))              
+                                       encodebin->mux_name = g_strdup (new_name);
+                       } else {
+                               if(strcmp (encodebin->mux_name, new_name)) {
+                                       gst_encode_bin_remove_element(encodebin, encodebin->mux);
+                                       if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_MUX, new_name))              
+                                       encodebin->mux_name = g_strdup (new_name);
+                               }
+                       }
+                       break; 
+               }
+               //caps
+               case PROP_VCAPS: {
+                       GstCaps *new_caps;
+                       GstCaps *old_caps;
+                       const GstCaps *new_caps_val = gst_value_get_caps (value);
+
+                       if (new_caps_val == NULL) {
+                               new_caps = gst_caps_new_any ();
+                       } else {
+                               new_caps = (GstCaps *) new_caps_val;
+                               gst_caps_ref (new_caps);
+                       }
+
+                       old_caps = encodebin->vcaps;
+                       encodebin->vcaps = new_caps;
+                       gst_caps_unref (old_caps);
+                       break;
+               }
+               case PROP_ACAPS: {
+                       GstCaps *new_caps;
+                       GstCaps *old_caps;
+                       const GstCaps *new_caps_val = gst_value_get_caps (value);
+
+                       if (new_caps_val == NULL) {
+                               new_caps = gst_caps_new_any ();
+                       } else {
+                               new_caps = (GstCaps *) new_caps_val;
+                               gst_caps_ref (new_caps);
+                       }
+
+                       old_caps = encodebin->acaps;
+                       encodebin->acaps = new_caps;
+                       gst_caps_unref (old_caps);
+                       break;
+               }
+               case PROP_ICAPS: {
+                       GstCaps *new_caps;
+                       GstCaps *old_caps;
+                       const GstCaps *new_caps_val = gst_value_get_caps (value);
+
+                       if (new_caps_val == NULL) {
+                               new_caps = gst_caps_new_any ();
+                       } else {
+                               new_caps = (GstCaps *) new_caps_val;
+                               gst_caps_ref (new_caps);
+                       }
+
+                       old_caps = encodebin->icaps;
+                       encodebin->icaps = new_caps;
+                       gst_caps_unref (old_caps);
+                       break;
+               }
+               //functions
+               case PROP_AUTO_AUDIO_CONVERT:
+                  encodebin->auto_audio_convert = g_value_get_boolean (value);
+                 break;
+               case PROP_AUTO_AUDIO_RESAMPLE:
+                 encodebin->auto_audio_resample = g_value_get_boolean (value);
+                 break;
+               case PROP_AUTO_COLORSPACE:
+                 encodebin->auto_color_space = g_value_get_boolean (value);
+                 break;
+               case PROP_BLOCK: {
+                       gboolean newval = g_value_get_boolean (value);
+                       if(encodebin->block != newval) {
+                               if(!gst_encode_bin_block(encodebin, newval)) {
+#ifdef GST_ENCODE_BIN_SIGNAL_ENABLE            
+                                       if(newval) {
+                                               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_BLOCK], 0, FALSE);
+                                       } else {
+                                               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_UNBLOCK], 0, FALSE);
+                                       }
+#endif                                 
+                                       break;
+                               }                               
+                       }
+#ifdef GST_ENCODE_BIN_SIGNAL_ENABLE            
+                       if(newval) {
+                               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_BLOCK], 0, TRUE);
+                       } else {
+                               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_UNBLOCK], 0, TRUE);
+                       }
+#endif                 
+                       break;
+               }
+               case PROP_PAUSE: {
+                       gboolean newval = g_value_get_boolean (value);
+                       if(encodebin->pause != newval) {
+                               if(!gst_encode_bin_pause(encodebin, newval))
+                                       break;
+                       }
+#ifdef GST_ENCODE_BIN_SIGNAL_ENABLE            
+                       if(newval) {
+                               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_PAUSE], 0, TRUE);
+                       } else {
+                               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_RESUME], 0, TRUE);
+                       }
+#endif                 
+                       break;
+               }
+               case PROP_VENC_QUEUE:
+//               encodebin->use_venc_queue = g_value_get_boolean (value);
+               {
+                       GstElement *newelement = g_value_get_object (value);
+                       if(encodebin->profile > GST_ENCODE_BIN_PROFILE_AV) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match, change profile first!");
+                               break;
+                       }
+                       if(newelement != NULL) {
+                               gst_encode_bin_remove_element(encodebin, encodebin->video_encode_queue);
+                               encodebin->video_encode_queue = newelement;
+                               gst_object_ref (encodebin->video_encode_queue);
+                               gst_object_sink (GST_OBJECT_CAST (encodebin->video_encode_queue)); // take ownership ??
+                               gst_bin_add(GST_BIN(encodebin), encodebin->video_encode_queue);
+                       }
+                       break;
+               }
+                 break;                
+               case PROP_AENC_QUEUE:
+//               encodebin->use_aenc_queue = g_value_get_boolean (value);
+               {
+                       GstElement *newelement = g_value_get_object (value);
+                       if(encodebin->profile > GST_ENCODE_BIN_PROFILE_AUDIO) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match, change profile first!");
+                               break;
+                       }
+                       if(newelement != NULL) {
+                               gst_encode_bin_remove_element(encodebin, encodebin->audio_encode_queue);
+                               encodebin->audio_encode_queue = newelement;
+                               gst_object_ref (encodebin->audio_encode_queue);
+                               gst_object_sink (GST_OBJECT_CAST (encodebin->audio_encode_queue));
+                               gst_bin_add(GST_BIN(encodebin), encodebin->audio_encode_queue);
+                       }
+                       break;
+               }
+                 break;                  
+               case PROP_VIDEO_ENC: 
+               {
+                       GstElement *newelement = g_value_get_object (value);
+                       if(encodebin->profile > GST_ENCODE_BIN_PROFILE_AV) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match, change profile first!");
+                               break;
+                       }
+                       if(newelement != NULL) {
+                               gst_encode_bin_remove_element(encodebin, encodebin->video_encode);
+                               encodebin->video_encode = newelement;
+                               gst_object_ref (encodebin->video_encode);
+                               gst_object_sink (GST_OBJECT_CAST (encodebin->video_encode)); // take ownership ??
+                               gst_bin_add(GST_BIN(encodebin), encodebin->video_encode);
+                       }
+                       break;
+               }
+               case PROP_AUDIO_ENC: 
+               {
+                       GstElement *newelement = g_value_get_object (value);
+                       if(encodebin->profile > GST_ENCODE_BIN_PROFILE_AUDIO) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match, change profile first!");
+                               break;
+                       }
+                       if(newelement != NULL) {
+                               gst_encode_bin_remove_element(encodebin, encodebin->audio_encode);
+                               encodebin->audio_encode = newelement;
+                               gst_object_ref (encodebin->audio_encode);
+                               gst_object_sink (GST_OBJECT_CAST (encodebin->audio_encode));
+                               gst_bin_add(GST_BIN(encodebin), encodebin->audio_encode);
+                       }
+                       break;
+               }
+               case PROP_IMAGE_ENC: {
+                       GstElement *newelement = g_value_get_object (value);
+                       if(encodebin->profile < GST_ENCODE_BIN_PROFILE_IMAGE) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match, change profile first!");
+                               break;
+                       }
+                       if(newelement != NULL) {
+                               gst_encode_bin_remove_element(encodebin, encodebin->image_encode);
+                               encodebin->image_encode = newelement;
+                               gst_object_ref (encodebin->image_encode);
+                               gst_object_sink (GST_OBJECT_CAST (encodebin->image_encode));
+                               gst_bin_add(GST_BIN(encodebin), encodebin->image_encode);
+                       }
+                       break;
+               }
+               case PROP_MUX: {
+                       GstElement *newelement = g_value_get_object (value);
+                       if(encodebin->profile > GST_ENCODE_BIN_PROFILE_AUDIO) {
+                               GST_WARNING_OBJECT(encodebin, "Profile isn't match, change profile first!");
+                               break;
+                       }
+                       if(newelement != NULL) {
+                               gst_encode_bin_remove_element(encodebin, encodebin->mux);
+                               encodebin->mux = newelement;
+                               gst_object_ref (encodebin->mux);
+                               gst_object_sink (GST_OBJECT_CAST (encodebin->mux));
+                               gst_bin_add(GST_BIN(encodebin), encodebin->mux);
+                       }
+                       break;
+               }
+               case PROP_USE_VIDEO_TOGGLE:
+                       encodebin->use_video_toggle = g_value_get_boolean( value );
+                       break;
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                       break;
+       }
+}
+
+static GstPad *
+gst_encode_bin_request_new_pad (GstElement * element,
+    GstPadTemplate * templ, const gchar * req_name)
+{
+       GstEncodeBin *encodebin = NULL;
+       GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
+       GstPad *pad = NULL;
+
+       g_return_val_if_fail (templ != NULL, NULL);
+
+       if (templ->direction != GST_PAD_SINK) {
+               GST_WARNING_OBJECT (GST_IS_ENCODE_BIN (element), "encodebin: request pad that is not a SINK pad\n");
+               return NULL;
+       }
+
+       g_return_val_if_fail (GST_IS_ENCODE_BIN (element), NULL);
+
+       encodebin = GST_ENCODE_BIN (element);
+  
+ /* FIXME */
+       if (templ == gst_element_class_get_pad_template (klass, "audio")) {
+               if (encodebin->profile <= GST_ENCODE_BIN_PROFILE_AUDIO) {
+                       gst_encode_bin_init_audio_elements(element, NULL); //??
+                       
+                       if(encodebin->audio_sinkpad == NULL)
+                       {
+                               pad = gst_element_get_static_pad (encodebin->audio_queue, "sink");
+                               encodebin->audio_sinkpad = gst_ghost_pad_new ("audio", pad);
+                               gst_object_unref(pad);
+                               pad = NULL;
+                       }
+                       else
+                       {
+                               GST_WARNING_OBJECT (GST_IS_ENCODE_BIN (element), "encodebin: audio pad is aleady existed, return existing audio pad\n");                        
+                               return encodebin->audio_sinkpad;
+                       }
+                       
+                       gst_element_add_pad (element, encodebin->audio_sinkpad);
+                       gst_pad_set_setcaps_function (encodebin->audio_sinkpad,
+                               GST_DEBUG_FUNCPTR (gst_encode_bin_audsink_set_caps));
+                       return encodebin->audio_sinkpad;
+               } else
+                       return NULL;
+       } else if (templ == gst_element_class_get_pad_template (klass, "video")) {
+               if (encodebin->profile == GST_ENCODE_BIN_PROFILE_AV) {
+                       gst_encode_bin_init_video_elements(element, NULL); //??
+
+                       if(encodebin->video_sinkpad == NULL)
+                       {
+                               pad = gst_element_get_static_pad (encodebin->video_queue, "sink");
+                               encodebin->video_sinkpad = gst_ghost_pad_new ("video", pad);        
+                               gst_object_unref(pad);
+                               pad = NULL;
+                       }
+                       else
+                       {
+                               GST_WARNING_OBJECT (GST_IS_ENCODE_BIN (element), "encodebin: video pad is aleady existed, return existing video pad\n");                                                
+                               return encodebin->video_sinkpad;
+                       }
+                       
+                       gst_element_add_pad (element, encodebin->video_sinkpad);
+                       gst_pad_set_setcaps_function (encodebin->video_sinkpad,
+                       GST_DEBUG_FUNCPTR (gst_encode_bin_vidsink_set_caps));
+                       return encodebin->video_sinkpad;
+               } else if (encodebin->profile == GST_ENCODE_BIN_PROFILE_IMAGE) {
+                       gst_encode_bin_init_image_elements(element, NULL); //??
+
+                       if(encodebin->image_sinkpad == NULL)
+                       {
+                               pad = gst_element_get_static_pad (encodebin->image_queue, "sink");
+                               encodebin->image_sinkpad = gst_ghost_pad_new ("image", pad);
+                               gst_object_unref(pad);
+                               pad = NULL;                             
+                       }
+                       else
+                       {
+                               GST_WARNING_OBJECT (GST_IS_ENCODE_BIN (element), "encodebin: image pad is aleady existed, return existing image pad\n");                        
+                               return encodebin->image_sinkpad;
+                       }
+                       
+                       gst_element_add_pad (element, encodebin->image_sinkpad);
+                       gst_pad_set_setcaps_function (encodebin->image_sinkpad,
+                       GST_DEBUG_FUNCPTR (gst_encode_bin_imgsink_set_caps));
+                       return encodebin->image_sinkpad;
+               } else
+                       return NULL;
+       } else {
+               if (encodebin->profile == GST_ENCODE_BIN_PROFILE_IMAGE) {
+                       gst_encode_bin_init_image_elements(element, NULL); //??
+                       
+                       if(encodebin->image_sinkpad == NULL)
+                       {
+                               pad = gst_element_get_static_pad (encodebin->image_queue, "sink");
+                               encodebin->image_sinkpad = gst_ghost_pad_new ("image", pad);
+                               gst_object_unref(pad);
+                               pad = NULL;                             
+                       }
+                       else
+                       {
+                               GST_WARNING_OBJECT (GST_IS_ENCODE_BIN (element), "encodebin: image pad is aleady existed, return existing image pad\n");                        
+                               return encodebin->image_sinkpad;
+                       }
+                       
+                       gst_element_add_pad (element, encodebin->image_sinkpad);
+                       gst_pad_set_setcaps_function (encodebin->image_sinkpad,
+                       GST_DEBUG_FUNCPTR (gst_encode_bin_imgsink_set_caps));
+                       return encodebin->image_sinkpad;
+               } else
+                       return NULL;        
+       }  
+}
+
+static void
+gst_encode_bin_class_init (GstEncodeBinClass *klass)
+{
+
+       GObjectClass *gobject_klass;
+       GstElementClass *gstelement_klass;
+       GstBinClass *gstbin_klass;
+
+       gobject_klass = (GObjectClass *) klass;
+       gstelement_klass = (GstElementClass *) klass;
+       gstbin_klass = (GstBinClass *) klass;
+       
+       parent_class = g_type_class_peek_parent (klass);
+
+       gobject_klass->get_property = gst_encode_bin_get_property;
+       gobject_klass->set_property = gst_encode_bin_set_property;
+       gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_encode_bin_dispose);    
+       gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_encode_bin_finalize);
+
+
+       g_object_class_install_property (gobject_klass, PROP_PROFILE,
+         g_param_spec_enum ("profile", "PROFILE", "Profile of the media to record",
+             GST_TYPE_ENCODE_BIN_PROFILE, DEFAULT_PROP_PROFILE,
+             G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_HIGH_SPEED,
+         g_param_spec_int ("high-speed-fps", "high speed rec. fps", "framerate for high speed recording", 0, G_MAXINT, 
+               DEFAULT_PROP_HIGH_SPEED, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_VENC_NAME,
+         g_param_spec_string ("venc-name", "video encoder name", "the name of video encoder to use",
+             DEFAULT_PROP_VENC_NAME, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_AENC_NAME,
+         g_param_spec_string ("aenc-name", "audio encoder name", "the name of audio encoder to use",
+             DEFAULT_PROP_AENC_NAME, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_IENC_NAME,
+         g_param_spec_string ("ienc-name", "image encoder name", "the name of image encoder to use",
+             DEFAULT_PROP_IENC_NAME, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_MUX_NAME,
+         g_param_spec_string ("mux-name", "muxer name", "the name of muxer to use",
+             DEFAULT_PROP_MUX_NAME, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_VCAPS,
+         g_param_spec_boxed ("vcaps", "caps for video","caps for video recording",
+             GST_TYPE_CAPS, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_ACAPS,
+         g_param_spec_boxed ("acaps", "caps for audio","caps for audio recording",
+             GST_TYPE_CAPS, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_ICAPS,
+         g_param_spec_boxed ("icaps", "caps for image","caps for image stillshot",
+             GST_TYPE_CAPS, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_AUTO_AUDIO_CONVERT,
+         g_param_spec_boolean ("auto-audio-convert", "auto audio convert",
+             "Support for auto audio convert", TRUE, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_AUTO_AUDIO_RESAMPLE,
+         g_param_spec_boolean ("auto-audio-resample", "auto audio resample",
+             "Support for auto audio resample", TRUE, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_AUTO_COLORSPACE,
+         g_param_spec_boolean ("auto-colorspace", "auto colorspace",
+             "Support for auto colorspace", TRUE, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_BLOCK,
+         g_param_spec_boolean ("block", "stream block",
+             "Support for stream block", FALSE, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_PAUSE,
+         g_param_spec_boolean ("runtime-pause", "recording pause",
+             "Support for recording pause/resume", FALSE, G_PARAM_READWRITE));
+
+#if 0
+       g_object_class_install_property (gobject_klass, PROP_VENC_QUEUE,
+         g_param_spec_boolean ("use-venc-queue", "use queue between venc and mux",
+             "add queue between venc and mux(only for custom optimization)", FALSE, G_PARAM_READWRITE));       
+
+       g_object_class_install_property (gobject_klass, PROP_AENC_QUEUE,
+         g_param_spec_boolean ("use-aenc-queue", "use queue between aenc and mux",
+             "add queue between aenc and mux(only for custom optimization)", FALSE, G_PARAM_READWRITE));               
+#else
+       g_object_class_install_property (gobject_klass, PROP_VENC_QUEUE,
+         g_param_spec_object ("use-venc-queue", "Video Encoder queue",
+             "add queue between venc and mux(only for custom optimization)",
+             GST_TYPE_ELEMENT, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_AENC_QUEUE,
+         g_param_spec_object ("use-aenc-queue", "Audio Encoder queue",
+             "add queue between aenc and mux(only for custom optimization)",
+             GST_TYPE_ELEMENT, G_PARAM_READWRITE));
+#endif
+
+       g_object_class_install_property (gobject_klass, PROP_VIDEO_ENC,
+         g_param_spec_object ("video-encode", "Video Encoder",
+             "the video encoder element to use",
+             GST_TYPE_ELEMENT, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_AUDIO_ENC,
+         g_param_spec_object ("audio-encode", "Audio Encoder",
+             "the audio encoder element to use",
+             GST_TYPE_ELEMENT, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_IMAGE_ENC,
+         g_param_spec_object ("image-encode", "Image Encoder",
+             "the Image encoder element to use",
+             GST_TYPE_ELEMENT, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_MUX,
+         g_param_spec_object ("mux", "Muxer",
+             "the muxer element to use",
+             GST_TYPE_ELEMENT, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_klass, PROP_USE_VIDEO_TOGGLE,
+               g_param_spec_boolean ("use-video-toggle", "Use video toggle",
+               "Use video toggle while AV recording", TRUE, G_PARAM_READWRITE));
+
+#ifdef GST_ENCODE_BIN_SIGNAL_ENABLE
+       gst_encode_bin_signals[SIGNAL_STREAM_BLOCK] =
+               g_signal_new ("stream-block", G_TYPE_FROM_CLASS (klass),
+               G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstEncodeBinClass, stream_block), 
+               NULL, NULL, gst_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+       gst_encode_bin_signals[SIGNAL_STREAM_UNBLOCK] =
+               g_signal_new ("stream-unblock", G_TYPE_FROM_CLASS (klass),
+               G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstEncodeBinClass, stream_unblock), 
+               NULL, NULL, gst_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+       gst_encode_bin_signals[SIGNAL_STREAM_PAUSE] =
+               g_signal_new ("stream-pause", G_TYPE_FROM_CLASS (klass),
+               G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstEncodeBinClass, stream_pause), 
+               NULL, NULL, gst_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+       gst_encode_bin_signals[SIGNAL_STREAM_RESUME] =
+               g_signal_new ("stream-resume", G_TYPE_FROM_CLASS (klass),
+               G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstEncodeBinClass, stream_resume), 
+               NULL, NULL, gst_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); 
+#endif
+
+       gst_element_class_add_pad_template (gstelement_klass,
+         gst_static_pad_template_get (&encoder_bin_src_template));
+       gst_element_class_add_pad_template (gstelement_klass,
+         gst_static_pad_template_get (&encoder_bin_audio_sink_template));
+       gst_element_class_add_pad_template (gstelement_klass,
+         gst_static_pad_template_get (&encoder_bin_video_sink_template));
+       gst_element_class_add_pad_template (gstelement_klass,
+         gst_static_pad_template_get (&encoder_bin_image_sink_template));
+
+       gst_element_class_set_details (gstelement_klass, &gst_encode_bin_details);
+
+       gstelement_klass->request_new_pad =
+         GST_DEBUG_FUNCPTR (gst_encode_bin_request_new_pad);
+       gstelement_klass->release_pad = 
+         GST_DEBUG_FUNCPTR (gst_encode_bin_release_pad);
+       gstelement_klass->change_state =
+         GST_DEBUG_FUNCPTR (gst_encode_bin_change_state);
+}
+
+static void
+gst_encode_bin_init (GstEncodeBin *encodebin)
+{
+       encodebin->mutex = g_mutex_new();
+
+       if(encodebin->srcpad == NULL) {
+               encodebin->srcpad = gst_ghost_pad_new_no_target ("src", GST_PAD_SRC);
+               gst_element_add_pad (GST_ELEMENT(encodebin), encodebin->srcpad);
+       }  
+
+       encodebin->video_sinkpad = NULL;
+       encodebin->audio_sinkpad = NULL;
+       encodebin->image_sinkpad = NULL;
+       encodebin->mux_audio_sinkpad = NULL;
+       encodebin->mux_video_sinkpad = NULL;
+       
+       encodebin->profile = DEFAULT_PROP_PROFILE;
+       encodebin->fps = 0;
+       encodebin->high_speed_fps = DEFAULT_PROP_HIGH_SPEED;
+       encodebin->multiple = 1;
+
+       encodebin->auto_audio_convert = TRUE;
+       encodebin->auto_audio_resample = TRUE;
+       encodebin->auto_color_space = TRUE;
+       encodebin->block = FALSE;
+       encodebin->pause= FALSE; 
+       encodebin->use_video_toggle = TRUE;
+       encodebin->use_venc_queue= FALSE;       
+       encodebin->use_aenc_queue= FALSE;               
+
+       encodebin->venc_name = g_strdup(DEFAULT_PROP_VENC_NAME);
+       encodebin->aenc_name = g_strdup(DEFAULT_PROP_AENC_NAME);
+       encodebin->ienc_name = g_strdup(DEFAULT_PROP_IENC_NAME);  
+       encodebin->mux_name = g_strdup(DEFAULT_PROP_MUX_NAME);  
+
+       encodebin->vcaps = gst_caps_new_any ();
+       encodebin->acaps = gst_caps_new_any ();
+       encodebin->icaps = gst_caps_new_any ();
+
+       encodebin->audio_queue = NULL;
+       encodebin->video_queue = NULL;  
+       encodebin->video_encode_queue = NULL;   
+       encodebin->image_queue = NULL;    
+
+       encodebin->audio_encode = NULL;
+       encodebin->video_encode = NULL;
+       encodebin->image_encode = NULL;  
+
+       encodebin->vcapsfilter = NULL;  
+       encodebin->acapsfilter = NULL;    
+       encodebin->icapsfilter = NULL;      
+
+       encodebin->video_toggle = NULL;  
+       encodebin->image_toggle = NULL;
+       encodebin->color_space = NULL;  
+       encodebin->audio_conv = NULL;  
+       encodebin->audio_sample = NULL;
+
+       encodebin->mux = NULL;
+
+       encodebin->paused_time = 0;
+       encodebin->total_offset_time = 0;
+
+       encodebin->vsink_probeid = 0;
+       encodebin->vsink_hs_probeid = 0;
+       encodebin->asink_probeid = 0;
+       encodebin->veque_sig_id = 0;
+       encodebin->aeque_sig_id = 0;    
+}
+
+static void 
+gst_encode_bin_dispose (GObject * object) 
+{
+       GstEncodeBin *encodebin = GST_ENCODE_BIN (object);
+
+       g_free(encodebin->venc_name);
+       encodebin->venc_name = NULL;
+
+       g_free(encodebin->aenc_name);
+       encodebin->aenc_name = NULL;    
+
+       g_free(encodebin->ienc_name);
+       encodebin->ienc_name = NULL;
+
+       g_free(encodebin->mux_name);
+       encodebin->mux_name = NULL;
+
+
+       gst_caps_replace (&encodebin->vcaps, NULL);
+       gst_caps_replace (&encodebin->acaps, NULL);
+       gst_caps_replace (&encodebin->icaps, NULL);
+
+       if(encodebin->srcpad != NULL)
+       {
+               gst_element_remove_pad (GST_ELEMENT(encodebin), encodebin->srcpad);
+               encodebin->srcpad = NULL;
+       }
+               
+
+       G_OBJECT_CLASS (parent_class)->dispose (object);
+
+
+
+       encodebin->video_sinkpad = NULL;
+       encodebin->audio_sinkpad = NULL;
+       encodebin->image_sinkpad = NULL;
+       encodebin->mux_audio_sinkpad = NULL;
+       encodebin->mux_video_sinkpad = NULL;
+
+       encodebin->audio_queue = NULL;
+       encodebin->video_queue = NULL;  
+       encodebin->image_queue = NULL;    
+
+       encodebin->audio_encode = NULL;
+       encodebin->video_encode = NULL;
+       encodebin->video_encode_queue = NULL;   
+       encodebin->image_encode = NULL;  
+
+       encodebin->vcapsfilter = NULL;  
+       encodebin->acapsfilter = NULL;    
+       encodebin->icapsfilter = NULL;      
+
+       encodebin->video_toggle = NULL;  
+       encodebin->image_toggle = NULL;
+       encodebin->color_space = NULL;  
+       encodebin->audio_conv = NULL;  
+       encodebin->audio_sample = NULL;
+       
+       if(encodebin->mux && GST_IS_ELEMENT(encodebin->mux))
+       {
+               int remain_count= 0 ;
+               remain_count = GST_OBJECT_REFCOUNT_VALUE(encodebin->mux);
+               while(remain_count)
+               {
+                       gst_object_unref(encodebin->mux);
+                       remain_count--;
+               }               
+       }
+       encodebin->mux = NULL;
+}
+
+static void
+gst_encode_bin_finalize (GObject * object)
+{
+       GstEncodeBin *encodebin = GST_ENCODE_BIN (object);
+
+       g_mutex_free (encodebin->mutex);
+
+       G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static GstStateChangeReturn
+gst_encode_bin_change_state (GstElement * element, GstStateChange transition)
+{
+       GstStateChangeReturn ret;
+       GstEncodeBin *encode_bin;
+
+       encode_bin = GST_ENCODE_BIN (element);
+
+       switch (transition) {
+               case GST_STATE_CHANGE_NULL_TO_READY:
+                       gst_encode_bin_link_elements(encode_bin);
+                       break;
+               case GST_STATE_CHANGE_READY_TO_PAUSED:
+                       /* reset time related values */
+                       encode_bin->paused_time = 0;
+                       encode_bin->total_offset_time = 0;
+                       break;
+               case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+                       break;
+               case GST_STATE_CHANGE_PAUSED_TO_READY:
+                       break;
+               default:
+                       break;
+       }
+
+       ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+       switch (transition) {
+       case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+               break;
+       case GST_STATE_CHANGE_PAUSED_TO_READY:
+               break;
+       case GST_STATE_CHANGE_READY_TO_NULL:
+               gst_encode_bin_unlink_elements(encode_bin);     
+               break;          
+       default:
+               break;
+       }
+
+//  if (ret == GST_STATE_CHANGE_FAILURE)
+//    goto done;
+//done:
+       return ret;
+}
+
+static void
+gst_encode_bin_release_all_pads (GstEncodeBin *encodebin)
+{
+       gst_element_remove_pad(GST_ELEMENT(encodebin), encodebin->video_sinkpad);
+       gst_element_remove_pad(GST_ELEMENT(encodebin), encodebin->audio_sinkpad);
+       gst_element_remove_pad(GST_ELEMENT(encodebin), encodebin->image_sinkpad);
+}
+
+static void
+gst_encode_bin_release_pad (GstElement * element, GstPad * pad)
+{
+       GstEncodeBin *encodebin = GST_ENCODE_BIN (element);
+       GstPad *muxpad = NULL;
+       
+       if(!pad_compare_name(pad, "video")) {
+#if 0          
+               gst_encode_bin_remove_element(encodebin, encodebin->video_queue);
+               encodebin->video_queue = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->video_toggle);
+               encodebin->video_toggle = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->color_space);
+               encodebin->color_space = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->vcapsfilter);
+               encodebin->vcapsfilter = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->video_encode_queue);
+               encodebin->video_encode_queue =  NULL;          
+               gst_encode_bin_remove_element(encodebin, encodebin->video_encode);
+               encodebin->video_encode =  NULL;
+
+               gst_element_release_request_pad(encodebin->mux, encodebin->mux_video_sinkpad);  
+               encodebin->mux_video_sinkpad = NULL;
+
+               if(encodebin->mux_audio_sinkpad == NULL) {
+                       gst_encode_bin_remove_element(encodebin, encodebin->mux);
+                       encodebin->mux = NULL;
+               }
+               else 
+               {
+                       encodebin->mux_audio_sinkpad = NULL;
+               }
+#endif 
+
+               if(encodebin->mux_video_sinkpad != NULL)
+               {       
+                       gst_element_release_request_pad(encodebin->mux, encodebin->mux_video_sinkpad);
+                       encodebin->mux_video_sinkpad = NULL;
+               }
+               
+               gst_pad_set_active (pad, FALSE); //??
+               gst_element_remove_pad(element, pad);
+               encodebin->video_sinkpad = NULL;
+       } else if(!pad_compare_name(pad, "audio")) {
+#if 0
+               gst_encode_bin_remove_element(encodebin, encodebin->audio_queue);
+               encodebin->audio_queue = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->audio_sample);
+               encodebin->audio_sample = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->audio_conv);
+               encodebin->audio_conv = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->acapsfilter);
+               encodebin->acapsfilter = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->audio_encode_queue);
+               encodebin->audio_encode_queue =  NULL;                  
+               gst_encode_bin_remove_element(encodebin, encodebin->audio_encode);
+               encodebin->audio_encode = NULL;
+
+               encodebin->mux_audio_sinkpad;
+               gst_element_release_request_pad(encodebin->mux, encodebin->mux_audio_sinkpad);
+               muxpad = NULL;
+
+               if(encodebin->mux_video_sinkpad == NULL) {
+                       gst_encode_bin_remove_element(encodebin, encodebin->mux);
+                       encodebin->mux = NULL;
+               }
+               else 
+               {
+                       encodebin->mux_video_sinkpad = NULL;
+               }
+#endif         
+               if(encodebin->mux_audio_sinkpad != NULL)
+               {
+                       gst_element_release_request_pad(encodebin->mux, encodebin->mux_audio_sinkpad);
+//                     gst_object_unref(encodebin->mux_audio_sinkpad);         //***
+                       encodebin->mux_audio_sinkpad = NULL;
+               }
+
+               gst_pad_set_active (pad, FALSE); //??           
+               gst_element_remove_pad(element, pad);
+               encodebin->audio_sinkpad = NULL;
+       } else {
+#if 0
+               gst_encode_bin_remove_element(encodebin, encodebin->image_queue);
+               encodebin->image_queue = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->image_toggle);
+               encodebin->image_toggle = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->color_space);
+               encodebin->color_space = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->icapsfilter);
+               encodebin->icapsfilter = NULL;
+               gst_encode_bin_remove_element(encodebin, encodebin->image_encode);
+               encodebin->image_encode = NULL;
+#endif         
+               gst_pad_set_active (pad, FALSE); //??           
+               gst_element_remove_pad(element, pad);
+               encodebin->image_sinkpad = NULL;
+       }
+}
+
+static gint
+pad_compare_name (GstPad * pad1, const gchar * name)
+{
+       gint result;
+
+       GST_OBJECT_LOCK (pad1);
+               result = strcmp (GST_PAD_NAME (pad1), name);
+       GST_OBJECT_UNLOCK (pad1);
+
+       return result;
+}
+
+static gboolean 
+gst_encode_bin_add_element_by_name (GstEncodeBin *encodebin, GstEncodeBinElement type, const gchar *name)
+{
+       switch(type) {
+               case ENCODEBIN_ELEMENT_VENC :
+                       encodebin->video_encode = gst_element_factory_make (name, "video_encode");      
+                       if(encodebin->video_encode != NULL) {
+                               gst_bin_add(GST_BIN(encodebin), encodebin->video_encode);
+                               g_free(encodebin->venc_name);
+                       } else {
+                               goto element_make_fail;
+                       }
+                       break;
+               case ENCODEBIN_ELEMENT_AENC :
+                       encodebin->audio_encode = gst_element_factory_make (name, "audio_encode");      
+                       if(encodebin->audio_encode != NULL) {
+                               gst_bin_add(GST_BIN(encodebin), encodebin->audio_encode);
+                               g_free(encodebin->aenc_name);
+                       } else {
+                               goto element_make_fail;
+                       }                       
+                       break;
+               case ENCODEBIN_ELEMENT_IENC :
+                       encodebin->image_encode = gst_element_factory_make (name, "image_encode");      
+                       if(encodebin->image_encode != NULL) {
+                               gst_bin_add(GST_BIN(encodebin), encodebin->image_encode);
+                               g_free(encodebin->ienc_name);
+                       } else {
+                               goto element_make_fail;
+                       }               
+                       break;
+               case ENCODEBIN_ELEMENT_MUX :
+                       encodebin->mux = gst_element_factory_make (name, "mux");        
+                       if(encodebin->mux != NULL) {
+                               gst_bin_add(GST_BIN(encodebin), encodebin->mux);
+                               g_free(encodebin->mux_name);
+                       } else {
+                               goto element_make_fail;
+                       }               
+                       break;
+               default :       
+                       GST_WARNING_OBJECT(encodebin, "Invalid element type = %d", type);
+                       break;  
+       }
+
+       return TRUE;
+       
+element_make_fail:
+       GST_WARNING_OBJECT(encodebin, "no such element factory \"%s\"!", name);
+       return FALSE;
+}
+
+#if 0 //disable unused function
+static gboolean 
+gst_encode_bin_change_profile(GstEncodeBin *encodebin, gboolean newprofile)
+{
+
+  gst_encode_bin_remove_element(encodebin, encodebin->video_encode);
+  gst_encode_bin_remove_element(encodebin, encodebin->audio_encode);
+  gst_encode_bin_remove_element(encodebin, encodebin->image_encode);
+  gst_encode_bin_remove_element(encodebin, encodebin->mux);
+
+  switch (newprofile) {
+    case GST_ENCODE_BIN_PROFILE_AV :
+       encodebin->audio_encode = gst_element_factory_make (encodebin->aenc_name, "audio_encode");
+       encodebin->video_encode = gst_element_factory_make (encodebin->venc_name,"video_encode");
+       encodebin->mux = gst_element_factory_make (encodebin->mux_name,"mux");
+
+         gst_bin_add_many (GST_BIN (encodebin),
+                           encodebin->audio_encode,
+                           encodebin->video_encode,
+                           encodebin->mux,
+                           NULL);
+       break;
+    case GST_ENCODE_BIN_PROFILE_AUDIO :
+       encodebin->audio_encode = gst_element_factory_make (encodebin->aenc_name, "audio_encode");
+       encodebin->mux = gst_element_factory_make (encodebin->mux_name,"mux");
+
+         gst_bin_add_many (GST_BIN (encodebin),
+                           encodebin->audio_encode,
+                           encodebin->mux,
+                           NULL);
+       break;
+    case GST_ENCODE_BIN_PROFILE_IMAGE :
+       encodebin->image_encode = gst_element_factory_make (encodebin->ienc_name,"image_encode");
+
+       gst_bin_add_many (GST_BIN (encodebin),
+                           encodebin->image_encode,
+                           NULL);
+       break;
+    default:
+      GST_WARNING_OBJECT(encodebin, "Invalid profile number = %d", encodebin->profile);
+      return FALSE;
+      break;
+       }
+  return TRUE;
+
+}
+
+static void 
+gst_encode_bin_replace_element (GstEncodeBin *encodebin, gint type, GstElement * newelement)
+{
+  if(newelement == NULL) {
+       GST_ERROR_OBJECT(encodebin, "some elements are null\n");
+       return;
+  }
+  switch(type) {
+    case PROP_VIDEO_ENC:
+       gst_encode_bin_remove_element(encodebin, encodebin->video_encode);
+       encodebin->video_encode = newelement;
+       gst_object_ref (encodebin->video_encode);
+       gst_object_sink (GST_OBJECT_CAST (encodebin->video_encode)); // take ownership ??
+       gst_bin_add(GST_BIN(encodebin),  encodebin->video_encode);
+       break;
+    case PROP_AUDIO_ENC:
+       gst_encode_bin_remove_element(encodebin, encodebin->audio_encode);
+       encodebin->audio_encode = newelement;
+       gst_object_ref (encodebin->audio_encode);
+       gst_object_sink (GST_OBJECT_CAST (encodebin->audio_encode));
+       gst_bin_add(GST_BIN(encodebin),  encodebin->audio_encode);
+       break;  
+    case PROP_IMAGE_ENC:
+       gst_encode_bin_remove_element(encodebin, encodebin->image_encode);
+       encodebin->image_encode = newelement;
+       gst_object_ref (encodebin->image_encode);
+       gst_object_sink (GST_OBJECT_CAST (encodebin->image_encode));
+       gst_bin_add(GST_BIN(encodebin), encodebin->image_encode);
+       break;
+    case PROP_MUX:
+       gst_encode_bin_remove_element(encodebin, encodebin->mux);
+       encodebin->mux = newelement;
+       gst_object_ref (encodebin->mux);
+       gst_object_sink (GST_OBJECT_CAST (encodebin->mux));
+       gst_bin_add(GST_BIN(encodebin),  encodebin->mux);
+       break;
+    default:
+       GST_WARNING_OBJECT(encodebin, "Invalid type = %d", type);
+      return;
+       break;
+  }
+}
+
+static gboolean 
+gst_encode_bin_replace_element_by_name(GstEncodeBin *encodebin, GstEncodeBinElement type, const gchar *name)
+{
+       GstPad *sink1, *sink2, *src, *peersink1, *peersink2, *peersrc;
+       
+       switch(type) {
+               case ENCODEBIN_ELEMENT_VENC:
+                       if(encodebin->video_encode == NULL) {
+                               encodebin->video_encode = gst_element_factory_make (name, "video_encode");
+                               gst_bin_add(GST_BIN(encodebin), encodebin->video_encode);
+                       } else {
+                               sink1 = gst_element_get_static_pad(encodebin->video_encode, "sink");
+                               src = gst_element_get_static_pad(encodebin->video_encode, "src");
+                               if(sink1 != NULL) {
+                                       peersink1 = gst_pad_get_peer(sink1);
+                                       if(peersink1 != NULL) {
+                                               if(!gst_pad_unlink(peersink1, sink1)) {
+                                                       goto unlink_fail;
+                                               }
+                                       }
+                               }
+
+                               if(src !=NULL) {
+                                       peersrc = gst_pad_get_peer(src);
+                                       if(peersrc != NULL) {
+                                               if(!gst_pad_unlink(src, peersrc)) {
+                                                       goto unlink_fail;
+                                               }
+                                       }
+                               }
+                               
+                               if(gst_encode_bin_remove_element(encodebin, encodebin->video_encode)) {
+                                       if(encodebin->video_encode = gst_element_factory_make (name, "video_encode") != NULL) {
+                                               gst_bin_add(GST_BIN(encodebin), encodebin->video_encode);
+                                               if(peersink1 != NULL) {
+                                                       if(!gst_pad_link(peersink1, gst_element_get_pad(encodebin->video_encode, "sink"))) {
+                                                               goto link_fail;
+                                                       }
+                                               }
+                                               
+                                               if(peersrc != NULL) {
+                                                       if(!gst_pad_link(gst_element_get_pad(encodebin->video_encode, "src"), peersrc)) {
+                                                               goto link_fail;
+                                                       }
+                                               }
+                                       } else {
+                                               GST_ERROR_OBJECT(encodebin, "gst_encode_bin_replace_element_by_name() new element[%d] make fail\n", type);
+                                               return FALSE;                                   
+                                       }
+                               } else {
+                                       GST_ERROR_OBJECT(encodebin, "gst_encode_bin_replace_element_by_name() old element[%d] remove fail\n", type);
+                                       return FALSE;
+                               }                               
+                       }                       
+                       break;
+               case ENCODEBIN_ELEMENT_AENC:
+                       break;
+               case ENCODEBIN_ELEMENT_IENC:
+                       break;
+               case ENCODEBIN_ELEMENT_MUX:
+                       break;
+               default :
+                       GST_WARNING_OBJECT(encodebin, "Invalid element type = %d", type);
+                       break;
+       }
+       gst_object_unref(sink1);
+       gst_object_unref(sink2);
+       gst_object_unref(src);
+       gst_object_unref(peersink1);    
+       gst_object_unref(peersink2);    
+       gst_object_unref(peersrc);              
+       return TRUE;
+
+unlink_fail:
+       gst_object_unref(sink1);
+       gst_object_unref(sink2);
+       gst_object_unref(src);
+       gst_object_unref(peersink1);    
+       gst_object_unref(peersink2);    
+       gst_object_unref(peersrc);      
+       GST_ERROR_OBJECT(encodebin, "gst_encode_bin_replace_element_by_name() old element[%d] unlink fail\n", type);
+       return FALSE;
+
+       
+link_fail:
+       gst_object_unref(sink1);
+       gst_object_unref(sink2);
+       gst_object_unref(src);
+       gst_object_unref(peersink1);    
+       gst_object_unref(peersink2);    
+       gst_object_unref(peersrc);      
+       GST_ERROR_OBJECT(encodebin, "gst_encode_bin_replace_element_by_name() new element[%d] link fail\n", type);
+       return FALSE;                   
+}
+
+static gboolean 
+gst_encode_bin_replace_element_by_object(GstEncodeBin *encodebin, GstEncodeBinElement type, GstElement * element)
+{
+       GstPad *sink1, *sink2, *src, *peersink1, *peersink2, *peersrc;
+       
+       switch(type)
+               case ENCODEBIN_ELEMENT_VENC:
+                       if(encodebin->video_encode == NULL) {
+                               encodebin->video_encode = element
+                       }
+                       break;
+               case ENCODEBIN_ELEMENT_AENC:
+                       break;
+               case ENCODEBIN_ELEMENT_IENC:
+                       break;
+               case ENCODEBIN_ELEMENT_MUX:
+                       break;
+               default :
+                       GST_WARNING_OBJECT (encodebin,"Invalid element type = %d", type);
+                       break;
+}
+#endif //disable unused function
+
+static gboolean 
+gst_encode_bin_remove_element (GstEncodeBin *encodebin, GstElement * element)
+{
+       GstObject *parent;
+       gchar *ename = NULL;
+       GST_DEBUG_OBJECT (encodebin, "gst_encode_bin_remove_element");
+
+       if(element == NULL)
+               return TRUE;
+
+       gst_element_set_state (element, GST_STATE_NULL);
+       parent = gst_element_get_parent (element);
+
+       if (parent != NULL) {
+               if(!gst_bin_remove (GST_BIN_CAST (parent), element)) {
+                       gst_object_unref (parent);
+                       ename = gst_element_get_name (element);
+                       GST_ERROR_OBJECT (encodebin, "gst_encode_bin_remove_element() [%s] remove fail", ename);
+                       g_free (ename);
+                       return FALSE;
+               } else
+                       gst_object_unref (parent);
+       } else {
+               gst_object_unref(element);
+       }
+       return TRUE;
+  }
+
+static gboolean 
+gst_encode_bin_link_elements (GstEncodeBin *encodebin)  // need to return ????
+{
+       GstPad *srcpad = NULL, *sinkpad = NULL;
+       switch(encodebin->profile) {
+               case GST_ENCODE_BIN_PROFILE_AV :
+                       if(!gst_caps_is_any(encodebin->vcaps))
+                       {
+                               g_object_set(encodebin->vcapsfilter, "caps", encodebin->vcaps, NULL);
+                       }
+       
+                       if (encodebin->auto_color_space) {
+                               if(encodebin->color_space == NULL) {
+                                   encodebin->color_space  = gst_element_factory_make ("ffmpegcolorspace","color_space");
+                                   gst_bin_add (GST_BIN (encodebin), encodebin->color_space);
+                               }
+                               
+                               srcpad = gst_element_get_static_pad(encodebin->video_queue, "src");                             
+                               if( encodebin->video_toggle )
+                               {
+                                       sinkpad = gst_element_get_static_pad(encodebin->video_toggle, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);
+                                       
+                                       srcpad = gst_element_get_static_pad(encodebin->video_toggle, "src");
+                               }
+                               sinkpad = gst_element_get_static_pad(encodebin->color_space, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);
+
+                               srcpad = gst_element_get_static_pad(encodebin->color_space, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->vcapsfilter, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);  
+
+                               srcpad = gst_element_get_static_pad(encodebin->vcapsfilter, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->video_encode, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);                                  
+#if 0
+                               if(encodebin->use_venc_queue)
+                               {
+                                       if(encodebin->video_encode_queue == NULL) {
+                                           encodebin->video_encode_queue  = gst_element_factory_make ("queue","video_encode_queue");
+                                           gst_bin_add (GST_BIN (encodebin), encodebin->video_encode_queue);
+                                               
+                                           ENCODER_QUEUE_SET(encodebin->video_encode_queue, 0, 0, VIDEO_ENC_QUE_TIME);
+                                           encodebin->veque_sig_id = g_signal_connect( G_OBJECT(encodebin->video_encode_queue), "overrun", 
+                                                                                                                               G_CALLBACK(queue_overun_cb), encodebin);
+                                                       
+                                       }       
+
+                                       srcpad = gst_element_get_static_pad(encodebin->video_encode, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->video_encode_queue, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);  
+                               }
+#else
+                               if(encodebin->video_encode_queue)
+                               {
+                                   ENCODER_QUEUE_SET(encodebin->video_encode_queue, 0, 0, VIDEO_ENC_QUE_TIME);
+                                   encodebin->veque_sig_id = g_signal_connect( G_OBJECT(encodebin->video_encode_queue), "overrun", 
+                                                                                                                               G_CALLBACK(queue_overun_cb), encodebin);
+#if 0
+                                   g_object_set(G_OBJECT(encodebin->video_queue), 
+                                               "max-size-bytes", (guint)0, 
+                                               "max-size-buffers", (guint)1,   
+                                               "max-size-time", (guint64)0, 
+                                               NULL); 
+#endif
+                                       srcpad = gst_element_get_static_pad(encodebin->video_encode, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->video_encode_queue, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);  
+                               }
+#endif
+                                                                
+                       }
+                       else {
+                               srcpad = gst_element_get_static_pad(encodebin->video_queue, "src");
+                               if( encodebin->video_toggle )
+                               {
+                                       sinkpad = gst_element_get_static_pad(encodebin->video_toggle, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);  
+
+                                       srcpad = gst_element_get_static_pad(encodebin->video_toggle, "src");
+                               }
+                               sinkpad = gst_element_get_static_pad(encodebin->vcapsfilter, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);  
+
+                               srcpad = gst_element_get_static_pad(encodebin->vcapsfilter, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->video_encode, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);                                  
+ #if 0
+                               if(encodebin->use_venc_queue)
+                               {
+                                       if(encodebin->video_encode_queue == NULL) {
+                                           encodebin->video_encode_queue  = gst_element_factory_make ("queue","video_encode_queue");
+                                           gst_bin_add (GST_BIN (encodebin), encodebin->video_encode_queue);
+                                               
+                                           ENCODER_QUEUE_SET(encodebin->video_encode_queue, 0, 0, VIDEO_ENC_QUE_TIME);
+                                           encodebin->veque_sig_id = g_signal_connect( G_OBJECT(encodebin->video_encode_queue), "overrun", 
+                                                                                                                               G_CALLBACK(queue_overun_cb), encodebin);                                                        
+                                       }
+                                       
+                                       srcpad = gst_element_get_static_pad(encodebin->video_encode, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->video_encode_queue, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);
+                                       
+                               }                       
+#else
+                               if(encodebin->video_encode_queue)
+                               {
+                                   ENCODER_QUEUE_SET(encodebin->video_encode_queue, 0, 0, VIDEO_ENC_QUE_TIME);
+                                   encodebin->veque_sig_id = g_signal_connect( G_OBJECT(encodebin->video_encode_queue), "overrun", 
+                                                                                                                               G_CALLBACK(queue_overun_cb), encodebin);
+#if 0                                  
+                                   g_object_set(G_OBJECT(encodebin->video_queue), 
+                                               "max-size-bytes", (guint)0, 
+                                               "max-size-buffers", (guint)1,   
+                                               "max-size-time", (guint64)0, 
+                                               NULL);                                  
+#endif
+
+                                       srcpad = gst_element_get_static_pad(encodebin->video_encode, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->video_encode_queue, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);  
+                               }
+#endif                         
+               
+                       }
+
+//                     gst_element_get_request_pad (encodebin->mux, "video_%d");
+#if 0
+                       if(encodebin->use_venc_queue)
+                       {
+                               srcpad = gst_element_get_static_pad(encodebin->video_encode_queue, "src");
+                               sinkpad = encodebin->mux_video_sinkpad = gst_encode_bin_get_mux_sink_pad(encodebin->mux, ENCODEBIN_MUX_VIDEO_SINK);
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);                          
+                       }
+#else
+                       if(encodebin->video_encode_queue)
+                       {
+                               srcpad = gst_element_get_static_pad(encodebin->video_encode_queue, "src");
+                               sinkpad = encodebin->mux_video_sinkpad = gst_encode_bin_get_mux_sink_pad(encodebin->mux, ENCODEBIN_MUX_VIDEO_SINK);
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);                          
+                       }
+#endif
+                       else
+                       {
+                               srcpad = gst_element_get_static_pad(encodebin->video_encode, "src");
+                               sinkpad = encodebin->mux_video_sinkpad = gst_encode_bin_get_mux_sink_pad(encodebin->mux, ENCODEBIN_MUX_VIDEO_SINK);
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, video_link_fail);                  
+                       }
+
+                       srcpad = gst_element_get_static_pad(encodebin->mux, "src");
+                       if(gst_ghost_pad_get_target(GST_GHOST_PAD (encodebin->srcpad)) != srcpad)
+                               gst_ghost_pad_set_target(GST_GHOST_PAD (encodebin->srcpad), srcpad);
+                       gst_object_unref(srcpad);
+                       srcpad = NULL;                  
+               
+                       /* For pause/resume control */
+//                     encodebin->vsink_probeid = gst_pad_add_data_probe (gst_element_get_static_pad (encodebin->video_queue, "sink"),
+                       sinkpad = gst_element_get_static_pad (encodebin->video_queue, "sink");
+                       encodebin->vsink_probeid = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (gst_encode_bin_video_probe), encodebin);
+                       gst_object_unref(sinkpad);
+                       sinkpad = NULL;
+    
+                       if(encodebin->high_speed_fps > DEFAULT_PROP_HIGH_SPEED)
+                       {
+//                             encodebin->vsink_hs_probeid = gst_pad_add_data_probe (gst_element_get_static_pad (encodebin->video_encode, "sink"),
+                               sinkpad = gst_element_get_static_pad (encodebin->video_encode, "sink");
+                               encodebin->vsink_hs_probeid = gst_pad_add_buffer_probe (sinkpad,        G_CALLBACK (gst_encode_bin_video_probe_hs), encodebin);
+                               gst_object_unref(sinkpad);
+                               sinkpad = NULL;                         
+                       }                       
+                       
+                       if(encodebin->audio_queue == NULL)
+                       {
+                               GST_WARNING_OBJECT(encodebin, "Audio pad isn't requested, recording video only mode");
+                               break;
+                       }
+               case GST_ENCODE_BIN_PROFILE_AUDIO :
+                       if(!gst_caps_is_any(encodebin->acaps))
+                       {                       
+                               g_object_set(encodebin->acapsfilter, "caps", encodebin->acaps, NULL);
+                       }
+                       if (encodebin->auto_audio_convert ||encodebin->auto_audio_resample) {
+                               if (!encodebin->auto_audio_convert) {
+                                       if(encodebin->audio_sample == NULL) {
+                                               encodebin->audio_sample = gst_element_factory_make ("audioresample","audio_sample");
+                                              gst_bin_add (GST_BIN (encodebin), encodebin->audio_sample);
+                                       }
+                                       srcpad = gst_element_get_static_pad(encodebin->audio_queue, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->audio_sample, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);
+
+                                       srcpad = gst_element_get_static_pad(encodebin->audio_sample, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->acapsfilter, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);
+
+                                       srcpad = gst_element_get_static_pad(encodebin->acapsfilter, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->audio_encode, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);                                  
+#if 0                                  
+                                       if(encodebin->use_aenc_queue)
+                                       {
+                                               if(encodebin->audio_encode_queue == NULL) {
+                                                   encodebin->audio_encode_queue  = gst_element_factory_make ("queue","audio_encode_queue");
+                                                   gst_bin_add (GST_BIN (encodebin), encodebin->audio_encode_queue);
+                                                 
+                                                  ENCODER_QUEUE_SET(encodebin->audio_encode_queue, 0, 0, AUDIO_ENC_QUE_TIME);
+                                                  encodebin->aeque_sig_id = g_signal_connect( G_OBJECT(encodebin->audio_encode_queue), "overrun", 
+                                                                                                                                       G_CALLBACK(queue_overun_cb), encodebin);                                           
+                                               }       
+
+                                               srcpad = gst_element_get_static_pad(encodebin->audio_encode, "src");
+                                               sinkpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "sink");
+                                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+                                       }                                       
+#else
+                                       if(encodebin->audio_encode_queue)
+                                       {
+                                 
+                                               ENCODER_QUEUE_SET(encodebin->audio_encode_queue, 0, 0, AUDIO_ENC_QUE_TIME);
+                                               encodebin->aeque_sig_id = g_signal_connect( G_OBJECT(encodebin->audio_encode_queue), "overrun", 
+                                                                                                                       G_CALLBACK(queue_overun_cb), encodebin);                                           
+
+                                               srcpad = gst_element_get_static_pad(encodebin->audio_encode, "src");
+                                               sinkpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "sink");
+                                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+                                       }
+#endif
+                                       
+                               } else if (!encodebin->auto_audio_resample) {
+                                         if (encodebin->audio_conv == NULL) {
+                                               encodebin->audio_conv = gst_element_factory_make ("audioconvert","audio_conv");
+                                             gst_bin_add (GST_BIN (encodebin), encodebin->audio_conv);
+                                          }    
+
+                                       srcpad = gst_element_get_static_pad(encodebin->audio_queue, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->audio_conv, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);
+
+                                       srcpad = gst_element_get_static_pad(encodebin->audio_conv, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->acapsfilter, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);
+
+                                       srcpad = gst_element_get_static_pad(encodebin->acapsfilter, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->audio_encode, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);                                  
+#if 0                                  
+                                       if(encodebin->use_aenc_queue)
+                                       {
+                                               if(encodebin->audio_encode_queue == NULL) {
+                                                   encodebin->audio_encode_queue  = gst_element_factory_make ("queue","audio_encode_queue");
+                                                   gst_bin_add (GST_BIN (encodebin), encodebin->audio_encode_queue);
+
+                                                   ENCODER_QUEUE_SET(encodebin->audio_encode_queue, 0, 0, AUDIO_ENC_QUE_TIME);
+                                                  encodebin->aeque_sig_id = g_signal_connect( G_OBJECT(encodebin->audio_encode_queue), "overrun", 
+                                                                                                                                       G_CALLBACK(queue_overun_cb), encodebin);                                                        
+                                               }
+
+                                               srcpad = gst_element_get_static_pad(encodebin->audio_encode, "src");
+                                               sinkpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "sink");
+                                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);                                          
+                               
+                                       }                                       
+#else
+                                       if(encodebin->audio_encode_queue)
+                                       {
+                                 
+                                               ENCODER_QUEUE_SET(encodebin->audio_encode_queue, 0, 0, AUDIO_ENC_QUE_TIME);
+                                               encodebin->aeque_sig_id = g_signal_connect( G_OBJECT(encodebin->audio_encode_queue), "overrun", 
+                                                                                                                       G_CALLBACK(queue_overun_cb), encodebin);                                           
+
+                                               srcpad = gst_element_get_static_pad(encodebin->audio_encode, "src");
+                                               sinkpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "sink");
+                                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+                                       }
+#endif                                 
+                                       
+                               } else {
+                                       if(encodebin->audio_sample == NULL) {
+                                               encodebin->audio_sample = gst_element_factory_make ("audioresample","audio_sample");
+                                              gst_bin_add (GST_BIN (encodebin), encodebin->audio_sample);
+                                       }
+                                       if (encodebin->audio_conv == NULL) {
+                                               encodebin->audio_conv = gst_element_factory_make ("audioconvert","audio_conv");
+                                             gst_bin_add (GST_BIN (encodebin), encodebin->audio_conv);
+                                       }
+
+                                       srcpad = gst_element_get_static_pad(encodebin->audio_queue, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->audio_conv, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+
+                                       srcpad = gst_element_get_static_pad(encodebin->audio_conv, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->audio_sample, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);
+
+                                       srcpad = gst_element_get_static_pad(encodebin->audio_sample, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->acapsfilter, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);                                          
+
+                                       srcpad = gst_element_get_static_pad(encodebin->acapsfilter, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->audio_encode, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+#if 0                                  
+                                       if(encodebin->use_aenc_queue)
+                                       {
+                                               if(encodebin->audio_encode_queue == NULL) {
+                                                   encodebin->audio_encode_queue  = gst_element_factory_make ("queue","audio_encode_queue");
+                                                   gst_bin_add (GST_BIN (encodebin), encodebin->audio_encode_queue);
+                                                       
+                                                   ENCODER_QUEUE_SET(encodebin->audio_encode_queue, 0, 0, AUDIO_ENC_QUE_TIME);
+                                                  encodebin->aeque_sig_id = g_signal_connect( G_OBJECT(encodebin->audio_encode_queue), "overrun", 
+                                                                                                                                       G_CALLBACK(queue_overun_cb), encodebin);                                                
+                                               }       
+
+                                               srcpad = gst_element_get_static_pad(encodebin->audio_encode, "src");
+                                               sinkpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "sink");
+                                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);
+                                       
+                                       }                       
+#else
+                                       if(encodebin->audio_encode_queue)
+                                       {
+                                 
+                                               ENCODER_QUEUE_SET(encodebin->audio_encode_queue, 0, 0, AUDIO_ENC_QUE_TIME);
+                                               encodebin->aeque_sig_id = g_signal_connect( G_OBJECT(encodebin->audio_encode_queue), "overrun", 
+                                                                                                                       G_CALLBACK(queue_overun_cb), encodebin);                                           
+
+                                               srcpad = gst_element_get_static_pad(encodebin->audio_encode, "src");
+                                               sinkpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "sink");
+                                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+                                       }
+#endif                                 
+                                       
+                               }
+                       }else {
+
+                               srcpad = gst_element_get_static_pad(encodebin->audio_queue, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->acapsfilter, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);                  
+
+                               srcpad = gst_element_get_static_pad(encodebin->acapsfilter, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->audio_encode, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);                                  
+#if 0
+                               if(encodebin->use_aenc_queue)
+                               {
+                                       if(encodebin->audio_encode_queue == NULL) {
+                                           encodebin->audio_encode_queue  = gst_element_factory_make ("queue","audio_encode_queue");
+                                           gst_bin_add (GST_BIN (encodebin), encodebin->audio_encode_queue);
+                                               
+                                           ENCODER_QUEUE_SET(encodebin->audio_encode_queue, 0, 0, AUDIO_ENC_QUE_TIME);
+                                          encodebin->aeque_sig_id = g_signal_connect( G_OBJECT(encodebin->audio_encode_queue), "overrun", 
+                                                                                                                               G_CALLBACK(queue_overun_cb), encodebin);                                
+                                       }               
+
+                                       srcpad = gst_element_get_static_pad(encodebin->audio_encode, "src");
+                                       sinkpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "sink");
+                                       _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);                                  
+                               }                               
+#else
+                                       if(encodebin->audio_encode_queue)
+                                       {
+                                 
+                                               ENCODER_QUEUE_SET(encodebin->audio_encode_queue, 0, 0, AUDIO_ENC_QUE_TIME);
+                                               encodebin->aeque_sig_id = g_signal_connect( G_OBJECT(encodebin->audio_encode_queue), "overrun", 
+                                                                                                                       G_CALLBACK(queue_overun_cb), encodebin);                                           
+
+                                               srcpad = gst_element_get_static_pad(encodebin->audio_encode, "src");
+                                               sinkpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "sink");
+                                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+                                       }
+#endif                                 
+                               
+                       }
+#if 0                  
+                       if(encodebin->use_aenc_queue)
+                       {
+                               srcpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "src");
+                               sinkpad = encodebin->mux_audio_sinkpad = gst_encode_bin_get_mux_sink_pad(encodebin->mux, ENCODEBIN_MUX_AUDIO_SINK);
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+
+                       }
+#else
+
+                       if(encodebin->audio_encode_queue)
+                       {
+                               srcpad = gst_element_get_static_pad(encodebin->audio_encode_queue, "src");
+                               sinkpad = encodebin->mux_audio_sinkpad = gst_encode_bin_get_mux_sink_pad(encodebin->mux, ENCODEBIN_MUX_AUDIO_SINK);
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+
+                       }
+#endif
+                       else
+                       {       
+                               srcpad = gst_element_get_static_pad(encodebin->audio_encode, "src");
+                               sinkpad = encodebin->mux_audio_sinkpad = gst_encode_bin_get_mux_sink_pad(encodebin->mux, ENCODEBIN_MUX_AUDIO_SINK);
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, audio_link_fail);  
+                       }
+
+                       srcpad = gst_element_get_static_pad(encodebin->mux, "src");
+                       if(gst_ghost_pad_get_target(GST_GHOST_PAD (encodebin->srcpad)) != srcpad)
+                               gst_ghost_pad_set_target(GST_GHOST_PAD (encodebin->srcpad), srcpad);
+                       gst_object_unref(srcpad);
+                       srcpad = NULL;
+
+                       /* For pause/resume control */
+                       sinkpad = gst_element_get_static_pad (encodebin->audio_queue, "sink");
+                       encodebin->asink_probeid = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (gst_encode_bin_audio_probe), encodebin);
+                       gst_object_unref(sinkpad);
+                       sinkpad = NULL;
+
+                       break;
+               case GST_ENCODE_BIN_PROFILE_IMAGE :
+                       if(!gst_caps_is_any(encodebin->icaps))
+                       {                               
+                               g_object_set(encodebin->icapsfilter, "caps", encodebin->icaps, NULL);
+                       }
+                               
+                       if (encodebin->auto_color_space) {
+                               if(encodebin->color_space == NULL) {
+                                   encodebin->color_space  = gst_element_factory_make ("ffmpegcolorspace","color_space");
+                                   gst_bin_add (GST_BIN (encodebin), encodebin->color_space);
+                               }
+
+                               srcpad = gst_element_get_static_pad(encodebin->image_queue, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->image_toggle, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, image_link_fail);
+
+                               srcpad = gst_element_get_static_pad(encodebin->image_toggle, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->color_space, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, image_link_fail);          
+
+                               srcpad = gst_element_get_static_pad(encodebin->color_space, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->icapsfilter, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, image_link_fail);  
+
+                               srcpad = gst_element_get_static_pad(encodebin->icapsfilter, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->image_encode, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, image_link_fail);                                  
+
+                       }
+                       else {
+                               
+                               srcpad = gst_element_get_static_pad(encodebin->image_queue, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->image_toggle, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, image_link_fail);
+
+                               srcpad = gst_element_get_static_pad(encodebin->image_toggle, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->icapsfilter, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, image_link_fail);          
+
+                               srcpad = gst_element_get_static_pad(encodebin->icapsfilter, "src");
+                               sinkpad = gst_element_get_static_pad(encodebin->image_encode, "sink");
+                               _GST_PAD_LINK_UNREF(srcpad, sinkpad, image_link_fail);                                  
+
+                       }
+                       srcpad =  gst_element_get_static_pad (encodebin->image_encode, "src");
+                       if(gst_ghost_pad_get_target(GST_GHOST_PAD (encodebin->srcpad)) != srcpad)
+                               gst_ghost_pad_set_target(GST_GHOST_PAD (encodebin->srcpad), srcpad);
+                       gst_object_unref(srcpad);
+                       srcpad = NULL;
+                       break;
+               default:
+                     GST_WARNING_OBJECT(encodebin, "Invalid profile number = %d", encodebin->profile);
+                     return FALSE;
+                     break;
+       }
+//     gst_pad_set_active(encodebin->srcpad, TRUE);    
+       return TRUE;
+
+video_link_fail:
+       // remove elements
+       gst_encode_bin_remove_element(encodebin, encodebin->color_space);
+       GST_WARNING_OBJECT(encodebin, "encodebin link video elements fail");
+       return FALSE;
+       
+audio_link_fail:
+       // remove element 
+       gst_encode_bin_remove_element(encodebin, encodebin->audio_conv);        
+       gst_encode_bin_remove_element(encodebin, encodebin->audio_sample);      
+       GST_WARNING_OBJECT(encodebin, "encodebin link audio elements fail");
+       return FALSE;
+
+image_link_fail:
+       // remove element 
+       gst_encode_bin_remove_element(encodebin, encodebin->color_space);       
+       GST_WARNING_OBJECT(encodebin, "encodebin link image elements fail");
+       return FALSE;
+
+       
+}
+
+static gboolean 
+gst_encode_bin_unlink_elements (GstEncodeBin *encodebin)
+{
+       GstPad *pad = NULL, *muxpad = NULL;
+       
+       switch(encodebin->profile) {
+               case GST_ENCODE_BIN_PROFILE_AV :
+                       if (encodebin->auto_color_space) {
+                               if( encodebin->video_toggle )
+                               {
+                                       gst_element_unlink_many  (
+                                               encodebin->video_queue,
+                                               encodebin->video_toggle,
+                                               encodebin->color_space,
+                                               encodebin->vcapsfilter,                                                         
+                                               encodebin->video_encode,
+                                               //encodebin->video_encode_queue,                                        
+                                               NULL);
+                               }
+                               else
+                               {
+                                       gst_element_unlink_many(
+                                               encodebin->video_queue,
+                                               encodebin->color_space,
+                                               encodebin->vcapsfilter,                                                         
+                                               encodebin->video_encode,
+                                               //encodebin->video_encode_queue,                                        
+                                               NULL);
+                               }
+                       }
+                       else {
+                               if( encodebin->video_toggle )
+                               {
+                                       gst_element_unlink_many  (
+                                               encodebin->video_queue,
+                                               encodebin->video_toggle,
+                                               encodebin->vcapsfilter,                                                         
+                                               encodebin->video_encode,
+                                               //encodebin->video_encode_queue,                                                
+                                               NULL);
+                               }
+                               else
+                               {
+                                       gst_element_unlink_many(
+                                               encodebin->video_queue,
+                                               encodebin->vcapsfilter,                                                         
+                                               encodebin->video_encode,
+                                               //encodebin->video_encode_queue,                                                
+                                               NULL);
+                               }
+                       }
+
+                       if(encodebin->mux_video_sinkpad != NULL)
+                       {
+#if 0                  
+                               if(encodebin->use_venc_queue)
+                               {
+                                       gst_element_unlink(encodebin->video_encode, encodebin->video_encode_queue);
+
+                                       pad = gst_element_get_static_pad (encodebin->video_encode_queue, "src");
+                                       gst_pad_unlink(pad, muxpad);
+                                       gst_object_unref(pad);
+                                       pad = NULL;
+
+                                       if ( g_signal_handler_is_connected ( encodebin->video_encode_queue, encodebin->veque_sig_id) )
+                                       {
+                                               g_signal_handler_disconnect (  encodebin->video_encode_queue, encodebin->veque_sig_id );
+                                       }
+                               }
+#else
+                               if(encodebin->video_encode_queue)
+                               {
+                                       gst_element_unlink(encodebin->video_encode, encodebin->video_encode_queue);
+
+                                       pad = gst_element_get_static_pad (encodebin->video_encode_queue, "src");
+                                       gst_pad_unlink(pad, encodebin->mux_video_sinkpad);
+                                       gst_object_unref(pad);
+                                       pad = NULL;
+
+                                       if ( g_signal_handler_is_connected ( encodebin->video_encode_queue, encodebin->veque_sig_id) )
+                                       {
+                                               g_signal_handler_disconnect (  encodebin->video_encode_queue, encodebin->veque_sig_id );
+                                       }
+                               }
+#endif
+                               else
+                               {
+                                       pad = gst_element_get_static_pad (encodebin->video_encode, "src");
+                                       gst_pad_unlink(pad, encodebin->mux_video_sinkpad);
+                                       gst_object_unref(pad);
+                                       pad = NULL;
+                               }
+
+                               gst_element_release_request_pad(encodebin->mux, encodebin->mux_video_sinkpad);
+//                             gst_object_unref(encodebin->mux_video_sinkpad); //***
+                               encodebin->mux_video_sinkpad = NULL;
+                       }
+
+                       if(encodebin->vsink_probeid)
+                       {
+                               pad = gst_element_get_static_pad (encodebin->video_queue, "sink");
+                               gst_pad_remove_buffer_probe(pad, encodebin->vsink_probeid);
+                               encodebin->vsink_probeid = 0;
+                               gst_object_unref(pad);
+                               pad = NULL;                                     
+                       }
+               
+
+                       if(encodebin->vsink_hs_probeid)
+                       {
+                               pad = gst_element_get_static_pad (encodebin->video_encode, "sink");
+                               gst_pad_remove_buffer_probe(pad, encodebin->vsink_hs_probeid);
+                               encodebin->vsink_hs_probeid = 0;
+                               gst_object_unref(pad);
+                               pad = NULL;
+                       }
+
+                       if(encodebin->audio_queue == NULL)
+                       {
+                               break;
+                       }
+               case GST_ENCODE_BIN_PROFILE_AUDIO :
+                       if (encodebin->auto_audio_convert ||encodebin->auto_audio_resample) {
+                               if (!encodebin->auto_audio_convert) {
+                                               gst_element_unlink_many  (
+                                                       encodebin->audio_queue,
+                                                       encodebin->audio_sample,
+                                                       encodebin->acapsfilter,
+                                                       encodebin->audio_encode,
+                                                       NULL);  
+                               } else if (!encodebin->auto_audio_resample) {
+                                               gst_element_unlink_many  (
+                                                       encodebin->audio_queue,
+                                                       encodebin->audio_conv,                                  
+                                                       encodebin->acapsfilter,
+                                                       encodebin->audio_encode,
+                                                       NULL);  
+                               } else {
+                                               gst_element_unlink_many  (
+                                                       encodebin->audio_queue,
+                                                       encodebin->audio_conv,
+                                                       encodebin->audio_sample,                                                                                
+                                                       encodebin->acapsfilter,
+                                                       encodebin->audio_encode,
+                                                       NULL);                                  
+                               }
+                       }
+                       else {
+                               gst_element_unlink_many  (
+                                       encodebin->audio_queue,
+                                       encodebin->acapsfilter,
+                                       encodebin->audio_encode,
+                                       NULL);  
+                       }
+
+                       if(encodebin->mux_audio_sinkpad != NULL)
+                       {
+#if 0                  
+                               if(encodebin->use_aenc_queue)
+                               {
+                                       gst_element_unlink(encodebin->audio_encode, encodebin->audio_encode_queue);
+
+                                       pad = gst_element_get_static_pad (encodebin->audio_encode_queue, "src");
+                                       gst_pad_unlink(pad, muxpad);
+                                       gst_object_unref(pad);
+                                       pad = NULL;     
+
+                                       if ( g_signal_handler_is_connected ( encodebin->audio_encode_queue, encodebin->veque_sig_id) )
+                                       {
+                                               g_signal_handler_disconnect (  encodebin->audio_encode_queue, encodebin->veque_sig_id );
+                                       }                                       
+                               }
+#else
+                               if(encodebin->audio_encode_queue)
+                               {
+                                       gst_element_unlink(encodebin->audio_encode, encodebin->audio_encode_queue);
+
+                                       pad = gst_element_get_static_pad (encodebin->audio_encode_queue, "src");
+                                       gst_pad_unlink(pad, encodebin->mux_audio_sinkpad);
+                                       gst_object_unref(pad);
+                                       pad = NULL;     
+
+                                       if ( g_signal_handler_is_connected ( encodebin->audio_encode_queue, encodebin->veque_sig_id) )
+                                       {
+                                               g_signal_handler_disconnect (  encodebin->audio_encode_queue, encodebin->veque_sig_id );
+                                       }                                       
+                               }
+#endif
+                               else
+                               {
+                                       pad = gst_element_get_static_pad (encodebin->audio_encode, "src");
+                                       gst_pad_unlink(pad, encodebin->mux_audio_sinkpad);
+                                       gst_object_unref(pad);
+                                       pad = NULL;
+                               }                       
+
+                               gst_element_release_request_pad(encodebin->mux, encodebin->mux_audio_sinkpad);
+//                             gst_object_unref(encodebin->mux_audio_sinkpad);         //***
+                               encodebin->mux_audio_sinkpad = NULL;
+                       }
+
+                       if(encodebin->asink_probeid)
+                       {
+                               pad = gst_element_get_static_pad (encodebin->audio_queue, "sink"); 
+                               gst_pad_remove_buffer_probe(pad, encodebin->asink_probeid);
+                               encodebin->asink_probeid =0;
+                               gst_object_unref(pad);
+                               pad = NULL;
+                       }
+
+                       break;
+               case GST_ENCODE_BIN_PROFILE_IMAGE :
+                       if (encodebin->auto_color_space) {
+                               gst_element_unlink_many  (
+                                       encodebin->image_queue,
+                                       encodebin->image_toggle,
+                                       encodebin->color_space,
+                                       encodebin->icapsfilter,                                                         
+                                       encodebin->image_encode,
+                                       NULL);
+                       }
+                       else {
+                               gst_element_unlink_many  (
+                                       encodebin->image_queue,
+                                       encodebin->image_toggle,        
+                                       encodebin->icapsfilter,                                                                                                                         
+                                       encodebin->image_encode,
+                                       NULL);  
+                       }
+                       break;
+               default:
+                         GST_WARNING_OBJECT(encodebin, "Invalid profile number = %d", encodebin->profile);
+                         return FALSE;
+                 break;
+       }
+       //      gst_pad_set_active(encodebin->srcpad, TRUE);    
+       return TRUE;
+
+}
+
+static gboolean 
+gst_encode_bin_init_video_elements (GstElement *element, gpointer user_data)
+{
+       GstEncodeBin *encodebin = GST_ENCODE_BIN (element);
+
+       if(encodebin->profile != GST_ENCODE_BIN_PROFILE_AV)
+               return FALSE;
+
+       if(encodebin->video_queue == NULL) {
+               encodebin->video_queue = gst_element_factory_make ("queue","video_queue");
+               gst_bin_add (GST_BIN (element), encodebin->video_queue);
+       }
+
+       if( encodebin->use_video_toggle )
+       {
+               if( encodebin->video_toggle == NULL )
+               {
+                       encodebin->video_toggle = gst_element_factory_make ("toggle","video_toggle");
+                       gst_bin_add (GST_BIN (element), encodebin->video_toggle);
+               }
+               GST_INFO_OBJECT( encodebin, "Video toggle is Enabled" );
+       }
+       else
+       {
+               GST_INFO_OBJECT( encodebin, "Video toggle is Disabled" );
+       }
+
+       if(encodebin->vcapsfilter == NULL) {
+               encodebin->vcapsfilter = gst_element_factory_make ("capsfilter","vcapsfilter");
+               gst_bin_add (GST_BIN (element), encodebin->vcapsfilter);
+       }  
+#if 0
+       encodebin->vcaps = gst_caps_new_simple("video/x-raw-yuv",
+               "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
+               "width", G_TYPE_INT, 320,
+               "height", G_TYPE_INT, 240,
+               "framerate", GST_TYPE_FRACTION, 30, 1,
+               NULL);  
+
+#endif
+       if(encodebin->video_encode == NULL) {
+               encodebin->video_encode = gst_element_factory_make (encodebin->venc_name, "video_encode");
+               gst_bin_add (GST_BIN (element), encodebin->video_encode);
+       }
+
+#if 0
+       if(encodebin->video_encode_queue == NULL) {
+               encodebin->video_encode_queue = gst_element_factory_make ("queue", "video_encode_queue");
+               gst_bin_add (GST_BIN (element), encodebin->video_encode_queue);
+       }
+
+       g_object_set(G_OBJECT(encodebin->video_encode_queue), "max-size-bytes", (unsigned int)0, NULL);
+#endif
+
+       if(encodebin->mux == NULL) {
+               encodebin->mux = gst_element_factory_make (encodebin->mux_name, "mux");
+               gst_bin_add (GST_BIN (element), encodebin->mux);
+       }
+
+       if (!encodebin->video_encode 
+//             || !encodebin->video_encode_queue 
+               || !encodebin->mux 
+               || !encodebin->video_queue 
+               || !encodebin->vcapsfilter
+               || !encodebin->srcpad )
+       {
+               GST_ERROR_OBJECT(encodebin, "Faild create element \n");
+               return FALSE;
+       }
+       
+       if( encodebin->use_video_toggle && !encodebin->video_toggle )
+       {
+               GST_ERROR_OBJECT(encodebin, "Faild create video toggle element \n");
+               return FALSE;
+       }
+
+#if 0  
+  if (encodebin->auto_color_space && (encodebin->color_space == NULL)) {
+       encodebin->color_space = gst_element_factory_make ("ffmpegcolorspace","color_space");
+      gst_bin_add (GST_BIN (element), encodebin->color_space);
+   }  
+#endif  
+  return TRUE;
+}
+
+static gboolean 
+gst_encode_bin_init_audio_elements (GstElement *element, gpointer user_data)
+{
+       GstEncodeBin *encodebin = GST_ENCODE_BIN (element);
+
+       if(encodebin->profile > GST_ENCODE_BIN_PROFILE_AUDIO)
+               return FALSE;
+
+       if(encodebin->audio_queue == NULL) {
+               encodebin->audio_queue = gst_element_factory_make ("queue","audio_queue");
+               gst_bin_add (GST_BIN (element), encodebin->audio_queue);
+       }
+
+       if(encodebin->acapsfilter == NULL) {
+               encodebin->acapsfilter = gst_element_factory_make ("capsfilter","acapsfilter");
+               gst_bin_add (GST_BIN (element), encodebin->acapsfilter);
+       }    
+#if 0
+encodebin->acaps = gst_caps_new_simple("audio/x-raw-int",
+       "rate", G_TYPE_INT, 8000,
+       "channels", G_TYPE_INT, 2,
+       "depth", G_TYPE_INT, 16,
+       NULL);
+#endif
+
+       if(encodebin->audio_encode == NULL) {
+               encodebin->audio_encode = gst_element_factory_make (encodebin->aenc_name, "audio_encode");
+               gst_bin_add (GST_BIN (element), encodebin->audio_encode);
+       }
+
+       if(encodebin->mux == NULL) {
+               encodebin->mux = gst_element_factory_make (encodebin->mux_name, "mux");
+               gst_bin_add (GST_BIN (element), encodebin->mux);
+       }
+
+       if (!encodebin->audio_encode 
+               || !encodebin->audio_queue
+               || !encodebin->mux
+               || !encodebin->acapsfilter      
+               || !encodebin->srcpad )
+       {
+               GST_ERROR_OBJECT(encodebin, "Faild create element \n");
+               return FALSE;
+       }
+#if 0
+       if (encodebin->auto_audio_convert && (encodebin->audio_conv == NULL)) {
+               encodebin->audio_conv = gst_element_factory_make ("audioconvert","audio_conv");
+               gst_bin_add (GST_BIN (element), encodebin->audio_conv);
+       } 
+
+       if (encodebin->auto_audio_resample && (encodebin->audio_sample == NULL)) {
+               encodebin->audio_sample = gst_element_factory_make ("audioresample","audio_sample");
+               gst_bin_add (GST_BIN (element), encodebin->audio_sample);
+       } 
+#endif
+       return TRUE;
+}
+
+
+static gboolean 
+gst_encode_bin_init_image_elements (GstElement *element, gpointer user_data)
+{
+       GstEncodeBin *encodebin = GST_ENCODE_BIN (element);
+
+       if(encodebin->profile < GST_ENCODE_BIN_PROFILE_IMAGE)
+               return FALSE;
+
+       if(encodebin->image_queue == NULL) {
+               encodebin->image_queue = gst_element_factory_make ("queue","image_queue");
+               gst_bin_add (GST_BIN (element), encodebin->image_queue);
+       }
+
+       if(encodebin->image_toggle == NULL) {
+               encodebin->image_toggle = gst_element_factory_make ("toggle","image_toggle");
+               gst_bin_add (GST_BIN (element), encodebin->image_toggle);
+       }
+
+       if(encodebin->icapsfilter == NULL) {
+               encodebin->icapsfilter = gst_element_factory_make ("capsfilter","icapsfilter");
+               gst_bin_add (GST_BIN (element), encodebin->icapsfilter);
+       }  
+
+       if(encodebin->image_encode == NULL) {
+               encodebin->image_encode = gst_element_factory_make (encodebin->ienc_name, "image_encode");
+               gst_bin_add (GST_BIN (element), encodebin->image_encode);
+       }  
+
+       if (!encodebin->image_encode 
+               || !encodebin->image_queue
+               || !encodebin->image_toggle
+               || !encodebin->icapsfilter
+               || !encodebin->srcpad )
+       {
+               GST_ERROR_OBJECT(encodebin, "Faild create element \n");
+               return FALSE;
+       }
+#if 0
+       if (encodebin->auto_color_space && (encodebin->color_space == NULL)) {
+               encodebin->color_space = gst_element_factory_make ("ffmpegcolorspace","color_space");
+               gst_bin_add (GST_BIN (element), encodebin->color_space);
+       }  
+#endif
+       return TRUE;
+}
+
+static gboolean gst_encode_bin_block(GstEncodeBin *encodebin, gboolean value)
+{
+  
+       if(value) { //block stream
+               switch(encodebin->profile) {
+                       case GST_ENCODE_BIN_PROFILE_AV:
+                               if(encodebin->audio_queue == NULL && encodebin->video_queue == NULL) {
+                                       goto block_fail;
+                               } else {
+                                       if(g_object_class_find_property(G_OBJECT_GET_CLASS(GST_OBJECT(encodebin->video_queue)), 
+                                               "empty-buffers") == NULL) {
+                                               GST_ERROR_OBJECT(encodebin, "The queue element doesn't support 'empty-buffers' property");
+                                               goto block_fail;
+                                       }
+                                       if( encodebin->video_toggle )
+                                       {
+                                               g_object_set(encodebin->video_toggle, "block-data", TRUE , NULL);
+                                               GST_INFO_OBJECT( encodebin, "video_toggle block-data TRUE" );
+                                       }
+                                       
+                                       g_object_set(encodebin->video_queue, "empty-buffers", TRUE , NULL);
+                                       GST_INFO_OBJECT( encodebin, "video_queue empty-buffers TRUE" );
+                                       if(encodebin->audio_queue != NULL)
+                                       {
+                                               g_object_set(encodebin->audio_queue, "empty-buffers", TRUE , NULL);
+                                               GST_INFO_OBJECT( encodebin, "audio_queue empty-buffers TRUE" );
+                                       }
+                               }
+                               break;
+                       case GST_ENCODE_BIN_PROFILE_AUDIO:
+                               if(encodebin->audio_queue == NULL) {
+                                       goto block_fail;                                        
+                               } else {
+                                       if(g_object_class_find_property(G_OBJECT_GET_CLASS(GST_OBJECT(encodebin->audio_queue)), 
+                                               "empty-buffers") == NULL) {
+                                               GST_ERROR_OBJECT(encodebin, "The queue element doesn't support 'empty-buffers' property");
+                                               goto block_fail;
+                                       }                               
+                                       g_object_set(encodebin->audio_queue, "empty-buffers", TRUE , NULL);
+                                       GST_INFO_OBJECT( encodebin, "audio_queue empty-buffers TRUE" );
+                               }
+                               break;
+                       case GST_ENCODE_BIN_PROFILE_IMAGE:
+                               if(encodebin->image_toggle == NULL) {
+                                       goto block_fail;
+                               } else {
+                                       g_object_set(encodebin->image_toggle, "block_data", TRUE, NULL);
+                                       GST_INFO_OBJECT( encodebin, "image_toggle block_data TRUE" );
+                               }
+                               break;   
+                       default:
+                               GST_WARNING_OBJECT (encodebin,"Invalid profile number = %d", encodebin->profile);
+                               goto block_fail;
+                               break;    
+               }
+       } else { //release blocked-stream
+               switch(encodebin->profile) {
+                       case GST_ENCODE_BIN_PROFILE_AV:
+                               if(encodebin->audio_queue == NULL && encodebin->video_queue == NULL) {
+                                       goto unblock_fail;
+                               } else {
+                                       if(g_object_class_find_property(G_OBJECT_GET_CLASS(GST_OBJECT(encodebin->video_queue)), 
+                                               "empty-buffers") == NULL) {
+                                               GST_ERROR_OBJECT(encodebin, "The queue element doesn't support 'empty-buffers' property");
+                                               goto unblock_fail;
+                                       }                               
+                                       if( encodebin->video_toggle )
+                                       {
+                                               g_object_set(encodebin->video_toggle, "block-data", FALSE , NULL);
+                                               GST_INFO_OBJECT( encodebin, "video_toggle block-data FALSE" );
+                                       }
+                                       
+                                       if(encodebin->audio_queue != NULL)
+                                       {                                       
+                                               g_object_set(encodebin->audio_queue, "empty-buffers", FALSE , NULL);
+                                               GST_INFO_OBJECT( encodebin, "audio_queue empty-buffers FALSE" );
+                                       }
+                                       g_object_set(encodebin->video_queue, "empty-buffers", FALSE , NULL);
+                                       GST_INFO_OBJECT( encodebin, "video_queue empty-buffers FALSE" );
+                               }
+                               break;
+                       case GST_ENCODE_BIN_PROFILE_AUDIO:
+                               if(encodebin->audio_queue == NULL) {
+                                       goto unblock_fail;                                      
+                               } else {                
+                                       if(g_object_class_find_property(G_OBJECT_GET_CLASS(GST_OBJECT(encodebin->audio_queue)), 
+                                               "empty-buffers") == NULL) {
+                                               GST_ERROR_OBJECT(encodebin, "The queue element doesn't support 'empty-buffers' property");
+                                               goto unblock_fail;
+                                       }                               
+                                       g_object_set(encodebin->audio_queue, "empty-buffers", FALSE , NULL);
+                                       GST_INFO_OBJECT( encodebin, "audio_queue empty-buffers FALSE" );
+                               }
+                               break;
+                       case GST_ENCODE_BIN_PROFILE_IMAGE:
+                               if(encodebin->image_toggle == NULL) {
+                                       goto unblock_fail;
+                               } else {                                
+                                       g_object_set(encodebin->image_toggle, "block_data", FALSE, NULL);
+                                       GST_INFO_OBJECT( encodebin, "image_toggle block_data FALSE" );
+                               }
+                               break;   
+                       default:
+                               GST_WARNING_OBJECT (encodebin,"Invalid profile number = %d", encodebin->profile);
+                               goto unblock_fail;
+                               break;    
+               }       
+       }
+       encodebin->block = value;
+       return TRUE;
+
+block_fail:
+       GST_ERROR_OBJECT(encodebin, "encodebin block failed");
+       return FALSE;
+       
+unblock_fail:  
+       GST_ERROR_OBJECT(encodebin, "encodebin unblock failed");        
+       return FALSE;  
+}
+
+static gboolean gst_encode_bin_pause(GstEncodeBin *encodebin, gboolean value)
+{
+       GstClock *clock = NULL;
+
+       if(value) { 
+               /* pause stream*/
+               //Block src of encode bin
+               if (!gst_encode_bin_block(encodebin, TRUE))
+               {
+                       GST_WARNING_OBJECT (encodebin, "Fail to block Encodebin.");
+                       goto pause_fail;
+               }
+
+               if (encodebin->paused_time == 0)
+               {
+                       //get steam time
+                       if (clock = GST_ELEMENT_CLOCK(encodebin))               //before PLAYING, this would be NULL. Need to check.
+                       {
+                               GstClockTime current_time, base_time;
+
+                               current_time = gst_clock_get_time(clock);
+                               base_time = gst_element_get_base_time(GST_ELEMENT(encodebin));
+
+                               encodebin->paused_time = current_time - base_time;
+                               
+                               GST_INFO_OBJECT (encodebin, "Encodebin is in running-pause at [%"GST_TIME_FORMAT"]."
+                                       , GST_TIME_ARGS(encodebin->paused_time));
+                       }
+                       else
+                       {
+                               encodebin->paused_time = 0;
+                               encodebin->total_offset_time = 0;
+                               
+                               GST_WARNING_OBJECT (encodebin, "There is no clock in Encodebin.");
+                       }
+               }
+#if 0 //def GST_ENCODE_BIN_SIGNAL_ENABLE               
+               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_PAUSE], 0, TRUE);
+#endif         
+       }
+       else { 
+               /* release paused-stream*/
+               if (encodebin->paused_time != 0)
+               {
+                       if (clock = GST_ELEMENT_CLOCK(encodebin))
+                       {
+                               GstClockTime current_time, base_time;
+                               GstClockTime paused_gap;
+
+                               current_time = gst_clock_get_time(clock);
+                               base_time = gst_element_get_base_time(GST_ELEMENT(encodebin));
+                               paused_gap = current_time - base_time - encodebin->paused_time;
+                               
+                               encodebin->total_offset_time += paused_gap;
+                               encodebin->paused_time = 0;
+                               
+                               GST_INFO_OBJECT (encodebin, "Encodebin now resumes. Offset delay [%"GST_TIME_FORMAT"], Total offset delay [%"GST_TIME_FORMAT"]"
+                                       , GST_TIME_ARGS(paused_gap) , GST_TIME_ARGS(encodebin->total_offset_time));
+                       }
+                       else
+                       {
+                               encodebin->paused_time = 0;
+                               encodebin->total_offset_time = 0;
+                               
+                               GST_WARNING_OBJECT (encodebin, "There is no clock in Encodebin.");
+                       }
+               }
+
+               //TODO : How about qos?
+
+               //Unblock src of encode bin
+               if (!gst_encode_bin_block(encodebin, FALSE))
+               {
+                       GST_WARNING_OBJECT (encodebin, "Fail to Unblock Encodebin.");
+                       goto resume_fail;
+               }
+#if 0 //def GST_ENCODE_BIN_SIGNAL_ENABLE               
+               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_RESUME], 0, TRUE);
+#endif         
+       }
+       encodebin->pause = value;
+       return TRUE;
+
+pause_fail:
+       GST_WARNING_OBJECT (encodebin, "Fail to pause Encodebin");
+#ifdef GST_ENCODE_BIN_SIGNAL_ENABLE            
+               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_PAUSE], 0, FALSE);
+#endif 
+       return FALSE;
+
+resume_fail:   
+       GST_WARNING_OBJECT (encodebin, "Fail to resume Encodebin");
+#ifdef GST_ENCODE_BIN_SIGNAL_ENABLE            
+               g_signal_emit (G_OBJECT (encodebin), gst_encode_bin_signals[SIGNAL_STREAM_RESUME], 0, FALSE);
+#endif         
+       return FALSE;   
+}
+
+static gboolean
+gst_encode_bin_release_pipeline (GstElement *element,
+      gpointer user_data)
+{
+#if 0
+  GstEncodeBin *encodebin = GST_ENCODE_BIN (element);
+
+  gst_element_set_state (encodebin->audio_queue, GST_STATE_NULL);
+  gst_element_set_state (encodebin->audio_encode, GST_STATE_NULL);
+  gst_element_set_state (encodebin->video_queue, GST_STATE_NULL);
+  gst_element_set_state (encodebin->video_encode, GST_STATE_NULL);
+  gst_element_set_state (encodebin->mux, GST_STATE_NULL);
+
+  if (encodebin->auto_video_scale) {
+    gst_element_set_state (encodebin->video_scale, GST_STATE_NULL);
+    gst_element_unlink (encodebin->video_queue, encodebin->video_scale);
+    gst_element_unlink (encodebin->video_scale, encodebin->video_encode);
+    gst_bin_remove (GST_BIN (element), encodebin->video_scale);
+
+    encodebin->video_scale = NULL;
+  } else {
+    gst_element_unlink (encodebin->video_queue, encodebin->video_encode);
+  }
+
+  gst_pad_unlink (gst_element_get_pad (encodebin->audio_encode, "src"), 
+                       encodebin->mux_audio_sinkpad);
+  gst_pad_unlink (gst_element_get_pad (encodebin->video_encode, "src"), 
+                       encodebin->mux_video_sinkpad);
+
+  gst_bin_remove_many (GST_BIN (element),
+                               encodebin->audio_queue,
+                               encodebin->audio_encode,
+                               encodebin->video_queue,
+                               encodebin->video_encode,
+                               encodebin->mux,
+                               NULL);
+
+  encodebin->audio_queue = NULL;
+  encodebin->audio_encode = NULL;
+  encodebin->video_queue = NULL;
+  encodebin->video_encode = NULL;
+  encodebin->mux = NULL;
+#endif
+  return TRUE;
+}
+
+static gboolean
+gst_encode_bin_audsink_set_caps (GstPad * pad, GstCaps * vscaps)
+{
+       GstEncodeBin *encodebin;
+       GstStructure *structure;
+//     const gchar *mimetype;
+//     const GValue *codec_data;
+       gint channels, rate;
+
+       encodebin = GST_ENCODE_BIN (gst_pad_get_parent (pad));  
+
+       structure = gst_caps_get_structure (vscaps, 0);
+//     mimetype = gst_structure_get_name (structure);
+
+       /* we want these for all */
+       if (!gst_structure_get_int (structure, "channels", &channels) ||
+               !gst_structure_get_int (structure, "rate", &rate)) {
+                       goto refuse_caps;
+       }
+
+//     codec_data = gst_structure_get_value (structure, "codec_data");
+       /* FIXME */
+       //  g_return_val_if_fail (!strcmp (mimetype, "audio/x-raw-int"), FALSE);
+       gst_object_unref (encodebin);
+       return TRUE;
+
+refuse_caps:
+       {
+               GST_WARNING_OBJECT (encodebin, "refused caps %" GST_PTR_FORMAT, vscaps);
+               gst_object_unref (encodebin);
+               return FALSE;
+       }
+}
+
+static gboolean
+gst_encode_bin_vidsink_set_caps (GstPad * pad, GstCaps * vscaps)
+{
+       GstEncodeBin *encodebin;
+       GstStructure *structure;
+//     const gchar *mimetype;
+       const GValue *fps;
+//     const GValue *codec_data;
+       gint width, height;
+
+       encodebin = GST_ENCODE_BIN (gst_pad_get_parent (pad));
+
+       structure = gst_caps_get_structure (vscaps, 0);
+//     mimetype = gst_structure_get_name (structure);
+
+       if (!gst_structure_get_int (structure, "width", &width) ||
+               !gst_structure_get_int (structure, "height", &height)) {
+                       goto refuse_caps;
+       }
+
+//     codec_data = gst_structure_get_value (structure, "codec_data");
+
+       fps = gst_structure_get_value (structure, "framerate");
+       if (fps == NULL)
+               goto refuse_caps;
+
+       encodebin->fps = gst_value_get_fraction_numerator(fps);
+
+       if(encodebin->high_speed_fps > 0)
+       {
+               encodebin->multiple =(encodebin->high_speed_fps)/(encodebin->fps);
+       }
+       
+       {
+               guint32 format;
+
+               gst_structure_get_fourcc (structure, "format", &format);
+
+               switch (format) {
+                       case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
+                               break;
+                       case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+                               break;
+               }
+       }
+/* FIXME */
+//  g_return_val_if_fail (!strcmp (mimetype, "video/x-raw-yuv"), FALSE);
+
+#if 0
+       switch (encodebin->profile) {
+       case GST_ENCODE_BIN_PROFILE_3GP:
+       //   need_videoscale
+               break;
+       case GST_ENCODE_BIN_PROFILE_MP4:
+               break;
+       default :
+               break;
+       }
+#endif
+       gst_object_unref (encodebin);
+       return TRUE;
+
+refuse_caps:
+       {
+               GST_WARNING_OBJECT (encodebin, "refused caps %" GST_PTR_FORMAT, vscaps);
+               gst_object_unref (encodebin);
+               return FALSE;
+       }
+}
+
+static gboolean gst_encode_bin_imgsink_set_caps (GstPad * pad, GstCaps * vscaps)
+{
+       GstEncodeBin *encodebin;
+       GstStructure *structure;
+//     const gchar *mimetype;
+//     const GValue *codec_data;
+       gint width, height;
+
+       encodebin = GST_ENCODE_BIN (gst_pad_get_parent (pad));
+
+       structure = gst_caps_get_structure (vscaps, 0);
+//     mimetype = gst_structure_get_name (structure);
+
+       if (!gst_structure_get_int (structure, "width", &width) ||
+               !gst_structure_get_int (structure, "height", &height)) {
+                       goto refuse_caps;
+       }
+
+//     codec_data = gst_structure_get_value (structure, "codec_data");
+
+       {
+               guint32 format;
+
+               gst_structure_get_fourcc (structure, "format", &format);
+
+               switch (format) {
+                       case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
+                               break;
+                       case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+                               break;
+               }
+       }
+       gst_object_unref (encodebin);   
+       return TRUE;
+       
+refuse_caps:
+       {
+               GST_WARNING_OBJECT (encodebin, "refused caps %" GST_PTR_FORMAT, vscaps);
+               gst_object_unref (encodebin);
+               return FALSE;
+       }  
+
+}
+
+static gboolean
+gst_encode_bin_video_probe(GstPad *pad, GstBuffer *buffer, GstEncodeBin *encodebin)
+{
+       if (!encodebin)
+       {
+               GST_WARNING_OBJECT (encodebin, "encodebin is Null.");
+               return TRUE;
+       }
+       
+       //Adjusting timestamp of video source
+       GST_BUFFER_TIMESTAMP(buffer) -= encodebin->total_offset_time;
+
+       return TRUE;
+}
+
+static gboolean
+gst_encode_bin_video_probe_hs(GstPad *pad, GstBuffer *buffer, GstEncodeBin *encodebin)
+{
+       if (!encodebin)
+       {
+               GST_WARNING_OBJECT (encodebin, "encodebin is Null.");
+               return TRUE;
+       }
+       
+       GST_BUFFER_TIMESTAMP(buffer)    *= encodebin->multiple;
+       return TRUE;
+}
+
+static gboolean
+gst_encode_bin_audio_probe(GstPad *pad, GstBuffer *buffer, GstEncodeBin *encodebin)
+{
+       if (!encodebin)
+       {
+               GST_WARNING_OBJECT (encodebin, "encodebin is Null.");
+               return TRUE;
+       }
+       
+       //Adjusting timestamp of video source
+       GST_BUFFER_TIMESTAMP(buffer) -= encodebin->total_offset_time;
+
+       return TRUE;
+}
+
+static GstPad*
+gst_encode_bin_get_mux_sink_pad(GstElement *mux, GstEncodeBinMuxSinkPad type)
+{
+       GstElementClass *elemclass = NULL;
+       GList *walk = NULL;
+       GstPad *pad = NULL;
+
+       elemclass = GST_ELEMENT_GET_CLASS (mux);
+
+       walk = gst_element_class_get_pad_template_list (elemclass);
+
+       while (walk) {
+               GstPadTemplate *templ;
+
+               templ = (GstPadTemplate *) walk->data;
+               if (GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SINK) {
+                       /* ENHANCE ME: Please add other specific mux's case */
+                       if (((type == ENCODEBIN_MUX_AUDIO_SINK) && strstr(GST_PAD_TEMPLATE_NAME_TEMPLATE (templ), "audio")) ||  //audio, audio_%d,... ex)ffmux_3gp
+                               ((type == ENCODEBIN_MUX_VIDEO_SINK) && strstr(GST_PAD_TEMPLATE_NAME_TEMPLATE (templ), "video")) ||      //video, video_%d,... ex)ffmux_3gp
+                               strstr(GST_PAD_TEMPLATE_NAME_TEMPLATE (templ), "sink")  //sink, sink_%d, wavparse_sink, ... ex)oggmux, wavparse
+                       ) {
+                               g_print("PRINT TEMPLATE(%s)\n", GST_PAD_TEMPLATE_NAME_TEMPLATE (templ));
+                               pad = gst_element_get_request_pad (mux, GST_PAD_TEMPLATE_NAME_TEMPLATE (templ));
+                               break;
+                       }
+               }
+               walk = g_list_next (walk);
+       }
+
+       return pad;
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  GST_DEBUG_CATEGORY_INIT (gst_encode_bin_debug, "encodebin", 0, "encoder bin");
+
+#ifdef ENABLE_NLS
+  GST_DEBUG ("binding text domain %s to locale dir %s", GETTEXT_PACKAGE,
+      LOCALEDIR);
+  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+#endif /* ENABLE_NLS */
+
+  return gst_element_register (plugin, "encodebin", GST_RANK_NONE,
+      GST_TYPE_ENCODE_BIN);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    "encodebin",
+    "EXT encoder bin", 
+    plugin_init, VERSION, "LGPL", "Samsung Electronics Co", "http://www.samsung.com/")
diff --git a/encodebin/src/gstencodebin.h b/encodebin/src/gstencodebin.h
new file mode 100644 (file)
index 0000000..64c3a64
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * GStreamer encodebin
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __GST_ENCODE_BIN_H__
+#define __GST_ENCODE_BIN_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstcollectpads.h>
+#include <gst/riff/riff-ids.h>
+
+G_BEGIN_DECLS
+
+#define GST_CAT_DEFAULT gst_encode_bin_debug
+
+#define GST_TYPE_ENCODE_BIN_PROFILE (gst_encode_bin_profile_get_type())
+GType gst_encode_bin_profile_get_type (void);
+
+#define GST_TYPE_ENCODE_BIN             (gst_encode_bin_get_type())
+#define GST_ENCODE_BIN(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODE_BIN,GstEncodeBin))
+#define GST_ENCODE_BIN_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ENCODE_BIN,GstEncodeBinClass))
+#define GST_IS_ENCODE_BIN(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODE_BIN))
+#define GST_IS_ENCODE_BIN_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ENCODE_BIN))
+
+#define GST_ENCODE_BIN_GET_LOCK(encodebin) (((GstEncodeBin*)encodebin)->mutex)
+#define GST_ENCODE_BIN_LOCK(encodebin)     g_mutex_lock (GST_ENCODE_BIN_GET_LOCK(encodebin))
+#define GST_ENCODE_BIN_UNLOCK(encodebin)   g_mutex_unlock (GST_ENCODE_BIN_GET_LOCK(encodebin))
+
+/* Signal enable */
+#define GST_ENCODE_BIN_SIGNAL_ENABLE
+
+typedef struct _GstEncodeBinPad {
+  GstCollectData *collect;
+
+  gboolean is_video;
+  gboolean connected;
+
+  gchar *tag;
+
+  gst_riff_strh hdr;
+} GstEncodeBinPad;
+
+typedef struct _GstEncodeBin GstEncodeBin;
+typedef struct _GstEncodeBinClass GstEncodeBinClass;
+
+struct _GstEncodeBin
+{
+  GstBin bin;                   /* we extend GstBin */
+
+  GMutex *mutex;
+
+  /* pads */
+  GstPad              *srcpad;
+  GstPad              *video_sinkpad;
+  GstPad              *audio_sinkpad;
+  GstPad              *image_sinkpad;
+  GstPad              *mux_audio_sinkpad;
+  GstPad              *mux_video_sinkpad;
+
+  /* sinkpads, video first */
+  GSList              *sinkpads;
+
+  /* video restricted to 1 pad */
+  guint               video_pads, audio_pads;
+
+  gint         profile;
+  gint         fps;
+  gint         high_speed_fps; 
+  gint         multiple;  
+  gchar                *venc_name;
+  gchar                *aenc_name;
+  gchar                *ienc_name;  
+  gchar                *mux_name;
+
+
+  GstCaps      *vcaps;
+  GstCaps      *acaps;
+  GstCaps      *icaps;
+  
+  gboolean     auto_audio_convert;
+  gboolean     auto_audio_resample;
+  gboolean     auto_color_space;
+  gboolean     block;
+  gboolean     pause;
+  gboolean     use_video_toggle;
+  gboolean     use_venc_queue;
+  gboolean     use_aenc_queue;  
+  
+  GstElement *audio_queue;
+  GstElement *video_queue;  
+  GstElement *video_encode_queue;    
+  GstElement *audio_encode_queue;      
+  GstElement *image_queue;    
+  
+  GstElement *audio_encode;
+  GstElement *video_encode;
+  GstElement *image_encode;  
+
+  GstElement *vcapsfilter;  
+  GstElement *acapsfilter;    
+  GstElement *icapsfilter;      
+  
+  GstElement *video_toggle;
+  GstElement *image_toggle;  
+  GstElement *color_space;  
+  GstElement *audio_conv;  
+  GstElement *audio_sample;
+  
+  GstElement *mux;
+
+  /* pause/resume variables */
+  GstClockTime         paused_time;                    /* pipeline time when pausing */
+  GstClockTime         total_offset_time;              /* delayed time which is due to pause */
+  gulong               vsink_probeid;
+  gulong               vsink_hs_probeid;
+  gulong               asink_probeid;
+  gulong               veque_sig_id;
+  gulong               aeque_sig_id;  
+};
+
+struct _GstEncodeBinClass
+{
+  GstBinClass parent_class;
+
+#ifdef GST_ENCODE_BIN_SIGNAL_ENABLE
+  /* signal we fire when stream block/pause function called */
+  void (*stream_block) (GstElement * element, gboolean result);  
+  void (*stream_unblock) (GstElement * element, gboolean result);  
+  void (*stream_pause) (GstElement * element, gboolean result);
+  void (*stream_resume) (GstElement * element, gboolean result);
+#endif
+
+};
+
+GType gst_encode_bin_get_type (void);
+
+G_END_DECLS
+
+
+#endif /* __GST_ENCODE_BIN_H__ */
diff --git a/evasimagesink/Makefile.am b/evasimagesink/Makefile.am
new file mode 100644 (file)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/evasimagesink/src/Makefile.am b/evasimagesink/src/Makefile.am
new file mode 100644 (file)
index 0000000..8521916
--- /dev/null
@@ -0,0 +1,26 @@
+# Note: plugindir is set in configure
+
+##############################################################################
+# TODO: change libgstevasimagesink.la to something else, e.g. libmysomething.la     #
+##############################################################################
+plugin_LTLIBRARIES = libgstevasimagesink.la
+
+##############################################################################
+# TODO: for the next set of variables, name the prefix if you named the .la, #
+#  e.g. libmysomething.la => libmysomething_la_SOURCES                       #
+#                            libmysomething_la_CFLAGS                        #
+#                            libmysomething_la_LIBADD                        #
+#                            libmysomething_la_LDFLAGS                       #
+##############################################################################
+
+# sources used to compile this plug-in
+libgstevasimagesink_la_SOURCES = gstevasimagesink.c gstevasimagesink.h
+
+# compiler and linker flags used to compile this plugin, set in configure.ac
+libgstevasimagesink_la_CFLAGS = $(GST_CFLAGS) $(GST_VIDEO_CFLAGS) $(EFL_CFLAGS) $(MMTA_CFLAGS)
+libgstevasimagesink_la_LIBADD = $(GST_LIBS) $(GST_VIDEO_LIBS) $(EFL_LIBS) $(MMTA_LIBS)
+libgstevasimagesink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstevasimagesink_la_LIBTOOLFLAGS = --tag=disable-static
+
+# headers we need but don't want installed
+noinst_HEADERS = gstevasimagesink.h
diff --git a/evasimagesink/src/gstevasimagesink.c b/evasimagesink/src/gstevasimagesink.c
new file mode 100644 (file)
index 0000000..d917a60
--- /dev/null
@@ -0,0 +1,634 @@
+/*
+ * evasimagesink
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Sangchul Lee <sc11.lee@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/**
+ * SECTION:element-evasimagesink
+ * Gstreamer Evas Video Sink - draw video on the given Evas Image Object
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <gst/gst.h>
+#include <gst/video/video.h>
+#include <gst/video/gstvideosink.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_X.h>
+
+#include "gstevasimagesink.h"
+
+#define CAP_WIDTH "width"
+#define CAP_HEIGHT "height"
+
+GST_DEBUG_CATEGORY_STATIC (gst_evas_image_sink_debug);
+#define GST_CAT_DEFAULT gst_evas_image_sink_debug
+
+/* Enumerations */
+enum
+{
+       /* FILL ME */
+       LAST_SIGNAL
+};
+
+enum
+{
+       PROP_0,
+       PROP_EVAS_OBJECT,
+       PROP_EVAS_OBJECT_SHOW,
+};
+
+#define COLOR_DEPTH 4
+#define GL_X11_ENGINE "gl_x11"
+#define DO_RENDER_FROM_FIMC 1
+
+GMutex *instance_lock;
+guint instance_lock_count;
+
+static inline gboolean
+is_evas_image_object (Evas_Object *obj)
+{
+       const char *type;
+       if (!obj) {
+               return FALSE;
+       }
+       type = evas_object_type_get (obj);
+       if (!type) {
+               return FALSE;
+       }
+       if (strcmp (type, "image") == 0) {
+               return TRUE;
+       }
+       return FALSE;
+}
+
+/* the capabilities of the inputs.
+ *
+ * BGRx format
+ */
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+               GST_PAD_SINK,
+               GST_PAD_ALWAYS,
+               GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRx));
+
+GST_BOILERPLATE (GstEvasImageSink, gst_evas_image_sink, GstVideoSink, GST_TYPE_VIDEO_SINK);
+
+static void gst_evas_image_sink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void gst_evas_image_sink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static gboolean gst_evas_image_sink_set_caps (GstBaseSink *base_sink, GstCaps *caps);
+static GstFlowReturn gst_evas_image_sink_show_frame (GstVideoSink *video_sink, GstBuffer *buf);
+static gboolean gst_evas_image_sink_event (GstBaseSink *sink, GstEvent *event);
+static GstStateChangeReturn gst_evas_image_sink_change_state (GstElement *element, GstStateChange transition);
+static void evas_image_sink_cb_del_eo (void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void evas_image_sink_cb_resize_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+static void
+gst_evas_image_sink_base_init (gpointer gclass)
+{
+       GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
+
+       gst_element_class_set_details_simple (element_class,
+               "EvasImageSink",
+               "VideoSink",
+               "Video sink element for evas image object",
+               "Wonguk Jeong <wonguk.jeong@samsung.com>");
+
+       gst_element_class_add_pad_template (element_class,
+       gst_static_pad_template_get (&sink_factory));
+}
+
+static void
+gst_evas_image_sink_class_init (GstEvasImageSinkClass *klass)
+{
+       GObjectClass *gobject_class;
+       GstBaseSinkClass *gstbasesink_class;
+       GstVideoSinkClass *gstvideosink_class;
+       GstElementClass *gstelement_class;
+
+       gobject_class = (GObjectClass *) klass;
+       gstbasesink_class = GST_BASE_SINK_CLASS (klass);
+       gstvideosink_class = GST_VIDEO_SINK_CLASS (klass);
+       gstelement_class = (GstElementClass *) klass;
+
+       gobject_class->set_property = gst_evas_image_sink_set_property;
+       gobject_class->get_property = gst_evas_image_sink_get_property;
+
+       g_object_class_install_property (gobject_class, PROP_EVAS_OBJECT,
+               g_param_spec_pointer ("evas-object", "Destination Evas Object", "Destination evas image object", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property (gobject_class, PROP_EVAS_OBJECT_SHOW,
+               g_param_spec_boolean ("visible", "Show Evas Object", "When disabled, evas object does not show", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+       gstvideosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_evas_image_sink_show_frame);
+       gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_evas_image_sink_set_caps);
+       gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_evas_image_sink_event);
+       gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_evas_image_sink_change_state);
+}
+
+static void
+gst_evas_image_sink_fini (gpointer data, GObject *obj)
+{
+       GST_INFO ("enter");
+
+       GstEvasImageSink *esink = GST_EVASIMAGESINK (obj);
+       if (!esink) {
+               return;
+       }
+       if (esink->oldbuf) {
+               gst_buffer_unref (esink->oldbuf);
+       }
+
+       if (esink->eo) {
+               evas_object_image_data_set(esink->eo, NULL);
+       }
+
+       g_mutex_lock (instance_lock);
+       instance_lock_count--;
+       g_mutex_unlock (instance_lock);
+       if (instance_lock_count == 0) {
+               g_mutex_free (instance_lock);
+               instance_lock = NULL;
+       }
+}
+
+static void
+evas_image_sink_cb_pipe (void *data, void *buffer, unsigned int nbyte)
+{
+       GstBuffer *buf;
+       GstEvasImageSink *esink = data;
+       void *img_data;
+
+       if (!data || !buffer) {
+               return;
+       }
+       if (nbyte != sizeof (GstBuffer *)) {
+               return;
+       }
+       if (!esink->eo) {
+               return;
+       }
+       if (GST_STATE(esink) < GST_STATE_PAUSED) {
+               GST_WARNING ("WRONG-STATE(%d) for rendering, skip this frame", GST_STATE(esink));
+               return;
+       }
+
+       memcpy (&buf, buffer, sizeof (GstBuffer *));
+       if (!buf) {
+               GST_ERROR ("There is no buffer");
+               return;
+       }
+       if (esink->present_data_addr == -1) {
+               /* if present_data_addr is -1, we don't use this member variable */
+       } else if (esink->present_data_addr != DO_RENDER_FROM_FIMC) {
+               GST_WARNING ("skip rendering this buffer, present_data_addr:%d, DO_RENDER_FROM_FIMC:%d", esink->present_data_addr, DO_RENDER_FROM_FIMC);
+               return;
+       }
+
+       MMTA_ACUM_ITEM_BEGIN("eavsimagesink _cb_pipe total", FALSE);
+
+       if ( !esink->is_evas_object_size_set && esink->w > 0 && esink->h > 0) {
+                       evas_object_image_size_set (esink->eo, esink->w, esink->h);
+                       GST_DEBUG("evas_object_image_size_set(), width(%d),height(%d)",esink->w,esink->h);
+                       esink->is_evas_object_size_set = TRUE;
+       }
+       if (esink->gl_zerocopy) {
+               img_data = evas_object_image_data_get (esink->eo, EINA_TRUE);
+               if (!img_data || !GST_BUFFER_DATA(buf)) {
+                       GST_WARNING ("Cannot get image data from evas object or cannot get gstbuffer data");
+                       evas_object_image_data_set(esink->eo, img_data);
+               } else {
+                       GST_DEBUG ("img_data(%x), GST_BUFFER_DATA(buf):%x, esink->w(%d),esink->h(%d), esink->eo(%x)",img_data,GST_BUFFER_DATA(buf),esink->w,esink->h,esink->eo);
+                       __ta__("evasimagesink memcpy in _cb_pipe", memcpy (img_data, GST_BUFFER_DATA (buf), esink->w * esink->h * COLOR_DEPTH););
+                       evas_object_image_pixels_dirty_set (esink->eo, 1);
+                       evas_object_image_data_set(esink->eo, img_data);
+               }
+               gst_buffer_unref (buf);
+       } else {
+               GST_DEBUG ("GST_BUFFER_DATA(buf):%x, esink->eo(%x)",GST_BUFFER_DATA(buf),esink->eo);
+               evas_object_image_data_set (esink->eo, GST_BUFFER_DATA (buf));
+               evas_object_image_pixels_dirty_set (esink->eo, 1);
+               if (esink->oldbuf) {
+                       gst_buffer_unref(esink->oldbuf);
+               }
+               esink->oldbuf = buf;
+       }
+
+       MMTA_ACUM_ITEM_END("eavsimagesink _cb_pipe total", FALSE);
+}
+
+static void
+gst_evas_image_sink_init (GstEvasImageSink *esink, GstEvasImageSinkClass *gclass)
+{
+       GST_INFO ("enter");
+
+       esink->eo = NULL;
+       esink->epipe = NULL;
+       esink->object_show = FALSE;
+       esink->gl_zerocopy = FALSE;
+       esink->is_evas_object_size_set = FALSE;
+       esink->present_data_addr = -1;
+
+       if(!instance_lock) {
+               instance_lock = g_mutex_new();
+       }
+       g_mutex_lock (instance_lock);
+       instance_lock_count++;
+       g_mutex_unlock (instance_lock);
+
+       g_object_weak_ref (G_OBJECT (esink), gst_evas_image_sink_fini, NULL);
+}
+
+static void
+evas_image_sink_cb_del_eo (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       GST_INFO ("enter");
+
+       GstEvasImageSink *esink = data;
+       if (!esink) {
+               return;
+       }
+
+       evas_object_event_callback_del (esink->eo, EVAS_CALLBACK_RESIZE, evas_image_sink_cb_resize_event);
+       if (esink->oldbuf) {
+               gst_buffer_unref (esink->oldbuf);
+               esink->oldbuf = NULL;
+       }
+
+       if (esink->eo) {
+               evas_object_image_data_set(esink->eo, NULL);
+               esink->eo = NULL;
+       }
+}
+
+static void
+evas_image_sink_cb_resize_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       int w = 0;
+       int h = 0;
+       GstEvasImageSink *esink = data;
+       if (!esink) {
+               return;
+       }
+
+       evas_object_geometry_get(esink->eo, NULL, NULL, &w, &h);
+       if (!w || !h) {
+               GST_WARNING ("evas object size (w:%d,h:%d) was not set",w,h);
+       } else {
+               evas_object_image_fill_set(esink->eo, 0, 0, w, h);
+               GST_DEBUG ("evas object fill set (w:%d,h:%d)",w,h);
+       }
+}
+
+static int
+evas_image_sink_get_size_from_caps (GstCaps *caps, int *w, int *h)
+{
+       gboolean r;
+       int width, height;
+       GstStructure *s;
+
+       if (!caps || !w || !h) {
+               return -1;
+       }
+       s = gst_caps_get_structure (caps, 0);
+       if (!s) {
+               return -1;
+       }
+
+       r = gst_structure_get_int (s, CAP_WIDTH, &width);
+       if (r == FALSE) {
+               return -1;
+       }
+
+       r = gst_structure_get_int (s, CAP_HEIGHT, &height);
+       if (r == FALSE) {
+               return -1;
+       }
+
+       *w = width;
+       *h = height;
+       return 0;
+}
+
+static gboolean
+is_zerocopy_supported (Evas *e)
+{
+       Eina_List *engines, *l;
+       int cur_id;
+       int id;
+       char *name;
+
+       if (!e) {
+               return FALSE;
+       }
+
+       engines = evas_render_method_list ();
+       if (!engines) {
+               return FALSE;
+       }
+
+       cur_id = evas_output_method_get (e);
+
+       EINA_LIST_FOREACH (engines, l, name) {
+               id = evas_render_method_lookup (name);
+               if (name && id == cur_id) {
+                       if (!strcmp (name, GL_X11_ENGINE)) {
+                               return TRUE;
+                       }
+                       break;
+               }
+       }
+       return FALSE;
+}
+
+static int
+evas_image_sink_event_parse_data (GstEvasImageSink *esink, GstEvent *event)
+{
+       const GstStructure *st;
+       guint st_data_addr = 0;
+       gint st_data_width = 0;
+       gint st_data_height = 0;
+
+       g_return_val_if_fail (event != NULL, FALSE);
+       g_return_val_if_fail (esink != NULL, FALSE);
+
+       if (GST_EVENT_TYPE (event) != GST_EVENT_CUSTOM_DOWNSTREAM_OOB) {
+               GST_WARNING ("it's not a custom downstream oob event");
+               return -1;
+       }
+       st = gst_event_get_structure (event);
+       if (st == NULL || !gst_structure_has_name (st, "GstStructureForCustomEvent")) {
+               GST_WARNING ("structure in a given event is not proper");
+               return -1;
+       }
+       if (!gst_structure_get_uint (st, "data-addr", &st_data_addr)) {
+               GST_WARNING ("parsing data-addr failed");
+               return -1;
+       }
+       esink->present_data_addr = st_data_addr;
+
+       return 0;
+}
+
+static gboolean
+gst_evas_image_sink_event (GstBaseSink *sink, GstEvent *event)
+{
+       GstEvasImageSink *esink = GST_EVASIMAGESINK (sink);
+       GstMessage *msg;
+       gchar *str;
+
+       switch (GST_EVENT_TYPE (event)) {
+               case GST_EVENT_FLUSH_START:
+                       GST_DEBUG ("GST_EVENT_FLUSH_START");
+                       break;
+               case GST_EVENT_FLUSH_STOP:
+                       GST_DEBUG ("GST_EVENT_FLUSH_STOP");
+                       break;
+               case GST_EVENT_EOS:
+                       GST_DEBUG ("GST_EVENT_EOS");
+                       break;
+               case GST_EVENT_CUSTOM_DOWNSTREAM_OOB:
+                       if(!evas_image_sink_event_parse_data(esink, event)) {
+                               GST_DEBUG ("GST_EVENT_CUSTOM_DOWNSTREAM_OOB, present_data_addr:%x",esink->present_data_addr);
+                       } else {
+                               GST_ERROR ("evas_image_sink_event_parse_data() failed");
+                       }
+                       break;
+               default:
+                       break;
+       }
+       if (GST_BASE_SINK_CLASS (parent_class)->event) {
+               return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
+       } else {
+               return TRUE;
+       }
+}
+
+static GstStateChangeReturn
+gst_evas_image_sink_change_state (GstElement *element, GstStateChange transition)
+{
+       GstStateChangeReturn ret_state = GST_STATE_CHANGE_SUCCESS;
+       GstEvasImageSink *esink = NULL;
+       esink = GST_EVASIMAGESINK(element);
+       int ret = 0;
+
+       if(!esink) {
+               GST_ERROR("can not get evasimagesink from element");
+               return GST_STATE_CHANGE_FAILURE;
+       }
+       switch (transition) {
+               case GST_STATE_CHANGE_NULL_TO_READY:
+                       GST_INFO ("*** STATE_CHANGE_NULL_TO_READY ***");
+                       break;
+               case GST_STATE_CHANGE_READY_TO_PAUSED:
+                       GST_INFO ("*** STATE_CHANGE_READY_TO_PAUSED ***");
+                       break;
+               case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+                       GST_INFO ("*** STATE_CHANGE_PAUSED_TO_PLAYING ***");
+                       break;
+               default:
+                       break;
+       }
+
+       ret_state = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+       switch (transition) {
+               case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+                       GST_INFO ("*** STATE_CHANGE_PLAYING_TO_PAUSED ***");
+                       break;
+               case GST_STATE_CHANGE_PAUSED_TO_READY:
+                       GST_INFO ("*** STATE_CHANGE_PAUSED_TO_READY ***");
+                       break;
+               case GST_STATE_CHANGE_READY_TO_NULL:
+                       GST_INFO ("*** STATE_CHANGE_READY_TO_NULL ***");
+                       if (esink->eo) {
+                               evas_object_event_callback_del(esink->eo, EVAS_CALLBACK_DEL, evas_image_sink_cb_del_eo);
+                               evas_object_event_callback_del(esink->eo, EVAS_CALLBACK_RESIZE, evas_image_sink_cb_resize_event);
+                       }
+                       if (esink->epipe) {
+                               ecore_pipe_del (esink->epipe);
+                               esink->epipe = NULL;
+                       }
+                       break;
+               default:
+                       break;
+       }
+
+       return ret_state;
+}
+
+static void
+gst_evas_image_sink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+       GstEvasImageSink *esink = GST_EVASIMAGESINK (object);
+       Evas_Object *eo;
+
+       g_mutex_lock (instance_lock);
+
+       switch (prop_id) {
+       case PROP_EVAS_OBJECT:
+               eo = g_value_get_pointer (value);
+               if (is_evas_image_object (eo)) {
+                       if (eo != esink->eo) {
+                               /* delete evas object callbacks registrated on a former evas image object */
+                               evas_object_event_callback_del (esink->eo, EVAS_CALLBACK_DEL, evas_image_sink_cb_del_eo);
+                               evas_object_event_callback_del (esink->eo, EVAS_CALLBACK_RESIZE, evas_image_sink_cb_resize_event);
+
+                               esink->eo = eo;
+
+                               /* add evas object callbacks on a new evas image object */
+                               evas_object_event_callback_add (esink->eo, EVAS_CALLBACK_DEL, evas_image_sink_cb_del_eo, esink);
+                               evas_object_event_callback_add (esink->eo, EVAS_CALLBACK_RESIZE, evas_image_sink_cb_resize_event, esink);
+
+                               esink->gl_zerocopy = is_zerocopy_supported (evas_object_evas_get (eo));
+                               if (esink->gl_zerocopy) {
+                                       evas_object_image_content_hint_set (esink->eo, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
+                                       GST_DEBUG("Enable gl zerocopy");
+                               }
+                               GST_DEBUG("Evas Image Object(%x) is set",esink->eo);
+                               evas_object_show(esink->eo);
+                               esink->object_show = TRUE;
+                               esink->is_evas_object_size_set = FALSE;
+                       }
+               } else {
+                       GST_ERROR ("Cannot set evas-object property: value is not an evas image object");
+               }
+               break;
+
+       case PROP_EVAS_OBJECT_SHOW:
+               esink->object_show = g_value_get_boolean (value);
+               if( !is_evas_image_object(esink->eo) ) {
+                       GST_WARNING ("Cannot apply visible(show-object) property: cannot get an evas object\n");
+                       break;
+               }
+               if(!esink->object_show) {
+                       evas_object_hide(esink->eo);
+                       GST_INFO ("object hide..");
+               } else {
+                       evas_object_show(esink->eo);
+                       GST_INFO ("object show..");
+               }
+               break;
+
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+
+       g_mutex_unlock (instance_lock);
+}
+
+static void
+gst_evas_image_sink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+       GstEvasImageSink *esink = GST_EVASIMAGESINK (object);
+
+       switch (prop_id) {
+       case PROP_EVAS_OBJECT:
+               g_value_set_pointer (value, esink->eo);
+               break;
+       case PROP_EVAS_OBJECT_SHOW:
+               g_value_set_boolean (value, esink->object_show);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static gboolean
+gst_evas_image_sink_set_caps (GstBaseSink *base_sink, GstCaps *caps)
+{
+       int r;
+       int w, h;
+       GstEvasImageSink *esink = GST_EVASIMAGESINK (base_sink);
+
+       esink->is_evas_object_size_set = FALSE;
+       r = evas_image_sink_get_size_from_caps (caps, &w, &h);
+       if (!r) {
+               esink->w = w;
+               esink->h = h;
+               GST_DEBUG ("set size w(%d), h(%d)", w, h);
+       }
+       return TRUE;
+}
+
+static GstFlowReturn
+gst_evas_image_sink_show_frame (GstVideoSink *video_sink, GstBuffer *buf)
+{
+       GstEvasImageSink *esink = GST_EVASIMAGESINK (video_sink);
+       Eina_Bool r;
+
+       g_mutex_lock (instance_lock);
+       if (esink->present_data_addr == -1) {
+               /* if present_data_addr is -1, we don't use this member variable */
+       } else if (esink->present_data_addr != DO_RENDER_FROM_FIMC) {
+               GST_WARNING ("skip rendering this buffer, present_data_addr:%d, DO_RENDER_FROM_FIMC:%d", esink->present_data_addr, DO_RENDER_FROM_FIMC);
+               g_mutex_unlock (instance_lock);
+               return GST_FLOW_OK;
+       }
+       if (!esink->epipe) {
+               esink->epipe = ecore_pipe_add (evas_image_sink_cb_pipe, esink);
+               if (!esink->epipe) {
+                       GST_ERROR ("ecore-pipe create failed");
+                       g_mutex_unlock (instance_lock);
+                       return GST_FLOW_ERROR;
+               }
+       }
+       if (esink->object_show) {
+               gst_buffer_ref (buf);
+               __ta__("evasimagesink ecore_pipe_write", r = ecore_pipe_write (esink->epipe, &buf, sizeof (GstBuffer *)););
+               if (r == EINA_FALSE)  {
+                       gst_buffer_unref (buf);
+               }
+               GST_DEBUG ("after ecore_pipe_write()");
+       } else {
+               GST_DEBUG ("skip ecore_pipe_write()");
+       }
+       g_mutex_unlock (instance_lock);
+       return GST_FLOW_OK;
+}
+
+static gboolean
+evas_image_sink_init (GstPlugin *evasimagesink)
+{
+       GST_DEBUG_CATEGORY_INIT (gst_evas_image_sink_debug, "evasimagesink", 0, "Evas image object based videosink");
+
+       return gst_element_register (evasimagesink, "evasimagesink", GST_RANK_NONE, GST_TYPE_EVASIMAGESINK);
+}
+
+#ifndef PACKAGE
+#define PACKAGE "gstevasimagesink-plugin-package"
+#endif
+
+GST_PLUGIN_DEFINE (
+       GST_VERSION_MAJOR,
+       GST_VERSION_MINOR,
+       "evasimagesink",
+       "Evas image object based videosink",
+       evas_image_sink_init,
+       VERSION,
+       "LGPL",
+       "Samsung Electronics Co",
+       "http://www.samsung.com/"
+)
diff --git a/evasimagesink/src/gstevasimagesink.h b/evasimagesink/src/gstevasimagesink.h
new file mode 100644 (file)
index 0000000..1e2e19b
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * evasimagesink
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Sangchul Lee <sc11.lee@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __GST_EVASIMAGESINK_H__
+#define __GST_EVASIMAGESINK_H__
+
+#include <gst/gst.h>
+#include <gst/video/gstvideosink.h>
+#include <Evas.h>
+#include <Ecore.h>
+#include <mm_ta.h>
+
+G_BEGIN_DECLS
+
+/* #defines don't like whitespacey bits */
+#define GST_TYPE_EVASIMAGESINK \
+  (gst_evas_image_sink_get_type())
+#define GST_EVASIMAGESINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_EVASIMAGESINK,GstEvasImageSink))
+#define GST_EVASIMAGESINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_EVASIMAGESINK,GstEvasImageSinkClass))
+#define GST_IS_EVASIMAGESINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_EVASIMAGESINK))
+#define GST_IS_EVASIMAGESINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_EVASIMAGESINK))
+
+typedef struct _GstEvasImageSink      GstEvasImageSink;
+typedef struct _GstEvasImageSinkClass GstEvasImageSinkClass;
+
+struct _GstEvasImageSink
+{
+       GstVideoSink element;
+
+       Evas_Object *eo;
+       Ecore_Pipe *epipe;
+       Evas_Coord w;
+       Evas_Coord h;
+       gboolean object_show;
+       gboolean gl_zerocopy;
+
+       GstBuffer *oldbuf;
+
+       gboolean is_evas_object_size_set;
+       guint present_data_addr;
+};
+
+struct _GstEvasImageSinkClass
+{
+       GstVideoSinkClass parent_class;
+};
+
+GType gst_evas_image_sink_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_EVASIMAGESINK_H__ */
diff --git a/gst-autogen.sh b/gst-autogen.sh
new file mode 100755 (executable)
index 0000000..7b31212
--- /dev/null
@@ -0,0 +1,308 @@
+# a silly hack that generates autoregen.sh but it's handy
+# Remove the old autoregen.sh first to create a new file,
+# as the current one may be being read by the shell executing
+# this script.
+if [ -f "autoregen.sh" ]; then
+  rm autoregen.sh
+fi
+echo "#!/bin/sh" > autoregen.sh
+echo "./autogen.sh $@ \$@" >> autoregen.sh
+chmod +x autoregen.sh
+
+# helper functions for autogen.sh
+
+debug ()
+# print out a debug message if DEBUG is a defined variable
+{
+  if test ! -z "$DEBUG"
+  then
+    echo "DEBUG: $1"
+  fi
+}
+
+version_check ()
+# check the version of a package
+# first argument : package name (executable)
+# second argument : optional path where to look for it instead
+# third argument : source download url
+# rest of arguments : major, minor, micro version
+# all consecutive ones : suggestions for binaries to use
+# (if not specified in second argument)
+{
+  PACKAGE=$1
+  PKG_PATH=$2
+  URL=$3
+  MAJOR=$4
+  MINOR=$5
+  MICRO=$6
+
+  # for backwards compatibility, we let PKG_PATH=PACKAGE when PKG_PATH null
+  if test -z "$PKG_PATH"; then PKG_PATH=$PACKAGE; fi
+  debug "major $MAJOR minor $MINOR micro $MICRO"
+  VERSION=$MAJOR
+  if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi
+  if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi
+
+  debug "major $MAJOR minor $MINOR micro $MICRO"
+  
+  for SUGGESTION in $PKG_PATH; do 
+    COMMAND="$SUGGESTION"
+
+    # don't check if asked not to
+    test -z "$NOCHECK" && {
+      echo -n "  checking for $COMMAND >= $VERSION ... "
+    } || {
+      # we set a var with the same name as the package, but stripped of
+      # unwanted chars
+      VAR=`echo $PACKAGE | sed 's/-//g'`
+      debug "setting $VAR"
+      eval $VAR="$COMMAND"
+      return 0
+    }
+
+    debug "checking version with $COMMAND"
+    ($COMMAND --version) < /dev/null > /dev/null 2>&1 || 
+    {
+      echo "not found."
+      continue
+    }
+    # strip everything that's not a digit, then use cut to get the first field
+    pkg_version=`$COMMAND --version|head -n 1|sed 's/^.*)[^0-9]*//'|cut -d' ' -f1`
+    debug "pkg_version $pkg_version"
+    # remove any non-digit characters from the version numbers to permit numeric
+    # comparison
+    pkg_major=`echo $pkg_version | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
+    pkg_minor=`echo $pkg_version | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
+    pkg_micro=`echo $pkg_version | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
+    test -z "$pkg_major" && pkg_major=0
+    test -z "$pkg_minor" && pkg_minor=0
+    test -z "$pkg_micro" && pkg_micro=0
+    debug "found major $pkg_major minor $pkg_minor micro $pkg_micro"
+
+    #start checking the version
+    debug "version check"
+
+    # reset check
+    WRONG=
+
+    if [ ! "$pkg_major" -gt "$MAJOR" ]; then
+      debug "major: $pkg_major <= $MAJOR"
+      if [ "$pkg_major" -lt "$MAJOR" ]; then
+        debug "major: $pkg_major < $MAJOR"
+        WRONG=1
+      elif [ ! "$pkg_minor" -gt "$MINOR" ]; then
+        debug "minor: $pkg_minor <= $MINOR"
+        if [ "$pkg_minor" -lt "$MINOR" ]; then
+          debug "minor: $pkg_minor < $MINOR"
+          WRONG=1
+        elif [ "$pkg_micro" -lt "$MICRO" ]; then
+          debug "micro: $pkg_micro < $MICRO"
+         WRONG=1
+        fi
+      fi
+    fi
+
+    if test ! -z "$WRONG"; then
+      echo "found $pkg_version, not ok !"
+      continue
+    else
+      echo "found $pkg_version, ok."
+      # we set a var with the same name as the package, but stripped of
+      # unwanted chars
+      VAR=`echo $PACKAGE | sed 's/-//g'`
+      debug "setting $VAR"
+      eval $VAR="$COMMAND"
+      return 0
+    fi
+  done
+
+  echo "not found !"
+  echo "You must have $PACKAGE installed to compile $package."
+  echo "Download the appropriate package for your distribution,"
+  echo "or get the source tarball at $URL"
+  return 1;
+}
+
+aclocal_check ()
+{
+  # normally aclocal is part of automake
+  # so we expect it to be in the same place as automake
+  # so if a different automake is supplied, we need to adapt as well
+  # so how's about replacing automake with aclocal in the set var,
+  # and saving that in $aclocal ?
+  # note, this will fail if the actual automake isn't called automake*
+  # or if part of the path before it contains it
+  if [ -z "$automake" ]; then
+    echo "Error: no automake variable set !"
+    return 1
+  else
+    aclocal=`echo $automake | sed s/automake/aclocal/`
+    debug "aclocal: $aclocal"
+    if [ "$aclocal" != "aclocal" ];
+    then
+      CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-aclocal=$aclocal"
+    fi
+    if [ ! -x `which $aclocal` ]; then
+      echo "Error: cannot execute $aclocal !"
+      return 1
+    fi
+  fi
+}
+
+autoheader_check ()
+{
+  # same here - autoheader is part of autoconf
+  # use the same voodoo
+  if [ -z "$autoconf" ]; then
+    echo "Error: no autoconf variable set !"
+    return 1
+  else
+    autoheader=`echo $autoconf | sed s/autoconf/autoheader/`
+    debug "autoheader: $autoheader"
+    if [ "$autoheader" != "autoheader" ];
+    then
+      CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoheader=$autoheader"
+    fi
+    if [ ! -x `which $autoheader` ]; then
+      echo "Error: cannot execute $autoheader !"
+      return 1
+    fi
+  fi
+
+}
+autoconf_2_52d_check ()
+{
+  # autoconf 2.52d has a weird issue involving a yes:no error
+  # so don't allow it's use
+  test -z "$NOCHECK" && {
+    ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-Z\.\ ()]*//;s/ .*$//'`
+    if test "$ac_version" = "2.52d"; then
+      echo "autoconf 2.52d has an issue with our current build."
+      echo "We don't know who's to blame however.  So until we do, get a"
+      echo "regular version.  RPM's of a working version are on the gstreamer site."
+      exit 1
+    fi
+  }
+  return 0
+}
+
+die_check ()
+{
+  # call with $DIE
+  # if set to 1, we need to print something helpful then die
+  DIE=$1
+  if test "x$DIE" = "x1";
+  then
+    echo
+    echo "- Please get the right tools before proceeding."
+    echo "- Alternatively, if you're sure we're wrong, run with --nocheck."
+    exit 1
+  fi
+}
+
+autogen_options ()
+{
+  if test "x$1" = "x"; then
+    return 0
+  fi
+
+  while test "x$1" != "x" ; do
+    optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    case "$1" in
+      --noconfigure)
+          NOCONFIGURE=defined
+         AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure"
+          echo "+ configure run disabled"
+          shift
+          ;;
+      --nocheck)
+         AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck"
+          NOCHECK=defined
+          echo "+ autotools version check disabled"
+          shift
+          ;;
+      --debug)
+          DEBUG=defined
+         AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug"
+          echo "+ debug output enabled"
+          shift
+          ;;
+      --prefix=*)
+         CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$optarg"
+         echo "+ passing --prefix=$optarg to configure"
+          shift
+          ;;
+      --prefix)
+         shift
+         echo "DEBUG: $1"
+         CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$1"
+         echo "+ passing --prefix=$1 to configure"
+          shift
+          ;;
+
+      -h|--help)
+          echo "autogen.sh (autogen options) -- (configure options)"
+          echo "autogen.sh help options: "
+          echo " --noconfigure            don't run the configure script"
+          echo " --nocheck                don't do version checks"
+          echo " --debug                  debug the autogen process"
+         echo " --prefix                 will be passed on to configure"
+          echo
+          echo " --with-autoconf PATH     use autoconf in PATH"
+          echo " --with-automake PATH     use automake in PATH"
+          echo
+          echo "to pass options to configure, put them as arguments after -- "
+         exit 1
+          ;;
+      --with-automake=*)
+          AUTOMAKE=$optarg
+          echo "+ using alternate automake in $optarg"
+         CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE"
+          shift
+          ;;
+      --with-autoconf=*)
+          AUTOCONF=$optarg
+          echo "+ using alternate autoconf in $optarg"
+         CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF"
+          shift
+          ;;
+      --disable*|--enable*|--with*)
+          echo "+ passing option $1 to configure"
+         CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1"
+          shift
+          ;;
+       --) shift ; break ;;
+      *) echo "- ignoring unknown autogen.sh argument $1"; shift ;;
+    esac
+  done
+
+  for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done
+  if test ! -z "$CONFIGURE_EXT_OPT"
+  then
+    echo "+ options passed to configure: $CONFIGURE_EXT_OPT"
+  fi
+}
+
+toplevel_check ()
+{
+  srcfile=$1
+  test -f $srcfile || {
+        echo "You must run this script in the top-level $package directory"
+        exit 1
+  }
+}
+
+
+tool_run ()
+{
+  tool=$1
+  options=$2
+  run_if_fail=$3
+  echo "+ running $tool $options..."
+  $tool $options || {
+    echo
+    echo $tool failed
+    eval $run_if_fail
+    exit 1
+  }
+}
diff --git a/gst-plugins-ext0.10.manifest b/gst-plugins-ext0.10.manifest
new file mode 100755 (executable)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
diff --git a/m4/Makefile.am b/m4/Makefile.am
new file mode 100644 (file)
index 0000000..5fa63aa
--- /dev/null
@@ -0,0 +1 @@
+EXTRA_DIST = as-version.m4 as-compiler-flag.m4\r
diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4
new file mode 100755 (executable)
index 0000000..4134857
--- /dev/null
@@ -0,0 +1,25 @@
+dnl as-compiler-flag.m4 0.0.1\r
+dnl autostars m4 macro for detection of compiler flags\r
+dnl\r
+dnl ds@schleef.org\r
+\r
+AC_DEFUN([AS_COMPILER_FLAG],\r
+[\r
+  AC_MSG_CHECKING([to see if compiler understands $1])\r
+\r
+  save_CFLAGS="$CFLAGS"\r
+  CFLAGS="$CFLAGS $1"\r
+\r
+  AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])\r
+  CFLAGS="$save_CFLAGS"\r
+\r
+  if test "X$flag_ok" = Xyes ; then\r
+    $2\r
+    true\r
+  else\r
+    $3\r
+    true\r
+  fi\r
+  AC_MSG_RESULT([$flag_ok])\r
+])\r
+\r
diff --git a/m4/as-version.m4 b/m4/as-version.m4
new file mode 100755 (executable)
index 0000000..249102b
--- /dev/null
@@ -0,0 +1,66 @@
+dnl as-version.m4 0.1.0\r
+\r
+dnl autostars m4 macro for versioning\r
+\r
+dnl Thomas Vander Stichele <thomas at apestaart dot org>\r
+\r
+dnl $Id: as-version.m4,v 1.2 2004-09-17 22:18:03 leroutier Exp $\r
+\r
+dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO,\r
+dnl            ACTION-IF-NO-NANO, [ACTION-IF-NANO])\r
+\r
+dnl example\r
+dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,)\r
+dnl for a 0.3.2 release version\r
+\r
+dnl this macro\r
+dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO\r
+dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode\r
+dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE\r
+dnl - executes the relevant action\r
+dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE\r
+dnl   as well as the little ones\r
+dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents\r
+dnl   maintainer mode from running ok\r
+dnl\r
+dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h\r
+dnl if you use acconfig.h\r
+\r
+AC_DEFUN([AS_VERSION],\r
+[\r
+  PACKAGE=[$1]\r
+  [$2]_MAJOR=[$3]\r
+  [$2]_MINOR=[$4]\r
+  [$2]_MICRO=[$5]\r
+  NANO=[$6]\r
+  [$2]_NANO=$NANO\r
+  if test "x$NANO" = "x" || test "x$NANO" = "x0";\r
+  then\r
+      AC_MSG_NOTICE(configuring [$1] for release)\r
+      VERSION=[$3].[$4].[$5]\r
+      [$2]_RELEASE=1\r
+      dnl execute action\r
+      ifelse([$7], , :, [$7])\r
+  else\r
+      AC_MSG_NOTICE(configuring [$1] for development with nano $NANO)\r
+      VERSION=[$3].[$4].[$5].$NANO\r
+      [$2]_RELEASE=0.`date +%Y%m%d.%H%M%S`\r
+      dnl execute action\r
+      ifelse([$8], , :, [$8])\r
+  fi\r
+\r
+  [$2]=$VERSION\r
+  AC_DEFINE_UNQUOTED([$2], "$[$2]", [Define the version])\r
+  AC_SUBST([$2])\r
+  AC_DEFINE_UNQUOTED([$2]_RELEASE, "$[$2]_RELEASE", [Define the release version])\r
+  AC_SUBST([$2]_RELEASE)\r
+\r
+  AC_SUBST([$2]_MAJOR)\r
+  AC_SUBST([$2]_MINOR)\r
+  AC_SUBST([$2]_MICRO)\r
+  AC_SUBST([$2]_NANO)\r
+  AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name])\r
+  AC_SUBST(PACKAGE)\r
+  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version])\r
+  AC_SUBST(VERSION)\r
+])\r
diff --git a/packaging/gst-plugins-ext0.10.spec b/packaging/gst-plugins-ext0.10.spec
new file mode 100644 (file)
index 0000000..8d03eec
--- /dev/null
@@ -0,0 +1,49 @@
+Name:       gst-plugins-ext0.10
+Version:    0.2.20
+Summary:    GStreamer extra plugins (common)
+Release:    0
+Group:      libs
+License:    LGPLv2+
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig(avsysaudio)
+BuildRequires:  pkgconfig(camsrcjpegenc)
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(ecore-x)
+BuildRequires:  pkgconfig(evas)
+BuildRequires:  pkgconfig(mm-ta)
+BuildRequires:  pkgconfig(gstreamer-plugins-base-0.10)
+BuildRequires:  pkgconfig(gstreamer-0.10)  
+BuildRequires:  pkgconfig(libexif)
+BuildRequires: pkgconfig(libdri2)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(xext)
+BuildRequires: pkgconfig(xv)
+BuildRequires: pkgconfig(xdamage)
+BuildRequires: pkgconfig(libdrm)
+BuildRequires:  pkgconfig(libdrm_slp)
+BuildRequires: libdrm-devel
+
+%description
+GStreamer extra plugins (common)
+
+%prep
+%setup -q
+
+
+%build
+export CFLAGS+=" -DGST_EXT_TIME_ANALYSIS -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" "
+
+./autogen.sh --disable-static
+%configure --disable-static
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+
+%files
+%manifest gst-plugins-ext0.10.manifest
+%defattr(-,root,root,-)  
+%{_libdir}/gstreamer-0.10/*.so
diff --git a/pdpushsrc/Makefile.am b/pdpushsrc/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/pdpushsrc/src/Makefile.am b/pdpushsrc/src/Makefile.am
new file mode 100755 (executable)
index 0000000..090c2d1
--- /dev/null
@@ -0,0 +1,26 @@
+# plugindir is set in configure
+
+##############################################################################
+# change libgstplugin.la to something more suitable, e.g. libmysomething.la  #
+##############################################################################
+plugin_LTLIBRARIES = libgstpdpushsrc.la
+
+##############################################################################
+# for the next set of variables, rename the prefix if you renamed the .la,   #
+#  e.g. libgstplugin_la_SOURCES => libmysomething_la_SOURCES                 #
+#       libgstplugin_la_CFLAGS  => libmysomething_la_CFLAGS                  #
+#       libgstplugin_la_LIBADD  => libmysomething_la_LIBADD                  #
+#       libgstplugin_la_LDFLAGS => libmysomething_la_LDFLAGS                 #
+##############################################################################
+
+# sources used to compile this plug-in
+libgstpdpushsrc_la_SOURCES = gstpdpushsrc.c
+
+# flags used to compile this plugin
+# add other _CFLAGS and _LIBS as needed
+libgstpdpushsrc_la_CFLAGS = $(GST_CFLAGS)  $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS)
+libgstpdpushsrc_la_LIBADD = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS)  $(GST_BASE_LIBS)
+libgstpdpushsrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+# headers we need but don't want installed
+noinst_HEADERS = gstpdpushsrc.h
diff --git a/pdpushsrc/src/gstpdpushsrc.c b/pdpushsrc/src/gstpdpushsrc.c
new file mode 100644 (file)
index 0000000..fb56643
--- /dev/null
@@ -0,0 +1,830 @@
+/*
+ * pdpushsrc
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include "gstpdpushsrc.h"
+#include <errno.h>
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef G_OS_WIN32
+#include <io.h>                 /* lseek, open, close, read */
+/* On win32, stat* default to 32 bit; we need the 64-bit
+ * variants, so explicitly define it that way. */
+#define stat __stat64
+#define fstat _fstat64
+#undef lseek
+#define lseek _lseeki64
+#undef off_t
+#define off_t guint64
+/* Prevent stat.h from defining the stat* functions as
+ * _stat*, since we're explicitly overriding that */
+#undef _INC_STAT_INL
+#endif
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS_ANY);
+
+/* FIXME we should be using glib for this */
+#ifndef S_ISREG
+#define S_ISREG(mode) ((mode)&_S_IFREG)
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(mode) ((mode)&_S_IFDIR)
+#endif
+#ifndef S_ISSOCK
+#define S_ISSOCK(x) (0)
+#endif
+#ifndef O_BINARY
+#define O_BINARY (0)
+#endif
+
+static int
+file_open (const gchar * filename, int flags, int mode)
+{
+  return open (filename, flags, mode);
+}
+
+GST_DEBUG_CATEGORY_STATIC (gst_pd_pushsrc_debug);
+#define GST_CAT_DEFAULT gst_pd_pushsrc_debug
+
+/* FileSrc signals and args */
+enum
+{
+  /* FILL ME */
+  LAST_SIGNAL
+};
+
+#define DEFAULT_BLOCKSIZE       4*1024
+
+enum
+{
+  ARG_0,
+  ARG_LOCATION,
+  ARG_EOS,
+};
+
+static void gst_pd_pushsrc_finalize (GObject * object);
+
+static void gst_pd_pushsrc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_pd_pushsrc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
+
+static gboolean gst_pd_pushsrc_start (GstBaseSrc * basesrc);
+static gboolean gst_pd_pushsrc_stop (GstBaseSrc * basesrc);
+
+static gboolean gst_pd_pushsrc_is_seekable (GstBaseSrc * src);
+static gboolean gst_pd_pushsrc_get_size (GstBaseSrc * src, guint64 * size);
+static gboolean gst_pd_pushsrc_query (GstBaseSrc * src, GstQuery * query);
+static void gst_pd_pushsrc_uri_handler_init (gpointer g_iface, gpointer iface_data);
+static GstFlowReturn gst_pd_pushsrc_create (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** buffer);
+static gboolean gst_pd_pushsrc_checkgetrange (GstPad * pad);
+
+static void
+_do_init (GType pd_pushsrc_type)
+{
+  static const GInterfaceInfo urihandler_info = {
+    gst_pd_pushsrc_uri_handler_init,
+    NULL,
+    NULL
+  };
+
+  g_type_add_interface_static (pd_pushsrc_type, GST_TYPE_URI_HANDLER, &urihandler_info);
+  GST_DEBUG_CATEGORY_INIT (gst_pd_pushsrc_debug, "pdpushsrc", 0, "PD push source element");
+}
+
+GST_BOILERPLATE_FULL (GstPDPushSrc, gst_pd_pushsrc, GstBaseSrc, GST_TYPE_BASE_SRC, _do_init);
+
+static void
+gst_pd_pushsrc_base_init (gpointer g_class)
+{
+  GST_LOG ("IN");
+
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details_simple (gstelement_class,
+      "PD push source",
+      "Source/File",
+      "Read from arbitrary point in a file",
+      "Naveen Ch <naveen.ch@samsung.com>");
+  gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&srctemplate));
+
+  GST_LOG ("OUT");
+}
+
+static void
+gst_pd_pushsrc_class_init (GstPDPushSrcClass * klass)
+{
+  GST_LOG ("IN");
+
+  GObjectClass *gobject_class;
+  GstBaseSrcClass *gstbasesrc_class;
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
+
+  gobject_class->set_property = gst_pd_pushsrc_set_property;
+  gobject_class->get_property = gst_pd_pushsrc_get_property;
+  gobject_class->finalize = gst_pd_pushsrc_finalize;
+
+  g_object_class_install_property (gobject_class, ARG_LOCATION,
+      g_param_spec_string ("location", "File Location",
+          "Location of the file to read", NULL,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
+          GST_PARAM_MUTABLE_READY));
+   
+    g_object_class_install_property (gobject_class, ARG_EOS,
+                                    g_param_spec_boolean ("eos",
+                                        "EOS recived on downloading pipeline",
+                                        "download of clip is over",
+                                        0,
+                                        G_PARAM_READWRITE));
+   
+  gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_pd_pushsrc_start);
+  gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_pd_pushsrc_stop);
+  gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_pd_pushsrc_is_seekable);
+  gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_pd_pushsrc_get_size);
+  gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_pd_pushsrc_query);
+  gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_pd_pushsrc_create);
+
+  if (sizeof (off_t) < 8) {
+    GST_LOG ("No large file support, sizeof (off_t) = %" G_GSIZE_FORMAT "!",
+        sizeof (off_t));
+  }
+
+  GST_LOG ("OUT");
+}
+
+static void
+gst_pd_pushsrc_init (GstPDPushSrc * src, GstPDPushSrcClass * g_class)
+{
+  GST_LOG ("IN");
+  GstBaseSrc *basesrc = GST_BASE_SRC (src);
+
+  src->filename = NULL;
+  src->fd = 0;
+  src->uri = NULL;
+  src->is_regular = FALSE;
+  src->is_eos = FALSE;
+  
+  gst_pad_set_checkgetrange_function (basesrc->srcpad, GST_DEBUG_FUNCPTR (gst_pd_pushsrc_checkgetrange));
+
+  GST_LOG ("OUT");
+}
+
+static void
+gst_pd_pushsrc_finalize (GObject * object)
+{
+  GST_LOG ("IN");
+
+  GstPDPushSrc *src;
+
+  src = GST_PD_PUSHSRC (object);
+
+  g_free (src->filename);
+  g_free (src->uri);
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+
+  GST_LOG ("OUT");
+}
+
+static gboolean
+gst_pd_pushsrc_set_location (GstPDPushSrc * src, const gchar * location)
+{
+  GST_LOG ("IN");
+
+  GstState state;
+
+  /* the element must be stopped in order to do this */
+  GST_OBJECT_LOCK (src);
+  state = GST_STATE (src);
+  if (state != GST_STATE_READY && state != GST_STATE_NULL)
+    goto wrong_state;
+  GST_OBJECT_UNLOCK (src);
+
+  g_free (src->filename);
+  g_free (src->uri);
+
+  /* clear the filename if we get a NULL (is that possible?) */
+  if (location == NULL) {
+    src->filename = NULL;
+    src->uri = NULL;
+  } else {
+    /* we store the filename as received by the application. On Windows this
+     * should be UTF8 */
+    src->filename = g_strdup (location);
+    src->uri = gst_filename_to_uri (location, NULL);
+    GST_INFO ("filename : %s", src->filename);
+    GST_INFO ("uri      : %s", src->uri);
+  }
+  g_object_notify (G_OBJECT (src), "location");
+  gst_uri_handler_new_uri (GST_URI_HANDLER (src), src->uri);
+  
+  GST_LOG ("OUT");
+
+  return TRUE;
+
+  /* ERROR */
+wrong_state:
+  {
+    g_warning ("Changing the `location' property on filesrc when a file is "
+        "open is not supported.");
+    GST_OBJECT_UNLOCK (src);
+    GST_LOG ("OUT :: wrong_state");
+    return FALSE;
+  }
+}
+
+static void
+gst_pd_pushsrc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+  GST_LOG ("IN");
+
+  GstPDPushSrc *src;
+
+  g_return_if_fail (GST_IS_PD_PUSHSRC (object));
+
+  src = GST_PD_PUSHSRC (object);
+
+  switch (prop_id) {
+    case ARG_LOCATION:
+      gst_pd_pushsrc_set_location (src, g_value_get_string (value));
+      break;
+    case ARG_EOS:
+      src->is_eos = g_value_get_boolean (value);
+      g_print ("\n\n\nis_eos is becoming %d\n\n\n", src->is_eos);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+  GST_LOG ("OUT");
+}
+
+static void
+gst_pd_pushsrc_get_property (GObject * object, guint prop_id, GValue * value,
+    GParamSpec * pspec)
+{
+  GST_LOG ("IN");
+  GstPDPushSrc *src;
+
+  g_return_if_fail (GST_IS_PD_PUSHSRC (object));
+
+  src = GST_PD_PUSHSRC (object);
+
+  switch (prop_id) {
+    case ARG_LOCATION:
+      g_value_set_string (value, src->filename);
+      break;
+    case ARG_EOS:
+      g_value_set_boolean (value, src->is_eos);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+  GST_LOG ("OUT");
+}
+
+static GstFlowReturn
+gst_pd_pushsrc_create_read (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** buffer)
+{
+  GST_LOG ("IN");
+
+  int ret;
+  GstBuffer *buf = NULL;
+  struct stat stat_results;
+  GstPDPushSrc *src;
+
+  src = GST_PD_PUSHSRC_CAST (basesrc);
+  
+  GST_LOG_OBJECT (src, "read position = %"G_GUINT64_FORMAT ", offset = %"G_GUINT64_FORMAT", length = %d", 
+       src->read_position, offset, length);
+  
+  memset (&stat_results, 0, sizeof (stat_results));
+  
+  if (fstat (src->fd, &stat_results) < 0)
+    goto could_not_stat;
+
+  GST_LOG_OBJECT (src, "offset + length = %"G_GUINT64_FORMAT " and filesize = %"G_GUINT64_FORMAT, offset + length, stat_results.st_size);
+
+  while ((offset + length) > stat_results.st_size)
+  {
+    fd_set fds;
+    int ret;
+    struct timeval timeout = {0,};
+    guint64 avail_size = 0;
+
+    if (src->is_eos)
+       goto eos;
+
+    FD_ZERO (&fds);
+    FD_SET (src->fd, &fds);
+
+    timeout.tv_sec = 0;
+    timeout.tv_usec = ((basesrc->blocksize * 8 * 1000) / 64000); // wait_time = (blocksize * 8) / (min downloadratei.e. 64Kbps)
+
+    GST_DEBUG_OBJECT (src, "Going to wait for %ld msec", timeout.tv_usec);
+
+    ret = select (src->fd + 1, &fds, NULL, NULL, &timeout);
+    if (-1 == ret) 
+    {
+      GST_ERROR_OBJECT (src, "ERROR in select () : reason - %s...\n", strerror(errno));
+      return GST_FLOW_ERROR;
+    }
+    else if (0 == ret)
+    {
+      GST_WARNING_OBJECT (src, "select () timeout happened...");
+    }
+    else
+    {
+      memset (&stat_results, 0, sizeof (stat_results));
+  
+      if (fstat (src->fd, &stat_results) < 0)
+        goto could_not_stat;
+
+      avail_size = stat_results.st_size;
+
+      GST_LOG_OBJECT (src, "Available data size in file = %"G_GUINT64_FORMAT, avail_size);
+
+      if ((offset + length) > avail_size)
+      {
+        GST_LOG_OBJECT (src, "Enough data is NOT available...");
+      }
+      else
+      {
+        GST_LOG_OBJECT (src, "Enough data is available...");
+      }
+    }
+  }
+
+  if (G_UNLIKELY (src->read_position != offset)) {
+    off_t res;
+
+    res = lseek (src->fd, offset, SEEK_SET);
+    if (G_UNLIKELY (res < 0 || res != offset))
+      goto seek_failed;
+    src->read_position = offset;
+  }
+  
+  buf = gst_buffer_try_new_and_alloc (length);
+  if (G_UNLIKELY (buf == NULL && length > 0)) {
+    GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", length);
+    return GST_FLOW_ERROR;
+  }
+
+  /* No need to read anything if length is 0 */
+  if (length > 0) {
+    GST_LOG_OBJECT (src, "Reading %d bytes at offset 0x%" G_GINT64_MODIFIER "x",
+        length, offset);
+    ret = read (src->fd, GST_BUFFER_DATA (buf), length);
+    if (G_UNLIKELY (ret < 0))
+      goto could_not_read;
+
+    /* seekable regular files should have given us what we expected */
+    if (G_UNLIKELY ((guint) ret < length && src->seekable))
+      goto unexpected_eos;
+
+    /* other files should eos if they read 0 and more was requested */
+    if (G_UNLIKELY (ret == 0 && length > 0))
+      goto eos;
+
+    length = ret;
+    GST_BUFFER_SIZE (buf) = length;
+    GST_BUFFER_OFFSET (buf) = offset;
+    GST_BUFFER_OFFSET_END (buf) = offset + length;
+
+    src->read_position += length;
+  }
+
+  *buffer = buf;
+  GST_LOG ("OUT");
+
+  return GST_FLOW_OK;
+
+  /* ERROR */
+seek_failed:
+  {
+    GST_ERROR_OBJECT (src, "Seek failed...");
+    GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+    return GST_FLOW_ERROR;
+  }
+could_not_stat:
+  {
+    GST_ERROR_OBJECT (src, "Could not stat");
+    GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+    return GST_FLOW_ERROR;
+  }
+could_not_read:
+  {
+    GST_ERROR_OBJECT (src, "Could not read...");
+    GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
+    if (buf)
+      gst_buffer_unref (buf);
+    return GST_FLOW_ERROR;
+  }
+unexpected_eos:
+  {
+    GST_ERROR_OBJECT (src, "Unexpected EOS occured...");
+    GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL), ("unexpected end of file."));
+    if (buf)
+      gst_buffer_unref (buf);
+    return GST_FLOW_ERROR;
+  }
+eos:
+  {
+    GST_ERROR_OBJECT (src, "non-regular file hits EOS");
+    if (buf)
+      gst_buffer_unref (buf);
+    return GST_FLOW_UNEXPECTED;
+  }
+}
+
+static GstFlowReturn
+gst_pd_pushsrc_create (GstBaseSrc * basesrc, guint64 offset, guint length, GstBuffer ** buffer)
+{
+  GST_LOG ("IN");
+
+  GstPDPushSrc *pdsrc;
+  GstFlowReturn ret;
+
+  pdsrc = GST_PD_PUSHSRC_CAST (basesrc);
+  ret = gst_pd_pushsrc_create_read (basesrc, offset, length, buffer);
+  GST_LOG ("OUT");
+
+  return ret;
+}
+
+static gboolean
+gst_pd_pushsrc_query (GstBaseSrc * basesrc, GstQuery * query)
+{
+  GST_LOG ("IN");
+
+  gboolean ret = FALSE;
+  GstPDPushSrc *src = GST_PD_PUSHSRC (basesrc);
+
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_URI:
+      gst_query_set_uri (query, src->uri);
+      ret = TRUE;
+      break;
+    default:
+      ret = FALSE;
+      break;
+  }
+
+  if (!ret)
+    ret = GST_BASE_SRC_CLASS (parent_class)->query (basesrc, query);
+  GST_LOG ("OUT");
+
+  return ret;
+}
+
+static gboolean
+gst_pd_pushsrc_checkgetrange (GstPad * pad)
+{
+  GST_LOG ("IN");
+
+  GST_LOG ("OUT");
+
+  return FALSE;
+}
+
+static gboolean
+gst_pd_pushsrc_is_seekable (GstBaseSrc * basesrc)
+{
+  GST_LOG ("IN");
+
+  GstPDPushSrc *src = GST_PD_PUSHSRC (basesrc);
+
+  GST_DEBUG_OBJECT (src, "seekable = %d", src->seekable);
+  GST_LOG ("OUT");
+
+  return src->seekable;
+
+}
+
+static gboolean
+gst_pd_pushsrc_get_size (GstBaseSrc * basesrc, guint64 * size)
+{
+  GST_LOG ("IN");
+
+  struct stat stat_results;
+  GstPDPushSrc *src;
+
+  src = GST_PD_PUSHSRC (basesrc);
+
+  if (!src->seekable) {
+    /* If it isn't seekable, we won't know the length (but fstat will still
+     * succeed, and wrongly say our length is zero. */
+    return FALSE;
+  }
+
+  if (fstat (src->fd, &stat_results) < 0)
+    goto could_not_stat;
+
+  //*size = stat_results.st_size;
+  /* Naveen : Intentionally, doing this because we dont know the file size...because its keep on increasing in PD case */
+  *size = G_MAXUINT64;
+
+  GST_DEBUG ("size of the file = %"G_GUINT64_FORMAT, *size);
+  
+  GST_LOG ("OUT");
+
+  return TRUE;
+
+  /* ERROR */
+could_not_stat:
+  {
+    GST_ERROR_OBJECT (src, "Could not stat");
+    return FALSE;
+  }
+}
+
+/* open the file, necessary to go to READY state */
+static gboolean
+gst_pd_pushsrc_start (GstBaseSrc * basesrc)
+{
+  GST_LOG ("IN");
+
+  GstPDPushSrc *src = GST_PD_PUSHSRC (basesrc);
+  struct stat stat_results;
+
+  if (src->filename == NULL || src->filename[0] == '\0')
+    goto no_filename;
+
+  GST_INFO_OBJECT (src, "opening file %s", src->filename);
+
+  /* open the file */
+  src->fd = file_open (src->filename, O_RDONLY | O_BINARY, 0);
+
+  if (src->fd < 0)
+    goto open_failed;
+
+  /* check if it is a regular file, otherwise bail out */
+  if (fstat (src->fd, &stat_results) < 0)
+    goto no_stat;
+
+  if (S_ISDIR (stat_results.st_mode))
+    goto was_directory;
+
+  if (S_ISSOCK (stat_results.st_mode))
+    goto was_socket;
+
+  src->read_position = 0;
+
+  /* record if it's a regular (hence seekable and lengthable) file */
+  if (S_ISREG (stat_results.st_mode))
+    src->is_regular = TRUE;
+
+  {
+    /* we need to check if the underlying file is seekable. */
+    off_t res = lseek (src->fd, 0, SEEK_END);
+
+    if (res < 0) {
+      GST_LOG_OBJECT (src, "disabling seeking, not in mmap mode and lseek "
+          "failed: %s", g_strerror (errno));
+      src->seekable = FALSE;
+    } else {
+      src->seekable = TRUE;
+    }
+    lseek (src->fd, 0, SEEK_SET);
+  }
+
+  /* We can only really do seeking on regular files - for other file types, we
+   * don't know their length, so seeking isn't useful/meaningful */
+  src->seekable = src->seekable && src->is_regular;
+  GST_LOG ("OUT");
+
+  return TRUE;
+
+  /* ERROR */
+no_filename:
+  {
+    GST_ERROR_OBJECT (src, "No file name specified for reading...");
+    GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND,
+        ("No file name specified for reading."), (NULL));
+    return FALSE;
+  }
+open_failed:
+  {
+    switch (errno) {
+      case ENOENT:
+        GST_ERROR_OBJECT (src, "File could not be found");
+        GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
+            ("No such file \"\""));
+        break;
+      default:
+        GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
+            ("Could not open file for reading."),
+            GST_ERROR_SYSTEM);
+        break;
+    }
+    return FALSE;
+  }
+no_stat:
+  {
+    GST_ERROR_OBJECT (src, "Could not get stat info...");      
+    GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
+        ("Could not get info on \"\"."),  (NULL));
+    close (src->fd);
+    return FALSE;
+  }
+was_directory:
+  {
+    GST_ERROR_OBJECT (src, "Is a Directory");
+    GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
+        ("\"\" is a directory."), (NULL));
+    close (src->fd);
+    return FALSE;
+  }
+was_socket:
+  {
+   GST_ERROR_OBJECT (src, "Is a Socket");      
+    GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ,
+        ("File \"\" is a socket."), (NULL));
+    close (src->fd);
+    return FALSE;
+  }
+}
+
+/* unmap and close the file */
+static gboolean
+gst_pd_pushsrc_stop (GstBaseSrc * basesrc)
+{
+  GST_LOG ("IN");
+
+  GstPDPushSrc *src = GST_PD_PUSHSRC (basesrc);
+
+  /* close the file */
+  close (src->fd);
+
+  /* zero out a lot of our state */
+  src->fd = 0;
+  src->is_regular = FALSE;
+
+  GST_LOG ("OUT");
+
+  return TRUE;
+}
+
+/*** GSTURIHANDLER INTERFACE *************************************************/
+
+static GstURIType
+gst_pd_pushsrc_uri_get_type (void)
+{
+  GST_LOG ("IN");
+  GST_LOG ("OUT");
+
+  return GST_URI_SRC;
+}
+
+static gchar **
+gst_pd_pushsrc_uri_get_protocols (void)
+{
+  GST_LOG ("IN");
+  static gchar *protocols[] = { (char *) "file", NULL };
+  GST_LOG ("OUT");
+
+  return protocols;
+}
+
+static const gchar *
+gst_pd_pushsrc_uri_get_uri (GstURIHandler * handler)
+{
+  GST_LOG ("IN");
+  GstPDPushSrc *src = GST_PD_PUSHSRC (handler);
+  GST_LOG ("OUT");
+
+  return src->uri;
+}
+
+static gboolean
+gst_pd_pushsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+{
+  GST_LOG ("IN");
+
+  gchar *location, *hostname = NULL;
+  gboolean ret = FALSE;
+  GstPDPushSrc *src = GST_PD_PUSHSRC (handler);
+  GError *error = NULL;
+
+  if (strcmp (uri, "file://") == 0) {
+    /* Special case for "file://" as this is used by some applications
+     *  to test with gst_element_make_from_uri if there's an element
+     *  that supports the URI protocol. */
+    gst_pd_pushsrc_set_location (src, NULL);
+    return TRUE;
+  }
+
+  location = g_filename_from_uri (uri, &hostname, &error);
+
+  if (!location || error) {
+    if (error) {
+      GST_WARNING_OBJECT (src, "Invalid URI '%s' for filesrc: %s", uri,
+          error->message);
+      g_error_free (error);
+    } else {
+      GST_WARNING_OBJECT (src, "Invalid URI '%s' for filesrc", uri);
+    }
+    goto beach;
+  }
+
+  if ((hostname) && (strcmp (hostname, "localhost"))) {
+    /* Only 'localhost' is permitted */
+    GST_WARNING_OBJECT (src, "Invalid hostname '%s' for filesrc", hostname);
+    goto beach;
+  }
+#ifdef G_OS_WIN32
+  /* Unfortunately, g_filename_from_uri() doesn't handle some UNC paths
+   * correctly on windows, it leaves them with an extra backslash
+   * at the start if they're of the mozilla-style file://///host/path/file 
+   * form. Correct this.
+   */
+  if (location[0] == '\\' && location[1] == '\\' && location[2] == '\\')
+    g_memmove (location, location + 1, strlen (location + 1) + 1);
+#endif
+
+  ret = gst_pd_pushsrc_set_location (src, location);
+
+  GST_LOG ("OUT");
+
+beach:
+  if (location)
+    g_free (location);
+  if (hostname)
+    g_free (hostname);
+
+  return ret;
+}
+
+static void
+gst_pd_pushsrc_uri_handler_init (gpointer g_iface, gpointer iface_data)
+{
+  GST_LOG ("IN");
+  GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
+
+  iface->get_type = gst_pd_pushsrc_uri_get_type;
+  iface->get_protocols = gst_pd_pushsrc_uri_get_protocols;
+  iface->get_uri = gst_pd_pushsrc_uri_get_uri;
+  iface->set_uri = gst_pd_pushsrc_uri_set_uri;
+  GST_LOG ("OUT");
+}
+
+static gboolean
+gst_pd_pushsrc_plugin_init (GstPlugin *plugin)
+{
+    if (!gst_element_register (plugin, "pdpushsrc", GST_RANK_NONE, gst_pd_pushsrc_get_type()))
+    {
+        return FALSE;
+    }
+    return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+                   GST_VERSION_MINOR,
+                   "pdpushsrc",
+                   "PD push source",
+                   gst_pd_pushsrc_plugin_init,
+                   VERSION,
+                   "LGPL",
+                   "Samsung Electronics Co",
+                   "http://www.samsung.com")
+
+
diff --git a/pdpushsrc/src/gstpdpushsrc.h b/pdpushsrc/src/gstpdpushsrc.h
new file mode 100755 (executable)
index 0000000..651efdb
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * pdpushsrc
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __GST_PD_PUSHSRC_H__
+#define __GST_PD_PUSHSRC_H__
+
+#include <sys/types.h>
+#include <gst/gst.h>
+#include <gst/base/gstbasesrc.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_PD_PUSHSRC                (gst_pd_pushsrc_get_type())
+#define GST_PD_PUSHSRC(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_PD_PUSHSRC,GstPDPushSrc))
+#define GST_PD_PUSHSRC_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_PD_PUSHSRC,GstPDPushSrcClass))
+#define GST_IS_PD_PUSHSRC(obj)                  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PD_PUSHSRC))
+#define GST_IS_PD_PUSHSRC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PD_PUSHSRC))
+#define GST_PD_PUSHSRC_CAST(obj) ((GstPDPushSrc*) obj)
+
+typedef struct _GstPDPushSrc GstPDPushSrc;
+typedef struct _GstPDPushSrcClass GstPDPushSrcClass;
+
+/**
+ * GstFileSrc:
+ *
+ * Opaque #GstPDPushSrc structure.
+ */
+struct _GstPDPushSrc {
+  GstBaseSrc element;
+  GstPad *srcpad;
+
+  gchar *filename;                     /* filename */
+  gchar *uri;                          /* caching the URI */
+  gint fd;                             /* open file descriptor */
+  guint64 read_position;               /* position of fd */
+
+  gboolean seekable;                    /* whether the file is seekable */
+  gboolean is_regular;                  /* whether it's a (symlink to a)                                          regular file */
+
+  gboolean is_eos;
+
+};
+
+struct _GstPDPushSrcClass {
+  GstBaseSrcClass parent_class;
+};
+
+GType gst_pd_pushsrc_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_FILE_SRC_H__ */
diff --git a/toggle/Makefile.am b/toggle/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/toggle/src/Makefile.am b/toggle/src/Makefile.am
new file mode 100755 (executable)
index 0000000..4d761d7
--- /dev/null
@@ -0,0 +1,30 @@
+# plugindir is set in configure\r
+\r
+##############################################################################\r
+# change libgstplugin.la to something more suitable, e.g. libmysomething.la  #\r
+##############################################################################\r
+plugin_LTLIBRARIES = libgsttoggle.la\r
+\r
+##############################################################################\r
+# for the next set of variables, rename the prefix if you renamed the .la,   #\r
+#  e.g. libgstplugin_la_SOURCES => libmysomething_la_SOURCES                 #\r
+#       libgstplugin_la_CFLAGS  => libmysomething_la_CFLAGS                  #\r
+#       libgstplugin_la_LIBADD  => libmysomething_la_LIBADD                  #\r
+#       libgstplugin_la_LDFLAGS => libmysomething_la_LDFLAGS                 #\r
+##############################################################################\r
+\r
+# sources used to compile this plug-in\r
+libgsttoggle_la_SOURCES = gsttoggle.c\r
+                                 \r
+                                 \r
+\r
+# flags used to compile this plugin\r
+# add other _CFLAGS and _LIBS as needed\r
+libgsttoggle_la_CFLAGS = $(GST_CFLAGS) \r
+libgsttoggle_la_LIBADD = $(GST_LIBS)  $(GST_BASE_LIBS)  \r
+#libgsttoggle_la_LIBADD = $(GST_BASE_LIBS)  \r
+libgsttoggle_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)\r
+\r
+# headers we need but don't want installed\r
+noinst_HEADERS = gsttoggle.h\r
+\r
diff --git a/toggle/src/gsttoggle.c b/toggle/src/gsttoggle.c
new file mode 100755 (executable)
index 0000000..1f8d831
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * toggle
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <stdlib.h>
+
+#include "gsttoggle.h"
+#include <gst/gstmarshal.h>
+
+static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS_ANY);
+
+GST_DEBUG_CATEGORY_STATIC (gst_mytoggle_debug);
+#define GST_CAT_DEFAULT gst_mytoggle_debug
+
+enum
+{
+  LAST_SIGNAL
+};
+
+
+#define DEFAULT_BLOCK_DATA        FALSE
+
+enum
+{
+  PROP_0,
+  PROP_BLOCK_DATA
+};
+
+
+#define _do_init(bla) \
+    GST_DEBUG_CATEGORY_INIT (gst_mytoggle_debug, "toggle", 0, "toggle element");
+
+GST_BOILERPLATE_FULL (GstMytoggle, gst_mytoggle, GstBaseTransform,
+    GST_TYPE_BASE_TRANSFORM, _do_init);
+
+static void gst_mytoggle_finalize (GObject * object);
+static void gst_mytoggle_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_mytoggle_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
+static gboolean gst_mytoggle_event (GstBaseTransform * trans, GstEvent * event);
+static GstFlowReturn gst_mytoggle_transform_ip (GstBaseTransform * trans,
+    GstBuffer * buf);
+static gboolean gst_mytoggle_start (GstBaseTransform * trans);
+static gboolean gst_mytoggle_stop (GstBaseTransform * trans);
+
+static void
+gst_mytoggle_base_init (gpointer g_class)
+{
+  GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details_simple (gstelement_class,
+      "toggle",
+      "Generic",
+      "Pass data without modification", "Rahul Mittal <mittal.rahul@samsung.com>");
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&srctemplate));
+  gst_element_class_add_pad_template (gstelement_class,
+      gst_static_pad_template_get (&sinktemplate));
+}
+
+static void
+gst_mytoggle_finalize (GObject * object)
+{
+  GstMytoggle *mytoggle;
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_mytoggle_class_init (GstMytoggleClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstBaseTransformClass *gstbasetrans_class;
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gstbasetrans_class = GST_BASE_TRANSFORM_CLASS (klass);
+
+  gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_mytoggle_set_property);
+  gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_mytoggle_get_property);
+
+  g_object_class_install_property (gobject_class,
+      PROP_BLOCK_DATA, g_param_spec_boolean ("block_data",
+          "Data Block",
+          "Data Block", 
+          DEFAULT_BLOCK_DATA, G_PARAM_READWRITE));
+    
+  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_mytoggle_finalize);
+
+  gstbasetrans_class->event = GST_DEBUG_FUNCPTR (gst_mytoggle_event);
+  gstbasetrans_class->transform_ip =
+      GST_DEBUG_FUNCPTR (gst_mytoggle_transform_ip);
+  gstbasetrans_class->start = GST_DEBUG_FUNCPTR (gst_mytoggle_start);
+  gstbasetrans_class->stop = GST_DEBUG_FUNCPTR (gst_mytoggle_stop);
+}
+
+static void
+gst_mytoggle_init (GstMytoggle * mytoggle, GstMytoggleClass * g_class)
+{
+  gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (mytoggle), TRUE);
+
+  mytoggle->block_data = DEFAULT_BLOCK_DATA;
+
+}
+
+
+static gboolean
+gst_mytoggle_event (GstBaseTransform * trans, GstEvent * event)
+{
+  return TRUE;
+}
+
+static GstFlowReturn
+gst_mytoggle_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
+{
+  GstMytoggle *mytoggle = GST_MYTOGGLE (trans);
+  if (mytoggle->block_data ==TRUE) 
+      return GST_BASE_TRANSFORM_FLOW_DROPPED;
+
+  return GST_FLOW_OK;
+}
+
+static void
+gst_mytoggle_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstMytoggle *mytoggle;
+
+  mytoggle = GST_MYTOGGLE (object);
+
+  switch (prop_id) {
+  
+    case PROP_BLOCK_DATA:
+      mytoggle->block_data = g_value_get_boolean (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_mytoggle_get_property (GObject * object, guint prop_id, GValue * value,
+    GParamSpec * pspec)
+{
+  GstMytoggle *mytoggle;
+
+  mytoggle = GST_MYTOGGLE (object);
+
+  switch (prop_id) {
+      case PROP_BLOCK_DATA:
+      g_value_set_boolean (value, mytoggle->block_data);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+gst_mytoggle_start (GstBaseTransform * trans)
+{
+  return TRUE;
+}
+
+static gboolean
+gst_mytoggle_stop (GstBaseTransform * trans)
+{
+  return TRUE;
+}
+
+
+static gboolean plugin_init(GstPlugin *plugin)
+{
+
+       GST_DEBUG_CATEGORY_INIT (gst_mytoggle_debug, "toggle",0, "toggle");
+       return gst_element_register (plugin, "toggle",  GST_RANK_NONE, GST_TYPE_MYTOGGLE);
+}
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+       GST_VERSION_MINOR,
+       "toggle",
+       "Base transform plugin template",
+       plugin_init, VERSION, "LGPL", "Samsung Electronics Co", "http://www.samsung.com/")
+       
+
diff --git a/toggle/src/gsttoggle.h b/toggle/src/gsttoggle.h
new file mode 100755 (executable)
index 0000000..0090a6b
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * toggle
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __GST_MYTOGGLE_H__
+#define __GST_MYTOGGLE_H__
+
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+
+G_BEGIN_DECLS
+
+
+#define GST_TYPE_MYTOGGLE \
+  (gst_mytoggle_get_type())
+#define GST_MYTOGGLE(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MYTOGGLE,GstMytoggle))
+#define GST_MYTOGGLE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MYTOGGLE,GstMytoggleClass))
+#define GST_IS_MYTOGGLE(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MYTOGGLE))
+#define GST_IS_MYTOGGLE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MYTOGGLE))
+
+typedef struct _GstMytoggle GstMytoggle;
+typedef struct _GstMytoggleClass GstMytoggleClass;
+
+struct _GstMytoggle {
+  GstBaseTransform      element;
+  gboolean block_data;  
+};
+
+struct _GstMytoggleClass {
+  GstBaseTransformClass parent_class;
+};
+
+GType gst_mytoggle_get_type(void);
+
+G_END_DECLS
+
+#endif /* __GST_MYTOGGLE_H__ */
diff --git a/xvimagesrc/Makefile.am b/xvimagesrc/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/xvimagesrc/src/Makefile.am b/xvimagesrc/src/Makefile.am
new file mode 100644 (file)
index 0000000..a448b0e
--- /dev/null
@@ -0,0 +1,26 @@
+# plugindir is set in configure
+
+##############################################################################
+# change libgstplugin.la to something more suitable, e.g. libmysomething.la  #
+##############################################################################
+plugin_LTLIBRARIES = libgstxvimagesrc.la
+
+##############################################################################
+# for the next set of variables, rename the prefix if you renamed the .la,   #
+#  e.g. libgstplugin_la_SOURCES => libmysomething_la_SOURCES                 #
+#       libgstplugin_la_CFLAGS  => libmysomething_la_CFLAGS                  #
+#       libgstplugin_la_LIBADD  => libmysomething_la_LIBADD                  #
+#       libgstplugin_la_LDFLAGS => libmysomething_la_LDFLAGS                 #
+##############################################################################
+
+# sources used to compile this plug-in
+libgstxvimagesrc_la_SOURCES = gstxvimagesrc.c
+
+# flags used to compile this plugin
+# add other _CFLAGS and _LIBS as needed
+libgstxvimagesrc_la_CFLAGS = $(GST_CFLAGS)  $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(DRM_SLP_CFLAGS) $(DRI2_CFLAGS) $(X11_CFLAGS) $(XEXT_CFLAGS) $(XV_CFLAGS) $(XDAMAGE_CFLAGS) $(DRM_DEVEL_CFLAGS) $(DRM_CFLAGS)
+libgstxvimagesrc_la_LIBADD = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(DRM_SLP_LIBS)$(DRI2_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(XV_LIBS) $(XDAMAGE_LIBS) $(DRM_LIBS) $(DRM_DEVEL_LIBS)
+libgstxvimagesrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+# headers we need but don't want installed
+noinst_HEADERS = gstxvimagesrc.h
diff --git a/xvimagesrc/src/gstxvimagesrc.c b/xvimagesrc/src/gstxvimagesrc.c
new file mode 100755 (executable)
index 0000000..066d1ff
--- /dev/null
@@ -0,0 +1,1248 @@
+/*
+ * xvimagesrc
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hyunil Park <hyunil46.park@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+/**
+* SECTION:element-xvimagesrc
+*
+* xvimagesrc captures frame buffer which includes the application data along with video layer data
+* from the XServer and pushes the data to the downstream element.
+*
+*
+* <refsect2>
+* <title>Example launch line</title>
+* |[
+* gst-launch xvimagesrc ! "video/x-raw-yuv, width=720, height=1280, framerate=(fraction)30/1, format=(fourcc)ST12" ! fakesink
+* ]| captures the frame buffer from the XServer and send the buffers to a fakesink.
+* </refsect2>
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstxvimagesrc.h"
+
+/* headers for drm */
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <X11/Xmd.h>
+#include <X11/Xlibint.h>
+#include <dri2.h>
+#include <drm.h>
+#include <sys/time.h>
+#include <sys/times.h>
+#include <exynos_drm.h>
+
+GST_DEBUG_CATEGORY_STATIC (xvimagesrc_debug);
+#define GST_CAT_DEFAULT xvimagesrc_debug
+
+
+#define GST_XV_IMAGE_SRC_CAPS                    \
+  "video/x-raw-rgb, "                            \
+  "bpp = (int) 32, "                             \
+  "depth = (int) 24, "                           \
+  "endianness = (int) BIG_ENDIAN, "              \
+  "red_mask = (int) 0xFF000000, "                \
+  "green_mask = (int) 0x00FF0000, "              \
+  "blue_mask = (int) 0x0000FF00, "               \
+  "width  = (int)  [ 16, 4096 ], "               \
+  "height = (int)  [ 16, 4096 ], "               \
+  "framerate = (fraction) [0/1, 2147483647/1];"  \
+  "video/x-raw-yuv,"                             \
+  "format = (fourcc) { SN12, ST12 }, "                 \
+  "width = (int) [ 1, 4096 ], "                  \
+  "height = (int) [ 1, 4096 ], "                 \
+  "framerate = (fraction) [0/1, 2147483647/1];"  \
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+  GST_PAD_SRC,
+  GST_PAD_ALWAYS,
+  GST_STATIC_CAPS(GST_XV_IMAGE_SRC_CAPS)
+);
+
+enum
+{
+  PROP_0
+};
+
+enum
+{
+  VIDEO_TYPE_VIDEO_WITH_UI,
+  VIDEO_TYPE_VIDEO_ONLY,
+};
+
+enum
+{
+  SIGNAL_VIDEO_WITH_UI = 0,
+  SIGNAL_VIDEO_ONLY,
+  SIGNAL_LAST
+};
+#define GEM_NAME_MAX                6
+
+#define SCMN_CS_YUV420              1 /* Y:U:V 4:2:0 */
+#define SCMN_CS_I420                SCMN_CS_YUV420 /* Y:U:V */
+#define SCMN_CS_NV12                6
+#define SCMN_CS_NV12_T64X32         11 /* 64x32 Tiled NV12 type */
+#define SCMN_CS_UYVY                100
+#define SCMN_CS_YUYV                101
+#define SCMN_CS_YUY2                SCMN_CS_YUYV
+
+/* max channel count *********************************************************/
+#define SCMN_IMGB_MAX_PLANE         (4)
+
+/* image buffer definition ***************************************************
+
+    +------------------------------------------+ ---
+    |                                          |  ^
+    |     a[], p[]                             |  |
+    |     +---------------------------+ ---    |  |
+    |     |                           |  ^     |  |
+    |     |<---------- w[] ---------->|  |     |  |
+    |     |                           |  |     |  |
+    |     |                           |        |
+    |     |                           |  h[]   |  e[]
+    |     |                           |        |
+    |     |                           |  |     |  |
+    |     |                           |  |     |  |
+    |     |                           |  v     |  |
+    |     +---------------------------+ ---    |  |
+    |                                          |  v
+    +------------------------------------------+ ---
+
+    |<----------------- s[] ------------------>|
+*/
+
+typedef struct
+{
+  /* width of each image plane */
+  int w[SCMN_IMGB_MAX_PLANE];
+  /* height of each image plane */
+  int h[SCMN_IMGB_MAX_PLANE];
+  /* stride of each image plane */
+  int s[SCMN_IMGB_MAX_PLANE];
+  /* elevation of each image plane */
+  int e[SCMN_IMGB_MAX_PLANE];
+  /* user space address of each image plane */
+  void *a[SCMN_IMGB_MAX_PLANE];
+  /* physical address of each image plane, if needs */
+  void *p[SCMN_IMGB_MAX_PLANE];
+  /* color space type of image */
+  int cs;
+  /* left postion, if needs */
+  int x;
+  /* top position, if needs */
+  int y;
+  /* to align memory */
+  int __dummy2;
+  /* arbitrary data */
+  int data[16];
+  /* dmabuf fd */
+  gint32 fd[SCMN_IMGB_MAX_PLANE];
+  /* flag for buffer share */
+  int buf_share_method;
+} SCMN_IMGB;
+
+typedef struct
+{
+  void  *address[GEM_NAME_MAX];
+  int buffer_size[GEM_NAME_MAX];
+  int name[GEM_NAME_MAX];
+  gint32 fd[GEM_NAME_MAX];
+  gint32 handle[GEM_NAME_MAX];
+} GEM_MMAP;
+
+typedef enum {
+ BUF_SHARE_METHOD_PADDR = 0,
+ BUF_SHARE_METHOD_FD
+} buf_share_method_t;
+
+#define DEFAULT_USER_AGENT           "GStreamer xvimagesrc "
+
+static guint gst_xv_image_src_signals[SIGNAL_LAST] = { 0 };
+
+#define BASE_TIME 33000
+#define LIMIT_TIME -33000
+//#define COUNT_FRAMES
+#ifdef COUNT_FRAMES
+gchar old_time[10] = {0, };
+#endif
+static gboolean error_caught = FALSE;
+
+static void gst_xv_image_src_finalize (GObject * gobject);
+
+static void gst_xv_image_src_set_property (GObject *object, guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_xv_image_src_get_property (GObject *object, guint prop_id, GValue * value, GParamSpec * pspec);
+static GstFlowReturn gst_xv_image_src_create (GstPushSrc * psrc, GstBuffer ** outbuf);
+static gboolean gst_xv_image_src_start (GstBaseSrc * bsrc);
+static gboolean gst_xv_image_src_stop (GstBaseSrc * bsrc);
+static gboolean gst_xv_image_src_get_size (GstBaseSrc * bsrc, guint64 * size);
+static gboolean gst_xv_image_src_is_seekable (GstBaseSrc * bsrc);
+static gboolean gst_xv_image_src_query (GstBaseSrc * bsrc, GstQuery * query);
+static gboolean gst_xv_image_src_unlock (GstBaseSrc * bsrc);
+static gboolean gst_xv_image_src_unlock_stop (GstBaseSrc * bsrc);
+static gboolean gst_xv_image_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
+
+static drm_slp_bufmgr bufmgr_get (Display *dpy, Pixmap pixmap);
+static int port_get (Display *dpy, unsigned int id);
+static void pixmap_update (GstXVImageSrc * src,Display *dpy, drm_slp_bufmgr bufmgr, Pixmap pixmap,
+               int x, int y, int width, int height);
+static Pixmap pixmap_create (GstXVImageSrc * src, Display *dpy, int width, int height);
+
+static void* gst_xv_image_src_update_thread (void * asrc);
+static gboolean xvimagesrc_thread_start(GstXVImageSrc *src);
+static void drm_init(GstXVImageSrc *src);
+static void drm_finalize(GstXVImageSrc *src);
+static gint32 drm_convert_gem_to_fd(int * gemname_cnt, int drm_fd, unsigned int name,  void * data, void **virtual_address);
+static void gst_xv_get_image_sleep(void *asrc, double duration);
+
+static void
+_do_init (GType type)
+{
+  GST_DEBUG_CATEGORY_INIT (xvimagesrc_debug, "xvimagesrc", 0, "Xv image src");
+}
+
+GST_BOILERPLATE_FULL (GstXVImageSrc, gst_xv_image_src, GstPushSrc, GST_TYPE_PUSH_SRC, _do_init);
+
+static void
+gst_xv_image_src_base_init (gpointer g_class)
+{
+  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+  gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&srctemplate));
+  gst_element_class_set_details_simple (element_class, "XServer Display FB video source",
+    "Source/video",
+    "Receive frame buffer data from XServer and passes to next element",
+    "");
+}
+
+static void
+gst_xv_image_src_class_init (GstXVImageSrcClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstBaseSrcClass *gstbasesrc_class;
+  GstPushSrcClass *gstpushsrc_class;
+  gobject_class = (GObjectClass *) klass;
+  gstbasesrc_class = (GstBaseSrcClass *) klass;
+  gstpushsrc_class = (GstPushSrcClass *) klass;
+  gobject_class->set_property = gst_xv_image_src_set_property;
+  gobject_class->get_property = gst_xv_image_src_get_property;
+  gobject_class->finalize = gst_xv_image_src_finalize;
+
+  gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_xv_image_src_start);
+  gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_xv_image_src_stop);
+  gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_xv_image_src_unlock);
+  gstbasesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_xv_image_src_unlock_stop);
+  gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_xv_image_src_get_size);
+  gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_xv_image_src_is_seekable);
+  gstbasesrc_class->query = GST_DEBUG_FUNCPTR (gst_xv_image_src_query);
+  gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_xv_image_src_setcaps);
+  gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_xv_image_src_create);
+
+  gst_xv_image_src_signals[SIGNAL_VIDEO_WITH_UI] =
+     g_signal_new ("video-with-ui", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+     G_STRUCT_OFFSET (GstXVImageSrcClass, video_with_ui), NULL, NULL,
+     g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
+
+  gst_xv_image_src_signals[SIGNAL_VIDEO_ONLY] =
+     g_signal_new ("video-only", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+     G_STRUCT_OFFSET (GstXVImageSrcClass, video_only), NULL, NULL,
+     g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
+
+}
+
+static gboolean gst_xv_image_src_get_frame_size(int fourcc, int width, int height, unsigned int *outsize)
+{
+  switch (fourcc) {
+/* case GST_MAKE_FOURCC('I','4','2','0'):      // V4L2_PIX_FMT_YUV420
+    *outsize = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
+    *outsize += 2 * ((GST_ROUND_UP_8 (width) / 2) * (GST_ROUND_UP_2 (height) / 2));
+    break;*/
+  case GST_MAKE_FOURCC('S','N','1','2'):       // V4L2_PIX_FMT_NV12 non-linear
+     GST_INFO("SN12");
+  case GST_MAKE_FOURCC('S','T','1','2'):       // V4L2_PIX_FMT_NV12 tiled non-linear
+     GST_INFO("ST12");
+    *outsize = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
+    *outsize += (GST_ROUND_UP_4 (width) * height) / 2;
+    break;
+  case GST_MAKE_FOURCC('R','G','B','4'):
+    /* jpeg size can't be calculated here. */
+    *outsize = width * height * 4;
+    break;
+  default:
+    /* unkown format!! */
+    *outsize = 0;
+    return FALSE;
+  }
+  return TRUE;
+}
+
+static gboolean
+gst_xv_image_src_parse_caps (const GstCaps * caps, guint32 *fourcc,
+  gint * width, gint * height, gint * rate_numerator, gint * rate_denominator, unsigned int *framesize)
+{
+  const GstStructure *structure;
+  GstPadLinkReturn ret = TRUE;
+  const GValue *framerate;
+  const char *media_type = NULL;
+  GST_DEBUG ("parsing caps");
+  if (gst_caps_get_size (caps) < 1) return FALSE;
+  GST_INFO("xvimagesrc src caps:%"GST_PTR_FORMAT, caps);
+  structure = gst_caps_get_structure (caps, 0);
+  ret = gst_structure_get_int (structure, "width", width);
+  if(!ret) {
+    GST_ERROR ("xvimagesrc width not specified in caps");
+    goto error;
+  }
+  ret = gst_structure_get_int (structure, "height", height);
+  if(!ret) {
+    GST_ERROR ("xvimagesrc height not specified in caps");
+    goto error;
+  }
+  media_type = gst_structure_get_name (structure);
+  if(media_type == NULL) {
+    GST_ERROR ("xvimagesrc media type not specified in caps");
+    goto error;
+  }
+  framerate = gst_structure_get_value (structure, "framerate");
+  if (framerate) {
+    *rate_numerator = gst_value_get_fraction_numerator (framerate);
+    *rate_denominator = gst_value_get_fraction_denominator (framerate);
+  } else {
+    GST_ERROR ("xvimagesrc frametype not specified in caps");
+    goto error;
+  }
+  if (g_strcmp0 (media_type, "video/x-raw-rgb") == 0) {
+    gst_xv_image_src_get_frame_size(FOURCC_RGB32, *width, *height, framesize);
+    *fourcc = FOURCC_RGB32;
+    GST_DEBUG ("Caps set to RGB32");
+  } else if(g_strcmp0 (media_type, "video/x-raw-yuv") == 0) {
+
+    GST_INFO ("media_type is video/x-raw-yuv");
+    guint32 format = FOURCC_SN12;
+    ret = gst_structure_get_fourcc (structure, "format", &format);
+    if (!ret) GST_DEBUG ("xvimagesrc format not specified in caps, SN12 selected as default");
+    ret = gst_xv_image_src_get_frame_size(format, *width, *height, framesize);
+    if(!ret) {
+      GST_ERROR ("xvimagesrc unsupported format type specified in caps");
+      goto error;
+    }
+    *fourcc = format;
+  }
+  return TRUE;
+/* ERRORS */
+error:
+    return FALSE;
+}
+
+static gboolean gst_xv_image_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
+{
+  gboolean res = TRUE;
+  gint width, height, rate_denominator, rate_numerator;
+  GstXVImageSrc *src;
+  src = GST_XV_IMAGE_SRC (bsrc);
+  res = gst_xv_image_src_parse_caps (caps, &src->format_id, &width, &height,
+    &rate_numerator, &rate_denominator, &src->framesize);
+  if (res) {
+    /* looks ok here */
+    src->width = width;
+    src->height = height;
+    src->rate_numerator = rate_numerator;
+    src->rate_denominator = rate_denominator;
+    GST_DEBUG_OBJECT (src, "size %dx%d, %d/%d fps",
+      src->width, src->height,
+      src->rate_numerator, src->rate_denominator);
+  }
+  xvimagesrc_thread_start(src);
+  return res;
+}
+static void
+gst_xv_image_src_reset (GstXVImageSrc * src)
+{
+}
+
+static void
+gst_xv_image_src_init (GstXVImageSrc * src, GstXVImageSrcClass * g_class)
+{
+  src->format_id = 0;
+  src->running_time = GST_CLOCK_TIME_NONE;
+  src->frame_duration = GST_CLOCK_TIME_NONE;
+  src->virtual = NULL;
+  src->bo = NULL;
+  src->dri2_buffers = NULL;
+  src->queue_lock = g_mutex_new ();
+  src->queue = g_queue_new ();
+  src->queue_cond = g_cond_new ();
+  src->cond_lock = g_mutex_new ();
+  src->drm_fd = -1;
+  src->current_data_type = VIDEO_TYPE_VIDEO_WITH_UI;
+  src->new_data_type = VIDEO_TYPE_VIDEO_WITH_UI;
+  src->get_image_overtime = 0;
+  src->get_image_overtime_cnt = 0;
+  src->gemname_cnt = 0;
+  drm_init(src);
+}
+
+static void
+gst_xv_image_src_finalize (GObject * gobject)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (gobject);
+  GST_DEBUG_OBJECT (src, "finalize");
+  drm_finalize(src);
+  G_OBJECT_CLASS (parent_class)->finalize (gobject);
+}
+static void drm_init(GstXVImageSrc *src)
+{
+  Display *dpy;
+  int eventBase, errorBase;
+  int dri2Major, dri2Minor;
+  char *driverName, *deviceName;
+  struct drm_auth auth_arg = {0};
+
+  src->drm_fd = -1;
+  dpy = XOpenDisplay(0);
+
+  /* DRI2 */
+  if (!DRI2QueryExtension(dpy, &eventBase, &errorBase)) {
+    GST_ERROR("DRI2QueryExtension !!");
+    return;
+  }
+  if (!DRI2QueryVersion(dpy, &dri2Major, &dri2Minor)) {
+   GST_ERROR("DRI2QueryVersion !!");
+   return;
+  }
+  if (!DRI2Connect(dpy, RootWindow(dpy, DefaultScreen(dpy)), &driverName, &deviceName)) {
+    GST_ERROR("DRI2Connect !!");
+    return;
+  }
+  GST_INFO("Open drm device : %s", deviceName);
+
+  /* get the drm_fd though opening the deviceName */
+  src->drm_fd = open(deviceName, O_RDWR);
+  if (src->drm_fd < 0) {
+    GST_ERROR("cannot open drm device (%s)", deviceName);
+    return;
+  }
+
+  /* get magic from drm to authentication */
+  if (ioctl(src->drm_fd, DRM_IOCTL_GET_MAGIC, &auth_arg)) {
+    GST_ERROR("cannot get drm auth magic");
+    close(src->drm_fd);
+    src->drm_fd = -1;
+    return;
+  }
+  if (!DRI2Authenticate(dpy, RootWindow(dpy, DefaultScreen(dpy)), auth_arg.magic)) {
+    GST_ERROR("cannot get drm authentication from X");
+    close(src->drm_fd);
+    src->drm_fd = -1;
+    return;
+  }
+}
+static void drm_finalize(GstXVImageSrc *src)
+{
+  if (src->drm_fd >= 0) {
+    close(src->drm_fd);
+    src->drm_fd = -1;
+  }
+}
+static gint32 drm_convert_gem_to_fd(int *gemname_cnt, int drm_fd, unsigned int name, void  *data, void **virtual_address)
+{
+  g_return_val_if_fail((data != NULL),0);
+  int count=0;
+  gint32 fd = 0;
+  count = *gemname_cnt;
+  GST_DEBUG("gamname_cnt = %d", count);
+  GST_DEBUG("name = %u", name);
+
+
+  GEM_MMAP *xv_gem_mmap = NULL;
+  xv_gem_mmap = (GEM_MMAP *) data;
+  if(count >=GEM_NAME_MAX)
+    goto PASS;
+
+  if (count < GEM_NAME_MAX ) {
+    int i =0;
+    for ( i =0 ; i < GEM_NAME_MAX ; i++) {
+      if (name == xv_gem_mmap->name[i])
+       goto PASS;
+    }
+
+    struct drm_prime_handle prime;
+    struct drm_gem_open gem_open;
+    struct drm_exynos_gem_mmap gem_mmap; //for virtual address
+
+    memset (&gem_open, 0, sizeof (struct drm_gem_open));
+    gem_open.name = name;
+    if (ioctl(drm_fd, DRM_IOCTL_GEM_OPEN, &gem_open)) {
+      GST_ERROR("Gem Open failed");
+      return 0;
+    }
+    memset (&prime, 0, sizeof (struct drm_prime_handle));
+    prime.handle = gem_open.handle;
+    prime.flags = DRM_CLOEXEC;
+    /*get gem_open handle*/
+    xv_gem_mmap->handle[count] = gem_open.handle;
+    GST_DEBUG("gem_open.handle =%d, xv_gem_mmap->handle[count]=%d", gem_open.handle, xv_gem_mmap->handle[count]);
+    /*get virtual address */
+    /*set name*/
+    xv_gem_mmap->name[count] = name;
+    memset (&gem_mmap, 0, sizeof (struct drm_exynos_gem_mmap));
+    gem_mmap.handle = prime.handle;
+    gem_mmap.size = gem_open.size;
+    /*set size*/
+    xv_gem_mmap->buffer_size[count] = gem_mmap.size;
+    if (drmIoctl(drm_fd, DRM_IOCTL_EXYNOS_GEM_MMAP, &gem_mmap) !=0) {
+      GST_ERROR("Gem mmap failed [handle %d, size %d]", gem_mmap.handle, gem_mmap.size);
+      return 0;
+    }
+    /*set virtual address*/
+    xv_gem_mmap->address[count] = (void *)(gem_mmap.mapped);
+    GST_DEBUG ("%d - Virtual address[%d] = %p size=%d ", name, count, xv_gem_mmap->address[count],  xv_gem_mmap->buffer_size[count] );
+
+    /*get fd*/
+    if (ioctl(drm_fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &prime) < 0) {
+      GST_ERROR("Gem Handle to Fd failed");
+      return 0;
+    }
+    xv_gem_mmap->fd[count] = prime.fd;
+    GST_DEBUG("fd = %d", xv_gem_mmap->fd[count]);
+  }
+
+  if (count < GEM_NAME_MAX) {
+    count ++;
+    *gemname_cnt = count;
+  }
+
+PASS:
+
+  if (name == xv_gem_mmap->name[0]) {
+    *virtual_address = xv_gem_mmap->address[0];
+    fd = xv_gem_mmap->fd[0];
+  } else if (name == xv_gem_mmap->name[1]) {
+    *virtual_address = xv_gem_mmap->address[1];
+     fd = xv_gem_mmap->fd[1];
+  } else if (name == xv_gem_mmap->name[2]) {
+    *virtual_address = xv_gem_mmap->address[2];
+     fd = xv_gem_mmap->fd[2];
+  } else if ( name == xv_gem_mmap->name[3]) {
+    *virtual_address = xv_gem_mmap->address[3];
+     fd = xv_gem_mmap->fd[3];
+  } else if (name == xv_gem_mmap->name[4]) {
+    *virtual_address = xv_gem_mmap->address[4];
+     fd = xv_gem_mmap->fd[4];
+  } else if ( name == xv_gem_mmap->name[5]) {
+    *virtual_address = xv_gem_mmap->address[5];
+     fd = xv_gem_mmap->fd[5];
+  }
+
+  GST_DEBUG("virtual_address = %p  fd = %d", *virtual_address, fd);
+  return fd;
+}
+static void
+gst_xv_image_src_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (object);
+  GST_INFO ("set property function %x", src);
+  switch (prop_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    break;
+  }
+  return;
+}
+
+static void
+gst_xv_image_src_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (object);
+  GST_INFO ("get property function %x", src);
+  switch (prop_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    break;
+  }
+}
+
+static inline GstClockTime xvimagesrc_clock (GstXVImageSrc *src)
+{
+  struct timeval tv;
+  gettimeofday (&tv, NULL);
+  if(!src->base_time) {
+    src->base_time = GST_TIMEVAL_TO_TIME(tv);
+  }
+  return (GstClockTime)(GST_TIMEVAL_TO_TIME(tv) - src->base_time);
+}
+
+static gboolean gst_xv_image_src_get_timeinfo(GstXVImageSrc *src, GstBuffer *buffer)
+{
+  int fps_nu = 0;
+  int fps_de = 0;
+  GstClockTime timestamp = GST_CLOCK_TIME_NONE;
+  GstClockTime duration = GST_CLOCK_TIME_NONE;
+
+  if (!src || !buffer) {
+    GST_WARNING("Invalid pointer [hadle:%p, buffer:%p]", src, buffer);
+    return FALSE;
+  }
+  timestamp = xvimagesrc_clock(src);
+  /* if we have a framerate adjust timestamp for frame latency */
+  if ((int)((float)src->rate_numerator / (float)src->rate_denominator) <= 0) {
+    /*if fps is zero, auto fps mode*/
+    fps_nu = 0;
+    fps_de = 1;
+  } else {
+    fps_nu = 1;
+    fps_de = (int)((float)src->rate_numerator / (float)src->rate_denominator);
+  }
+  if (fps_nu > 0 && fps_de > 0) {
+    GstClockTime latency;
+    latency = gst_util_uint64_scale_int(GST_SECOND, fps_nu, fps_de);
+    duration = latency;
+  }
+  GST_BUFFER_TIMESTAMP(buffer) = timestamp;
+  GST_BUFFER_DURATION(buffer) = duration;
+  return TRUE;
+}
+#ifdef COUNT_FRAMES
+static  int fps = 0;
+
+static gchar *get_current_system_time()
+{
+       gchar target[10]={0,};
+       time_t t;
+       struct tm tm;
+
+       t = time(NULL);
+       tzset();
+       /*localtimer_r : available since libc 5.2.5*/
+       if(localtime_r(&t, &tm) == NULL) {
+               return NULL;
+       }
+       snprintf(target, sizeof(target), "%02i:%02i:%02i", tm.tm_hour, tm.tm_min, tm.tm_sec);
+       return g_strdup(target);
+}
+#endif
+static void gst_xv_get_image_sleep(void *asrc, double duration)
+{
+    GstXVImageSrc *src = (GstXVImageSrc *)asrc;
+    g_return_if_fail(src != NULL);
+    double sleep_time = 0;
+    sleep_time = (double)BASE_TIME - duration;
+    if (sleep_time < 0) {
+       src->get_image_overtime_cnt ++;
+       src->get_image_overtime += sleep_time;
+       if (src->get_image_overtime_cnt > 2)
+         src->get_image_overtime = 0;
+       if (src->get_image_overtime <= (double)LIMIT_TIME)
+         src->get_image_overtime = 0;
+    } else if (sleep_time > 0) {
+       src->get_image_overtime_cnt = 0;
+       sleep_time = sleep_time + src->get_image_overtime;
+       src->get_image_overtime = (sleep_time < 0) ? sleep_time : 0;
+       if (sleep_time >0) {
+          usleep(sleep_time);
+       }
+    }
+}
+static GstFlowReturn
+gst_xv_image_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
+{
+  GstXVImageSrc *src;
+  GstBuffer *outbuf = NULL;
+  src = GST_XV_IMAGE_SRC (psrc);
+  g_mutex_lock (src->queue_lock);
+  if(g_queue_is_empty (src->queue)) {
+    g_mutex_unlock (src->queue_lock);
+    g_cond_wait(src->queue_cond, src->cond_lock);
+    g_mutex_lock (src->queue_lock);
+    outbuf = (GstBuffer *)g_queue_pop_head(src->queue);
+    g_mutex_unlock (src->queue_lock);
+  }
+  else {
+    GstBuffer *tempbuf = NULL;
+    while((tempbuf = (GstBuffer *)g_queue_pop_head(src->queue)) != NULL) outbuf = tempbuf;    // To reduce latency, skipping the old frames and submitting only latest frames
+    g_mutex_unlock (src->queue_lock);
+  }
+  if(outbuf == NULL) return GST_FLOW_ERROR;
+  GST_INFO("Time stamp of the buffer is %"GST_TIME_FORMAT, GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(outbuf)));
+  *buffer = outbuf;
+#ifdef COUNT_FRAMES
+    gchar *current_time = NULL;
+    current_time =     get_current_system_time();
+    if (strncmp(current_time, old_time, 10) == 0) {
+       fps ++;
+       strncpy(old_time, current_time, 10);
+    } else {
+       g_printf("xvimagesrc %s - fps : %d\n", old_time, fps);
+       fps = 1;
+       strncpy(old_time, current_time, 10);
+    }
+#endif
+
+  return GST_FLOW_OK;
+}
+
+static gboolean xvimagesrc_thread_start(GstXVImageSrc *src)
+{
+  GError *error;
+  if(!src->updates_thread) src->updates_thread = g_thread_create ((GThreadFunc) gst_xv_image_src_update_thread, src, TRUE, &error);
+  else GST_LOG_OBJECT (src, "The thread function already running");
+  return TRUE;
+}
+
+static gboolean
+gst_xv_image_src_start (GstBaseSrc * bsrc)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (bsrc);
+  if(src->format_id) xvimagesrc_thread_start(src);
+  return TRUE;
+}
+
+gboolean signal_emit_func(void *asrc)
+{
+    GstXVImageSrc *src = (GstXVImageSrc *)asrc;
+    if (src->current_data_type == VIDEO_TYPE_VIDEO_ONLY) {
+      g_signal_emit (src, gst_xv_image_src_signals[SIGNAL_VIDEO_ONLY] , 0, NULL);
+   } else if (src->current_data_type == VIDEO_TYPE_VIDEO_WITH_UI) {
+     g_signal_emit (src, gst_xv_image_src_signals[SIGNAL_VIDEO_WITH_UI] , 0, NULL);
+   }
+    return FALSE;
+}
+
+static int
+gst_xvimagesrc_handle_xerror (Display * display, XErrorEvent * xevent)
+{
+  char error_msg[1024];
+
+  XGetErrorText (display, xevent->error_code, error_msg, 1024);
+  GST_DEBUG ("XError. error: %s", error_msg);
+  error_caught = TRUE;
+  return 0;
+}
+
+//static gboolean first_frame=TRUE;
+static void* gst_xv_image_src_update_thread (void * asrc)
+{
+  GstXVImageSrc *src = (GstXVImageSrc *)asrc;
+  g_return_val_if_fail((src != NULL),NULL);
+
+  struct drm_gem_close gem_close;
+  gboolean drop_frame = FALSE;
+  int i=0;
+  GEM_MMAP *xv_gem_mmap = NULL;
+  xv_gem_mmap = (GEM_MMAP *)malloc(sizeof(GEM_MMAP));
+  g_return_val_if_fail((xv_gem_mmap != NULL),NULL);
+
+  memset(xv_gem_mmap, 0, sizeof(GEM_MMAP));
+
+  GST_LOG_OBJECT (src, "The thread function start");
+  {
+    int damage_err_base = 0;
+    Atom atom_format = 0;
+    src->dpy = XOpenDisplay (NULL);
+    src->p = port_get (src->dpy, src->format_id);
+    if (src->p < 0) goto finish;
+    /*src->width and src->height is set by caps info */
+    GST_DEBUG (" width and height of caps : %dx%d ", src->width, src->height);
+    if (src->width == 0 || src->height == 0) goto finish;
+    GST_DEBUG ("gst_xv_image_src_update_thread pixmap_create !!");
+    src->pixmap = pixmap_create (src, src->dpy, src->width, src->height);
+    GST_DEBUG ("gst_xv_image_src_update_thread pixmap_create !!");
+    src->gc = XCreateGC (src->dpy, src->pixmap, 0, 0);
+    GST_DEBUG ("gst_xv_image_src_update_thread XCreateGC !!");
+    src->bufmgr = bufmgr_get (src->dpy, src->pixmap);
+    if (!src->bufmgr) goto finish;
+    GST_DEBUG ("gst_xv_image_src_update_thread bufmgr_get !!");
+    if (!XDamageQueryExtension(src->dpy, &src->damage_base, &damage_err_base)) goto finish;
+    GST_DEBUG ("gst_xv_image_src_update_thread XDamageQueryExtension !!");
+    src->damage = XDamageCreate (src->dpy, src->pixmap, XDamageReportNonEmpty);
+    atom_format = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_FORMAT", False);
+    src->atom_stream_off = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_STREAM_OFF", False);
+    XvSetPortAttribute (src->dpy, src->p, atom_format, src->format_id);
+#if 0
+    /*set Xorg write-back hz*/
+    atom_fps = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_FPS", False);
+    GST_DEBUG("frame rate of caps %d", src->rate_numerator);
+    XvSetPortAttribute (src->dpy, src->p, atom_fps, src->rate_numerator);
+    GST_DEBUG ("gst_xv_image_src_update_thread XvSetPortAttribute !!");
+#endif
+  }
+  while(!src->thread_return) {
+    struct timeval start_time, end_time;
+    gettimeofday(&start_time, NULL);
+    double duration = 0;
+    GstBuffer *outbuf = NULL;
+    XEvent ev;
+    int eventcount = 0;
+    void *virtual_address = NULL;
+    int (*handler) (Display *, XErrorEvent *);
+    /*get data type*/
+    Atom atom_data_type = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_DATA_TYPE", False);
+    XvGetPortAttribute (src->dpy, src->p, atom_data_type, &(src->new_data_type));
+    if (src->current_data_type != src->new_data_type) {
+          src->current_data_type = src->new_data_type;
+          GST_DEBUG("current_data_type : %s \n", (src->current_data_type)?"Video":"UI+Video");
+          g_timeout_add(1, signal_emit_func, src);
+    }
+    XSync(src->dpy, 0);
+    error_caught = FALSE;
+    GST_DEBUG ("gst_xv_image_src_update_thread XSetErrorHandler in !!");
+    handler = XSetErrorHandler (gst_xvimagesrc_handle_xerror);
+    GST_INFO ("gst_xv_image_src_update_thread XSetErrorHandler !!");
+    GST_INFO ("gst_xv_image_src_update_thread XvGetStill in !!");
+    XvGetStill (src->dpy, src->p, src->pixmap, src->gc, 0, 0, src->width, src->height, 0, 0, src->width, src->height);
+    GST_INFO ("gst_xv_image_src_update_thread XvGetStill !!");
+    XSync (src->dpy, 0);
+    if (error_caught) {
+       GST_ERROR("gst_xv_image_src_update_thread error_caught is TRUE");
+       error_caught = FALSE;
+       XSetErrorHandler(handler);
+       continue;
+    }
+    /*reset error handler*/
+    error_caught = FALSE;
+    XSetErrorHandler(handler);
+
+    GST_INFO ("gst_xv_image_src_update_thread XSync !!");
+    eventcount = XPending (src->dpy);
+    GST_INFO ("gst_xv_image_src_update_thread XPending %d",eventcount);
+    XNextEvent (src->dpy, &ev); /* wating for x event */
+    GST_INFO ("gst_xv_image_src_update_thread XNextEvent !!");
+    if (ev.type == (src->damage_base + XDamageNotify)) {
+      XDamageNotifyEvent *damage_ev = (XDamageNotifyEvent *)&ev;
+    GST_INFO ("gst_xv_image_src_update_thread XDamageNotifyEvent");
+      if (damage_ev->drawable == src->pixmap) {
+        pixmap_update (src, src->dpy, src->bufmgr, src->pixmap,
+        damage_ev->area.x,
+        damage_ev->area.y,
+        damage_ev->area.width,
+        damage_ev->area.height);
+             GST_INFO("gst_xv_image_src_update_thread pixmap_update");
+      }
+      XDamageSubtract (src->dpy, src->damage, None, None );
+      GST_INFO ("gst_xv_image_src_update_thread XDamageSubtract");
+    }
+    if(!src->virtual) continue;
+    if(src->format_id == FOURCC_RGB32) {
+      outbuf = gst_buffer_new_and_alloc (src->framesize);
+      gst_buffer_set_caps (outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
+      memcpy(GST_BUFFER_DATA (outbuf), src->virtual, src->framesize);
+    } else if (src->format_id == FOURCC_SN12) {
+      XV_GETSTILL_DATA_PTR data = (XV_GETSTILL_DATA_PTR)src->virtual;
+      int error = XV_GETSTILL_VALIDATE_DATA (data);
+      outbuf = gst_buffer_new();
+      gst_buffer_set_caps (outbuf, GST_PAD_CAPS (GST_BASE_SRC_PAD (src)));
+      if (error == XV_HEADER_ERROR)
+        GST_ERROR ("XV_HEADER_ERROR\n");
+      else if (error == XV_VERSION_MISMATCH)
+        GST_ERROR ("XV_VERSION_MISMATCH\n");
+      else
+      {
+        SCMN_IMGB *psimgb = NULL;
+        psimgb = (SCMN_IMGB *)malloc(sizeof(SCMN_IMGB));
+        if (psimgb == NULL) {
+          GST_ERROR_OBJECT(src, "failed to alloc SCMN_IMGB");
+          return NULL;
+        }
+        memset(psimgb, 0x00, sizeof(SCMN_IMGB));
+        if (data->BufType == XV_BUF_TYPE_LEGACY) {
+          psimgb->p[0] = (void *)data->YBuf;
+          psimgb->p[1] = (void *)data->CbBuf;
+          psimgb->buf_share_method = BUF_SHARE_METHOD_PADDR;
+          psimgb->a[0] = NULL;
+          psimgb->a[1] = NULL;
+        } else if (data->BufType == XV_BUF_TYPE_DMABUF) {
+          psimgb->fd[0] = drm_convert_gem_to_fd(&src->gemname_cnt, src->drm_fd, (void *)data->YBuf, xv_gem_mmap, &virtual_address);
+          psimgb->a[0] = virtual_address;
+          GST_DEBUG("YBuf gem to fd[0]=%d virtual_address = %p", psimgb->fd[0], psimgb->a[0]);
+          psimgb->fd[1] = drm_convert_gem_to_fd(&src->gemname_cnt, src->drm_fd, (void *)data->CbBuf, xv_gem_mmap, &virtual_address);
+          psimgb->a[1] = virtual_address;
+          GST_DEBUG("CbBuf gem to fd[1]=%d  virtual_address = %p", psimgb->fd[1], psimgb->a[1]);
+          psimgb->buf_share_method = BUF_SHARE_METHOD_FD;
+        }
+        psimgb->w[0] = src->width;
+        psimgb->h[0] = src->height;
+        psimgb->cs   = SCMN_CS_NV12;
+        psimgb->w[1] = src->width;
+        psimgb->h[1] = src->height >> 1;
+
+        psimgb->s[0] = GST_ROUND_UP_16(psimgb->w[0]);
+        psimgb->e[0] = GST_ROUND_UP_16(psimgb->h[0]);
+        psimgb->s[1] = GST_ROUND_UP_16(psimgb->w[1]);
+        psimgb->e[1] = GST_ROUND_UP_16(psimgb->h[1]);
+
+        GST_BUFFER_MALLOCDATA(outbuf) = (unsigned char*)psimgb;
+        GST_BUFFER_DATA(outbuf) = src->virtual;
+      }
+    }
+  if(!outbuf) continue;
+       GST_BUFFER_SIZE (outbuf) = src->framesize;
+    drop_frame = FALSE;
+    gst_xv_image_src_get_timeinfo(src,outbuf);
+    if(GST_CLOCK_TIME_IS_VALID(src->running_time) && GST_CLOCK_TIME_IS_VALID(src->frame_duration)) {
+      if(GST_BUFFER_TIMESTAMP(outbuf) < (src->running_time+src->frame_duration-6000000)) {
+        //drop_frame = TRUE;
+      }
+    }
+    //if(!GST_CLOCK_TIME_IS_VALID(GST_BUFFER_TIMESTAMP(outbuf))) drop_frame = TRUE;
+    //if(!first_frame && !GST_CLOCK_TIME_IS_VALID(GST_BUFFER_TIMESTAMP(outbuf))) drop_frame = TRUE;
+
+    if(!drop_frame) {
+      src->running_time = GST_BUFFER_TIMESTAMP(outbuf);
+      src->frame_duration = GST_BUFFER_DURATION(outbuf);
+      //first_frame = FALSE;
+      g_mutex_lock (src->queue_lock);
+      g_queue_push_tail(src->queue, outbuf);
+      g_mutex_unlock (src->queue_lock);
+      g_cond_signal(src->queue_cond);
+    } else {
+      GST_ERROR ("gst_xv_image_src_update_thread frame drop !! newts: %"GST_TIME_FORMAT" oldts+dur-8ms: %"GST_TIME_FORMAT,
+                    GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(outbuf)), GST_TIME_ARGS(src->running_time+src->frame_duration-6000000));
+      gst_buffer_unref(outbuf);
+    }
+    update_done:
+      if (src->virtual) drm_slp_bo_unmap(src->bo, DRM_SLP_DEVICE_CPU);
+      src->virtual = NULL;
+      if (src->bo) drm_slp_bo_unref(src->bo);
+      src->bo = NULL;
+      if (src->dri2_buffers) free(src->dri2_buffers);
+      src->dri2_buffers = NULL;
+      gettimeofday(&end_time, NULL);
+      duration = ((double)(end_time.tv_sec* 1000000)+(double)(end_time.tv_usec))-((double)(start_time.tv_sec* 1000000)+(double)(start_time.tv_usec));
+      gst_xv_get_image_sleep (src, duration);
+      GST_INFO ("gst_xv_image_src_update_thread cleanup !!");
+  }
+  for ( i=0 ; i < GEM_NAME_MAX ; i++) {
+    /*gem munmap*/
+    if (xv_gem_mmap->address[i]) {
+      if (-1 == munmap(xv_gem_mmap->address[i],xv_gem_mmap->buffer_size[i])) {
+        GST_ERROR ("munmap failed");
+        return NULL;
+      }
+    }
+    /*fd close*/
+    if (xv_gem_mmap->fd[i]) {
+       gem_close.handle = xv_gem_mmap->handle[i];
+       if (ioctl(xv_gem_mmap->fd[i], DRM_IOCTL_GEM_CLOSE, &gem_close)) {
+               GST_ERROR("Gem Close failed");
+       }
+    }
+  }
+  if (xv_gem_mmap) {
+    free(xv_gem_mmap);
+    xv_gem_mmap = NULL;
+  }
+  GST_LOG_OBJECT (src, "The thread function cleanup");
+  if (src->atom_stream_off > 0) {
+    XvSetPortAttribute (src->dpy, src->p, src->atom_stream_off, 1);
+    src->atom_stream_off = 0;
+  }
+  if (src->bufmgr) {
+    drm_slp_bufmgr_destroy (src->bufmgr);
+    src->bufmgr = NULL;
+  }
+  if (src->p > 0) {
+    XvUngrabPort (src->dpy, src->p, 0);
+    src->p = 0;
+  }
+  if (src->gc) {
+    XFreeGC (src->dpy, src->gc);
+    src->gc = NULL;
+  }
+  if (src->pixmap > 0) {
+    XFreePixmap (src->dpy, src->pixmap);
+    src->pixmap = 0;
+  }
+  if (src->dpy) {
+    XCloseDisplay (src->dpy);
+    src->dpy = NULL;
+  }
+  GST_LOG_OBJECT (src, "The thread function stop");
+  return NULL;
+finish:
+  GST_LOG_OBJECT (src, "The thread function Error cleanup");
+  if (src->atom_stream_off > 0) {
+    XvSetPortAttribute (src->dpy, src->p, src->atom_stream_off, 1);
+    src->atom_stream_off = 0;
+  }
+  if (src->bufmgr) drm_slp_bufmgr_destroy (src->bufmgr);
+  src->bufmgr = NULL;
+  if (src->p > 0) XvUngrabPort (src->dpy, src->p, 0);
+  src->p = 0;
+  if (src->gc) XFreeGC (src->dpy, src->gc);
+  src->gc = NULL;
+  if (src->pixmap > 0) XFreePixmap (src->dpy, src->pixmap);
+  src->pixmap = 0;
+  if (src->dpy) XCloseDisplay (src->dpy);
+  src->dpy = NULL;
+  GST_LOG_OBJECT (src, "The thread function Error stop");
+  return NULL;
+}
+
+static drm_slp_bufmgr bufmgr_get (Display *dpy, Pixmap pixmap)
+{
+  int screen;
+  int drm_fd;
+  drm_slp_bufmgr bufmgr;
+  int eventBase, errorBase;
+  int dri2Major, dri2Minor;
+  char *driverName, *deviceName;
+  drm_magic_t magic;
+
+  screen = DefaultScreen(dpy);
+  if (!DRI2QueryExtension (dpy, &eventBase, &errorBase)) {
+    GST_ERROR ("!!Error : DRI2QueryExtension !!");
+    return NULL;
+  }
+  if (!DRI2QueryVersion (dpy, &dri2Major, &dri2Minor)) {
+    GST_ERROR ("!!Error : DRI2QueryVersion !!");
+    return NULL;
+  }
+  if (!DRI2Connect (dpy, RootWindow(dpy, screen), &driverName, &deviceName)) {
+    GST_ERROR ( "!!Error : DRI2Connect !!");
+    if(driverName) Xfree(driverName);
+    if(deviceName) Xfree(deviceName);
+    return NULL;
+  }
+  if(driverName) Xfree(driverName);
+  GST_DEBUG("Open drm device : %s", deviceName);
+  // get the drm_fd though opening the deviceName
+  drm_fd = open (deviceName, O_RDWR);
+  if (drm_fd < 0) {
+    GST_ERROR ("!!Error : cannot open drm device (%s)", deviceName);
+    if(deviceName) Xfree(deviceName);
+    return NULL;
+  }
+  if(deviceName) Xfree(deviceName);
+  /* get the drm magic */
+  drmGetMagic(drm_fd, &magic);
+  fprintf(stderr, ">>> drm magic=%d \n", magic);
+  if (!DRI2Authenticate(dpy, RootWindow(dpy, screen), magic))
+  {
+    fprintf(stderr, "!!Error : DRI2Authenticate !!\n");
+    close (drm_fd);
+    return NULL;
+  }
+  // drm slp buffer manager init
+  bufmgr = drm_slp_bufmgr_init (drm_fd, NULL);
+  if (!bufmgr) {
+    GST_ERROR ("!!Error : fail to init buffer manager ");
+    close (drm_fd);
+    return NULL;
+  }
+  DRI2CreateDrawable (dpy, pixmap);
+  return bufmgr;
+}
+
+static int port_get (Display *dpy, unsigned int id)
+{
+  unsigned int ver, rev, req_base, evt_base, err_base;
+  unsigned int adaptors;
+  XvAdaptorInfo *ai = NULL;
+  XvAttribute *at = NULL;
+  XvImageFormatValues *fo = NULL;
+  int attributes, formats;
+  int i, j, p;
+
+  if (XvQueryExtension (dpy, &ver, &rev, &req_base, &evt_base, &err_base) != Success) return -1;
+  if (XvQueryAdaptors (dpy, DefaultRootWindow (dpy), &adaptors, &ai) != Success) return -1;
+  if (!ai) return -1;
+  for (i = 0; i < adaptors; i++) {
+    int support_format = False;
+    if (!(ai[i].type & XvStillMask)) continue;
+    GST_LOG ("===========================================");
+    GST_LOG (" name:        %s"
+                " first port:  %ld"
+                " ports:       %ld",
+                ai[i].name,
+                ai[i].base_id,
+                ai[i].num_ports);
+    p = ai[i].base_id;
+    GST_LOG (" attribute list:");
+    at = XvQueryPortAttributes (dpy, p, &attributes);
+    for (j = 0; j < attributes; j++) GST_LOG ("\t-  name: %s\n"
+                    "\t\t  flags:     %s%s\n"
+                    "\t\t  min_value:  %i\n"
+                    "\t\t  max_value:  %i\n",
+                    at[j].name,
+                    (at[j].flags & XvGettable) ? " get" : "",
+                    (at[j].flags & XvSettable) ? " set" : "",
+                    at[j].min_value, at[j].max_value);
+    if (at) XFree (at);
+    GST_LOG (" image format list:");
+    fo = XvListImageFormats (dpy, p, &formats);
+    for (j = 0; j < formats; j++) {
+      GST_LOG ("\t-  0x%x (%4.4s) %s", fo[j].id, (char *)&fo[j].id, (fo[j].format == XvPacked) ? "packed" : "planar");
+      if (fo[j].id == (int)id) support_format = True;
+    }
+    if (fo) XFree (fo);
+    if (!support_format) continue;
+    for (; p < ai[i].base_id + ai[i].num_ports; p++) {
+      if (XvGrabPort (dpy, p, 0) == Success) {
+        GST_LOG ("========================================");
+        GST_DEBUG ("XvGrabPort success : %d", p);
+        GST_LOG ("========================================");
+        XvFreeAdaptorInfo (ai);
+        return p;
+      }
+    }
+  }
+  XvFreeAdaptorInfo (ai);
+  return -1;
+}
+
+static void pixmap_update (GstXVImageSrc * src, Display *dpy, drm_slp_bufmgr bufmgr, Pixmap pixmap,
+               int x, int y, int width, int height)
+{
+  unsigned int attachments[1];
+  int dri2_count, dri2_out_count;
+  int dri2_width, dri2_height, dri2_stride;
+  int opt;
+  attachments[0] = DRI2BufferFrontLeft;
+  dri2_count = 1;
+  src->dri2_buffers = DRI2GetBuffers (dpy, pixmap, &dri2_width, &dri2_height, attachments, dri2_count, &dri2_out_count);
+  if (!src->dri2_buffers) {
+    GST_ERROR ("[Error] : fail to get buffers");
+    goto update_done;
+  }
+  if (!src->dri2_buffers[0].name) {
+    GST_ERROR ("[Error] : a handle of the dri2 buffer is null  ");
+    goto update_done;
+  }
+  src->bo = drm_slp_bo_import(bufmgr, src->dri2_buffers[0].name);
+  if (!src->bo) {
+    GST_ERROR ("[Error] : cannot import bo (key:%d)", src->dri2_buffers[0].name);
+    goto update_done;
+  }
+  dri2_stride = src->dri2_buffers[0].pitch;
+  opt = DRM_SLP_OPTION_READ|DRM_SLP_OPTION_WRITE;
+  src->virtual = drm_slp_bo_map (src->bo, DRM_SLP_DEVICE_CPU, opt);
+  if (!src->virtual) {
+    GST_ERROR ("[Error] : fail to map ");
+    goto update_done;
+  }
+  return;
+update_done:
+  if (src->virtual) drm_slp_bo_unmap(src->bo, DRM_SLP_DEVICE_CPU);
+  src->virtual = NULL;
+  if (src->bo) drm_slp_bo_unref(src->bo);
+  src->bo = NULL;
+  if (src->dri2_buffers) free(src->dri2_buffers);
+  src->dri2_buffers = NULL;
+  return;
+}
+
+static Pixmap pixmap_create (GstXVImageSrc * src, Display *dpy, int width, int height)
+{
+  src->pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), width, height, DefaultDepth(dpy, DefaultScreen(dpy)));
+  src->gc = XCreateGC (dpy, src->pixmap, 0, 0);
+  XSetForeground (dpy, src->gc, 0xFFFF0000);
+  XFillRectangle (dpy, src->pixmap, src->gc, 0, 0, width, height);
+  XSync(dpy, 0);
+  XFreeGC (dpy, src->gc);
+  return src->pixmap;
+}
+
+static gboolean
+gst_xv_image_src_stop (GstBaseSrc * bsrc)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (bsrc);
+  GST_DEBUG_OBJECT (src, "stop()");
+
+  if(src->updates_thread) {
+    src->thread_return = TRUE;
+    g_thread_join ( src->updates_thread);
+    src->updates_thread = NULL;
+  }
+  GST_DEBUG_OBJECT (src, "stop end ");
+  return TRUE;
+}
+
+/* Interrupt a blocking request. */
+static gboolean
+gst_xv_image_src_unlock (GstBaseSrc * bsrc)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (bsrc);
+  GST_DEBUG_OBJECT (src, "unlock()");
+  return TRUE;
+}
+
+/* Interrupt interrupt. */
+static gboolean
+gst_xv_image_src_unlock_stop (GstBaseSrc * bsrc)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (bsrc);
+  GST_DEBUG_OBJECT (src, "unlock_stop()");
+  return TRUE;
+}
+
+static gboolean
+gst_xv_image_src_get_size (GstBaseSrc * bsrc, guint64 * size)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (bsrc);
+  GST_INFO ("Get size %x", src);
+  return FALSE;
+}
+
+static gboolean
+gst_xv_image_src_is_seekable (GstBaseSrc * bsrc)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (bsrc);
+  GST_INFO ("Is seekable %x", src);
+  return FALSE;
+}
+
+static gboolean
+gst_xv_image_src_query (GstBaseSrc * bsrc, GstQuery * query)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (bsrc);
+  gboolean ret;
+  GST_INFO ("src query %x", src);
+  switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_URI:
+      ret = TRUE;
+    break;
+    default:
+      ret = FALSE;
+    break;
+  }
+
+  if (!ret)
+    ret = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
+
+  return ret;
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  GST_DEBUG_CATEGORY_INIT (xvimagesrc_debug, "xvimagesrc", 0, "XServer display FB video capture Source");
+  return gst_element_register (plugin, "xvimagesrc", GST_RANK_PRIMARY, GST_TYPE_XV_IMAGE_SRC);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+  GST_VERSION_MINOR,
+  "xvimage",
+  "XServer display video src",
+  plugin_init, VERSION, "LGPL", "Samsung Electronics Co", "http://www.samsung.com")
diff --git a/xvimagesrc/src/gstxvimagesrc.h b/xvimagesrc/src/gstxvimagesrc.h
new file mode 100755 (executable)
index 0000000..4765e32
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * xvimagesrc
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Hyunil Park <hyunil46.park@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+#ifndef __GST_XV_IMAGE_SRC_H__
+#define __GST_XV_IMAGE_SRC_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstpushsrc.h>
+#include <glib.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <signal.h>
+
+#include <sys/types.h>
+#include <sys/shm.h>
+
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/extensions/Xvlib.h>
+#include <X11/extensions/Xvproto.h>
+#include <X11/extensions/XShm.h>
+#include <X11/extensions/Xdamage.h>
+
+#include <dri2.h> //libdri2-dev, libdrm-dev
+#include <drm_slp_bufmgr.h>
+
+#include "xv_types.h"
+
+#define C(b,m)              (((b) >> (m)) & 0xFF)
+#define B(c,s)              ((((unsigned int)(c)) & 0xff) << (s))
+#define FOURCC(a,b,c,d)     (B(d,24) | B(c,16) | B(b,8) | B(a,0))
+#define FOURCC_RGB32        FOURCC('R','G','B','4')
+#define FOURCC_I420         FOURCC('I','4','2','0')
+#define FOURCC_SN12         FOURCC('S','N','1','2')
+#define FOURCC_ST12         FOURCC('S','T','1','2')
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_XV_IMAGE_SRC \
+  (gst_xv_image_src_get_type())
+#define GST_XV_IMAGE_SRC(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_XV_IMAGE_SRC,GstXVImageSrc))
+#define GST_XV_IMAGE_SRC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), \
+      GST_TYPE_XV_IMAGE_SRC,GstXVImageSrcClass))
+#define GST_IS_XV_IMAGE_SRC(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_XV_IMAGE_SRC))
+#define GST_IS_XV_IMAGE_SRC_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_XV_IMAGE_SRC))
+
+typedef struct _GstXVImageSrc GstXVImageSrc;
+typedef struct _GstXVImageSrcClass GstXVImageSrcClass;
+
+struct _GstXVImageSrc {
+  GstPushSrc element;
+  Display      *dpy;
+  int p;
+  Pixmap pixmap;
+  GC gc;
+  unsigned int width;
+  unsigned int height;
+  unsigned int framesize;
+  guint32 format_id;
+  Damage damage;
+  int damage_base;
+  drm_slp_bufmgr bufmgr;
+  void *virtual;
+  drm_slp_bo bo;
+  DRI2Buffer* dri2_buffers;
+  guint64 running_time;
+  guint64 base_time;
+  guint64 frame_duration;;
+  Atom atom_stream_off;
+  gint rate_numerator;
+  gint rate_denominator;
+  GThread *updates_thread;
+  gboolean thread_return;
+  GQueue *queue;
+  GMutex *queue_lock;
+  GCond *queue_cond;
+  GMutex *cond_lock;
+  gint drm_fd;
+  int current_data_type;
+  int new_data_type;
+  double get_image_overtime;
+  int get_image_overtime_cnt;
+  int gemname_cnt;
+
+};
+
+struct _GstXVImageSrcClass {
+  GstPushSrcClass parent_class;
+
+  /* signals */
+  void (*video_with_ui)        (void *data);
+  void (*video_only)   (void *data);
+};
+
+GType gst_xv_image_src_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_XV_IMAGE_SRC_H__ */
+
diff --git a/xvimagesrc/src/xv_types.h b/xvimagesrc/src/xv_types.h
new file mode 100755 (executable)
index 0000000..3472e3c
--- /dev/null
@@ -0,0 +1,134 @@
+/**************************************************************************
+
+xserver-xorg-video-exynos
+
+Copyright 2010 - 2011 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: Boram Park <boram1288.park@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*                                                              */
+/* File name : xv_types.h                                       */
+/* Author : Boram Park (boram1288.park@samsung.com)             */
+/* Protocol Version : 1.0.1 (Dec 16th 2009)                       */
+/* This file is for describing Xv APIs' buffer encoding method. */
+/*                                                              */
+
+#ifndef XV_TYPES_H_
+#define XV_TYPES_H_
+
+G_BEGIN_DECLS
+
+#define XV_PUTIMAGE_HEADER     0xDEADCD01
+#define XV_PUTIMAGE_VERSION    0x00010001
+
+#define XV_GETSTILL_HEADER     0xDEADCD02
+#define XV_GETSTILL_VERSION    0x00010001
+
+/* Return Values */
+#define XV_OK 0
+#define XV_HEADER_ERROR -1
+#define XV_VERSION_MISMATCH -2
+
+#define XV_BUF_TYPE_DMABUF  0
+#define XV_BUF_TYPE_LEGACY  1
+
+/* Data structure for XvPutImage / XvShmPutImage */
+typedef struct
+{
+    unsigned int _header; /* for internal use only */
+    unsigned int _version; /* for internal use only */
+
+    unsigned int YBuf;
+    unsigned int CbBuf;
+    unsigned int CrBuf;
+
+    unsigned int BufType;
+} XV_PUTIMAGE_DATA, * XV_PUTIMAGE_DATA_PTR;
+
+/* Data structure for XvPutImage / XvShmPutImage */
+typedef struct
+{
+    unsigned int _header; /* for internal use only */
+    unsigned int _version; /* for internal use only */
+
+    unsigned int YBuf;
+    unsigned int CbBuf;
+    unsigned int CrBuf;
+
+    unsigned int BufIndex;
+    unsigned int BufType;
+} XV_GETSTILL_DATA, * XV_GETSTILL_DATA_PTR;
+
+static void
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_PUTIMAGE_INIT_DATA (XV_PUTIMAGE_DATA_PTR data)
+{
+    data->_header = XV_PUTIMAGE_HEADER;
+    data->_version = XV_PUTIMAGE_VERSION;
+}
+
+
+static int
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_PUTIMAGE_VALIDATE_DATA (XV_PUTIMAGE_DATA_PTR data)
+{
+    if (data->_header != XV_PUTIMAGE_HEADER)
+        return XV_HEADER_ERROR;
+    if (data->_version != XV_PUTIMAGE_VERSION)
+        return XV_VERSION_MISMATCH;
+    return XV_OK;
+}
+
+static void
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_GETSTILL_INIT_DATA (XV_GETSTILL_DATA_PTR data)
+{
+    data->_header = XV_GETSTILL_HEADER;
+    data->_version = XV_GETSTILL_VERSION;
+}
+
+
+static int
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_GETSTILL_VALIDATE_DATA (XV_GETSTILL_DATA_PTR data)
+{
+    if (data->_header != XV_GETSTILL_HEADER)
+        return XV_HEADER_ERROR;
+    if (data->_version != XV_GETSTILL_VERSION)
+        return XV_VERSION_MISMATCH;
+    return XV_OK;
+}
+
+G_END_DECLS
+
+#endif