Initialize Tizen 2.3 2.3a_release submit/tizen_2.3/20140531.082731
authorSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:44:22 +0000 (12:44 +0900)
committerSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:44:22 +0000 (12:44 +0900)
294 files changed:
mobile/AUTHORS [new file with mode: 0644]
mobile/COPYING [new file with mode: 0644]
mobile/INSTALL [new file with mode: 0644]
mobile/LICENSE.LGPLv2.1 [new file with mode: 0644]
mobile/Makefile.am [new file with mode: 0755]
mobile/NOTICE [new file with mode: 0644]
mobile/PLUGINS [new file with mode: 0644]
mobile/README [new file with mode: 0644]
mobile/audioeq/Makefile.am [new file with mode: 0755]
mobile/audioeq/src/Makefile.am [new file with mode: 0755]
mobile/audioeq/src/gstaudioeq.c [new file with mode: 0644]
mobile/audioeq/src/gstaudioeq.h [new file with mode: 0644]
mobile/audiotp/Makefile.am [new file with mode: 0755]
mobile/audiotp/src/Makefile.am [new file with mode: 0755]
mobile/audiotp/src/gstaudiotp.c [new file with mode: 0644]
mobile/audiotp/src/gstaudiotp.h [new file with mode: 0755]
mobile/autogen.sh [new file with mode: 0755]
mobile/autoregen.sh [new file with mode: 0755]
mobile/avsystem/Makefile.am [new file with mode: 0644]
mobile/avsystem/src/Makefile.am [new file with mode: 0644]
mobile/avsystem/src/gstavsysaudiosink.c [new file with mode: 0644]
mobile/avsystem/src/gstavsysaudiosink.h [new file with mode: 0644]
mobile/avsystem/src/gstavsysaudiosrc.c [new file with mode: 0644]
mobile/avsystem/src/gstavsysaudiosrc.h [new file with mode: 0644]
mobile/avsystem/src/gstavsysmemsink.c [new file with mode: 0644]
mobile/avsystem/src/gstavsysmemsink.h [new file with mode: 0644]
mobile/avsystem/src/gstavsyssink.c [new file with mode: 0644]
mobile/avsystem/src/gstavsyssrc.c [new file with mode: 0644]
mobile/common/ChangeLog [new file with mode: 0755]
mobile/common/Makefile.am [new file with mode: 0644]
mobile/common/c-to-xml.py [new file with mode: 0755]
mobile/common/check-exports [new file with mode: 0755]
mobile/common/check.mak [new file with mode: 0755]
mobile/common/coverage/coverage-report-entry.pl [new file with mode: 0755]
mobile/common/coverage/coverage-report.pl [new file with mode: 0755]
mobile/common/coverage/coverage-report.xsl [new file with mode: 0755]
mobile/common/coverage/lcov.mak [new file with mode: 0755]
mobile/common/gettext.patch [new file with mode: 0755]
mobile/common/glib-gen.mak [new file with mode: 0755]
mobile/common/gst-autogen.sh [new file with mode: 0755]
mobile/common/gst-xmlinspect.py [new file with mode: 0755]
mobile/common/gst.supp [new file with mode: 0755]
mobile/common/gstdoc-scangobj [new file with mode: 0755]
mobile/common/gtk-doc-plugins.mak [new file with mode: 0755]
mobile/common/gtk-doc.mak [new file with mode: 0755]
mobile/common/m4/Makefile.am [new file with mode: 0644]
mobile/common/m4/README [new file with mode: 0755]
mobile/common/m4/as-ac-expand.m4 [new file with mode: 0755]
mobile/common/m4/as-auto-alt.m4 [new file with mode: 0755]
mobile/common/m4/as-compiler-flag.m4 [new file with mode: 0755]
mobile/common/m4/as-compiler.m4 [new file with mode: 0755]
mobile/common/m4/as-docbook.m4 [new file with mode: 0755]
mobile/common/m4/as-gcc-inline-assembly.m4 [new file with mode: 0755]
mobile/common/m4/as-libtool-tags.m4 [new file with mode: 0755]
mobile/common/m4/as-libtool.m4 [new file with mode: 0755]
mobile/common/m4/as-python.m4 [new file with mode: 0755]
mobile/common/m4/as-scrub-include.m4 [new file with mode: 0755]
mobile/common/m4/as-version.m4 [new file with mode: 0755]
mobile/common/m4/ax_create_stdint_h.m4 [new file with mode: 0755]
mobile/common/m4/check.m4 [new file with mode: 0755]
mobile/common/m4/gettext.m4 [new file with mode: 0755]
mobile/common/m4/glib-gettext.m4 [new file with mode: 0755]
mobile/common/m4/gst-arch.m4 [new file with mode: 0755]
mobile/common/m4/gst-args.m4 [new file with mode: 0755]
mobile/common/m4/gst-check.m4 [new file with mode: 0755]
mobile/common/m4/gst-debuginfo.m4 [new file with mode: 0755]
mobile/common/m4/gst-default.m4 [new file with mode: 0755]
mobile/common/m4/gst-doc.m4 [new file with mode: 0755]
mobile/common/m4/gst-error.m4 [new file with mode: 0755]
mobile/common/m4/gst-feature.m4 [new file with mode: 0755]
mobile/common/m4/gst-function.m4 [new file with mode: 0755]
mobile/common/m4/gst-gettext.m4 [new file with mode: 0755]
mobile/common/m4/gst-glib2.m4 [new file with mode: 0755]
mobile/common/m4/gst-libxml2.m4 [new file with mode: 0755]
mobile/common/m4/gst-parser.m4 [new file with mode: 0755]
mobile/common/m4/gst-plugin-docs.m4 [new file with mode: 0755]
mobile/common/m4/gst-plugindir.m4 [new file with mode: 0755]
mobile/common/m4/gst-valgrind.m4 [new file with mode: 0755]
mobile/common/m4/gst-x11.m4 [new file with mode: 0644]
mobile/common/m4/gst.m4 [new file with mode: 0755]
mobile/common/m4/gtk-doc.m4 [new file with mode: 0755]
mobile/common/m4/iconv.m4 [new file with mode: 0755]
mobile/common/m4/isc-posix.m4 [new file with mode: 0755]
mobile/common/m4/lib-ld.m4 [new file with mode: 0755]
mobile/common/m4/lib-link.m4 [new file with mode: 0755]
mobile/common/m4/lib-prefix.m4 [new file with mode: 0755]
mobile/common/m4/libtool.m4 [new file with mode: 0644]
mobile/common/m4/ltoptions.m4 [new file with mode: 0644]
mobile/common/m4/ltsugar.m4 [new file with mode: 0644]
mobile/common/m4/ltversion.m4 [new file with mode: 0644]
mobile/common/m4/lt~obsolete.m4 [new file with mode: 0644]
mobile/common/m4/pkg.m4 [new file with mode: 0755]
mobile/common/m4/progtest.m4 [new file with mode: 0755]
mobile/common/mangle-tmpl.py [new file with mode: 0755]
mobile/common/plugins.xsl [new file with mode: 0755]
mobile/common/po.mak [new file with mode: 0755]
mobile/common/release.mak [new file with mode: 0755]
mobile/common/scangobj-merge.py [new file with mode: 0755]
mobile/common/upload.mak [new file with mode: 0755]
mobile/common/win32.mak [new file with mode: 0755]
mobile/configure.ac [new file with mode: 0644]
mobile/drmsrc/Makefile.am [new file with mode: 0755]
mobile/drmsrc/src/Makefile.am [new file with mode: 0755]
mobile/drmsrc/src/gstdrmsrc.c [new file with mode: 0644]
mobile/drmsrc/src/gstdrmsrc.h [new file with mode: 0755]
mobile/encodebin/Makefile.am [new file with mode: 0644]
mobile/encodebin/src/Makefile.am [new file with mode: 0644]
mobile/encodebin/src/gstencodebin.c [new file with mode: 0644]
mobile/encodebin/src/gstencodebin.h [new file with mode: 0644]
mobile/evasimagesink/Makefile.am [new file with mode: 0644]
mobile/evasimagesink/src/Makefile.am [new file with mode: 0644]
mobile/evasimagesink/src/gstevasimagesink.c [new file with mode: 0644]
mobile/evasimagesink/src/gstevasimagesink.h [new file with mode: 0644]
mobile/evaspixmapsink/Makefile.am [new file with mode: 0644]
mobile/evaspixmapsink/evaspixmapsink.c [new file with mode: 0644]
mobile/evaspixmapsink/evaspixmapsink.h [new file with mode: 0644]
mobile/evaspixmapsink/xv_types.h [new file with mode: 0644]
mobile/gst-autogen.sh [new file with mode: 0755]
mobile/gst-plugins-ext0.10.manifest [new file with mode: 0755]
mobile/m4/Makefile.am [new file with mode: 0644]
mobile/m4/as-compiler-flag.m4 [new file with mode: 0755]
mobile/m4/as-version.m4 [new file with mode: 0755]
mobile/pdpushsrc/Makefile.am [new file with mode: 0755]
mobile/pdpushsrc/src/Makefile.am [new file with mode: 0755]
mobile/pdpushsrc/src/gstpdpushsrc.c [new file with mode: 0644]
mobile/pdpushsrc/src/gstpdpushsrc.h [new file with mode: 0755]
mobile/toggle/Makefile.am [new file with mode: 0755]
mobile/toggle/src/Makefile.am [new file with mode: 0755]
mobile/toggle/src/gsttoggle.c [new file with mode: 0755]
mobile/toggle/src/gsttoggle.h [new file with mode: 0755]
mobile/xvimagesrc/Makefile.am [new file with mode: 0644]
mobile/xvimagesrc/src/Makefile.am [new file with mode: 0644]
mobile/xvimagesrc/src/gstxvimagesrc.c [new file with mode: 0644]
mobile/xvimagesrc/src/gstxvimagesrc.h [new file with mode: 0644]
mobile/xvimagesrc/src/xv_types.h [new file with mode: 0755]
packaging/gst-plugins-ext0.10-0.3.14.tar.gz [new file with mode: 0755]
packaging/gst-plugins-ext0.10.spec [new file with mode: 0644]
wearable/AUTHORS [new file with mode: 0644]
wearable/COPYING [new file with mode: 0644]
wearable/INSTALL [new file with mode: 0644]
wearable/LICENSE.LGPLv2.1 [new file with mode: 0644]
wearable/Makefile.am [new file with mode: 0755]
wearable/NEWS [new file with mode: 0644]
wearable/PLUGINS [new file with mode: 0644]
wearable/README [new file with mode: 0644]
wearable/aclocal.m4 [new file with mode: 0644]
wearable/audioeq/Makefile.am [new file with mode: 0755]
wearable/audioeq/src/Makefile.am [new file with mode: 0755]
wearable/audioeq/src/gstaudioeq.c [new file with mode: 0644]
wearable/audioeq/src/gstaudioeq.h [new file with mode: 0644]
wearable/audiotp/Makefile.am [new file with mode: 0755]
wearable/audiotp/src/Makefile.am [new file with mode: 0755]
wearable/audiotp/src/gstaudiotp.c [new file with mode: 0755]
wearable/audiotp/src/gstaudiotp.h [new file with mode: 0755]
wearable/autogen.sh [new file with mode: 0755]
wearable/autoregen.sh [new file with mode: 0755]
wearable/avsystem/Makefile.am [new file with mode: 0644]
wearable/avsystem/src/Makefile.am [new file with mode: 0644]
wearable/avsystem/src/gstavsysaudiosink.c [new file with mode: 0755]
wearable/avsystem/src/gstavsysaudiosink.h [new file with mode: 0644]
wearable/avsystem/src/gstavsysaudiosrc.c [new file with mode: 0644]
wearable/avsystem/src/gstavsysaudiosrc.h [new file with mode: 0644]
wearable/avsystem/src/gstavsysmemsink.c [new file with mode: 0644]
wearable/avsystem/src/gstavsysmemsink.h [new file with mode: 0644]
wearable/avsystem/src/gstavsyssink.c [new file with mode: 0644]
wearable/avsystem/src/gstavsyssrc.c [new file with mode: 0644]
wearable/common/ChangeLog [new file with mode: 0755]
wearable/common/Makefile.am [new file with mode: 0644]
wearable/common/c-to-xml.py [new file with mode: 0755]
wearable/common/check-exports [new file with mode: 0755]
wearable/common/check.mak [new file with mode: 0755]
wearable/common/coverage/coverage-report-entry.pl [new file with mode: 0755]
wearable/common/coverage/coverage-report.pl [new file with mode: 0755]
wearable/common/coverage/coverage-report.xsl [new file with mode: 0755]
wearable/common/coverage/lcov.mak [new file with mode: 0755]
wearable/common/gettext.patch [new file with mode: 0755]
wearable/common/glib-gen.mak [new file with mode: 0755]
wearable/common/gst-autogen.sh [new file with mode: 0755]
wearable/common/gst-xmlinspect.py [new file with mode: 0755]
wearable/common/gst.supp [new file with mode: 0755]
wearable/common/gstdoc-scangobj [new file with mode: 0755]
wearable/common/gtk-doc-plugins.mak [new file with mode: 0755]
wearable/common/gtk-doc.mak [new file with mode: 0755]
wearable/common/m4/Makefile.am [new file with mode: 0644]
wearable/common/m4/README [new file with mode: 0755]
wearable/common/m4/as-ac-expand.m4 [new file with mode: 0755]
wearable/common/m4/as-auto-alt.m4 [new file with mode: 0755]
wearable/common/m4/as-compiler-flag.m4 [new file with mode: 0755]
wearable/common/m4/as-compiler.m4 [new file with mode: 0755]
wearable/common/m4/as-docbook.m4 [new file with mode: 0755]
wearable/common/m4/as-gcc-inline-assembly.m4 [new file with mode: 0755]
wearable/common/m4/as-libtool-tags.m4 [new file with mode: 0755]
wearable/common/m4/as-libtool.m4 [new file with mode: 0755]
wearable/common/m4/as-python.m4 [new file with mode: 0755]
wearable/common/m4/as-scrub-include.m4 [new file with mode: 0755]
wearable/common/m4/as-version.m4 [new file with mode: 0755]
wearable/common/m4/ax_create_stdint_h.m4 [new file with mode: 0755]
wearable/common/m4/check.m4 [new file with mode: 0755]
wearable/common/m4/gettext.m4 [new file with mode: 0755]
wearable/common/m4/glib-gettext.m4 [new file with mode: 0755]
wearable/common/m4/gst-arch.m4 [new file with mode: 0755]
wearable/common/m4/gst-args.m4 [new file with mode: 0755]
wearable/common/m4/gst-check.m4 [new file with mode: 0755]
wearable/common/m4/gst-debuginfo.m4 [new file with mode: 0755]
wearable/common/m4/gst-default.m4 [new file with mode: 0755]
wearable/common/m4/gst-doc.m4 [new file with mode: 0755]
wearable/common/m4/gst-error.m4 [new file with mode: 0755]
wearable/common/m4/gst-feature.m4 [new file with mode: 0755]
wearable/common/m4/gst-function.m4 [new file with mode: 0755]
wearable/common/m4/gst-gettext.m4 [new file with mode: 0755]
wearable/common/m4/gst-glib2.m4 [new file with mode: 0755]
wearable/common/m4/gst-libxml2.m4 [new file with mode: 0755]
wearable/common/m4/gst-parser.m4 [new file with mode: 0755]
wearable/common/m4/gst-plugin-docs.m4 [new file with mode: 0755]
wearable/common/m4/gst-plugindir.m4 [new file with mode: 0755]
wearable/common/m4/gst-valgrind.m4 [new file with mode: 0755]
wearable/common/m4/gst-x11.m4 [new file with mode: 0644]
wearable/common/m4/gst.m4 [new file with mode: 0755]
wearable/common/m4/gtk-doc.m4 [new file with mode: 0755]
wearable/common/m4/iconv.m4 [new file with mode: 0755]
wearable/common/m4/isc-posix.m4 [new file with mode: 0755]
wearable/common/m4/lib-ld.m4 [new file with mode: 0755]
wearable/common/m4/lib-link.m4 [new file with mode: 0755]
wearable/common/m4/lib-prefix.m4 [new file with mode: 0755]
wearable/common/m4/libtool.m4 [new file with mode: 0644]
wearable/common/m4/ltoptions.m4 [new file with mode: 0644]
wearable/common/m4/ltsugar.m4 [new file with mode: 0644]
wearable/common/m4/ltversion.m4 [new file with mode: 0644]
wearable/common/m4/lt~obsolete.m4 [new file with mode: 0644]
wearable/common/m4/pkg.m4 [new file with mode: 0755]
wearable/common/m4/progtest.m4 [new file with mode: 0755]
wearable/common/mangle-tmpl.py [new file with mode: 0755]
wearable/common/plugins.xsl [new file with mode: 0755]
wearable/common/po.mak [new file with mode: 0755]
wearable/common/release.mak [new file with mode: 0755]
wearable/common/scangobj-merge.py [new file with mode: 0755]
wearable/common/upload.mak [new file with mode: 0755]
wearable/common/win32.mak [new file with mode: 0755]
wearable/compile [new file with mode: 0755]
wearable/config.guess [new file with mode: 0755]
wearable/config.h.in [new file with mode: 0644]
wearable/config.sub [new file with mode: 0755]
wearable/configure [new file with mode: 0755]
wearable/configure.ac [new file with mode: 0755]
wearable/control.in [new file with mode: 0644]
wearable/dashdemux/Makefile.am [new file with mode: 0755]
wearable/dashdemux/src/Makefile.am [new file with mode: 0644]
wearable/dashdemux/src/Makefile.in [new file with mode: 0644]
wearable/dashdemux/src/glibcompat.h [new file with mode: 0755]
wearable/dashdemux/src/gstdashdemux.c [new file with mode: 0755]
wearable/dashdemux/src/gstdashdemux.h [new file with mode: 0755]
wearable/dashdemux/src/gstfragment.c [new file with mode: 0755]
wearable/dashdemux/src/gstfragment.h [new file with mode: 0755]
wearable/dashdemux/src/gstfragmented.h [new file with mode: 0755]
wearable/dashdemux/src/gstmpdparser.c [new file with mode: 0755]
wearable/dashdemux/src/gstmpdparser.h [new file with mode: 0755]
wearable/dashdemux/src/gstplugin.c [new file with mode: 0755]
wearable/dashdemux/src/gsturidownloader.c [new file with mode: 0755]
wearable/dashdemux/src/gsturidownloader.h [new file with mode: 0755]
wearable/depcomp [new file with mode: 0755]
wearable/encodebin/Makefile.am [new file with mode: 0644]
wearable/encodebin/src/Makefile.am [new file with mode: 0644]
wearable/encodebin/src/gstencodebin.c [new file with mode: 0644]
wearable/encodebin/src/gstencodebin.h [new file with mode: 0644]
wearable/evasimagesink/Makefile.am [new file with mode: 0644]
wearable/evasimagesink/src/Makefile.am [new file with mode: 0644]
wearable/evasimagesink/src/gstevasimagesink.c [new file with mode: 0644]
wearable/evasimagesink/src/gstevasimagesink.h [new file with mode: 0644]
wearable/evaspixmapsink/Makefile.am [new file with mode: 0644]
wearable/evaspixmapsink/evaspixmapsink.c [new file with mode: 0644]
wearable/evaspixmapsink/evaspixmapsink.h [new file with mode: 0644]
wearable/evaspixmapsink/xv_types.h [new file with mode: 0644]
wearable/gst-autogen.sh [new file with mode: 0755]
wearable/gst-plugins-ext0.10.manifest [new file with mode: 0755]
wearable/install-sh [new file with mode: 0755]
wearable/ltmain.sh [new file with mode: 0755]
wearable/m4/Makefile.am [new file with mode: 0644]
wearable/m4/as-compiler-flag.m4 [new file with mode: 0755]
wearable/m4/as-version.m4 [new file with mode: 0755]
wearable/missing [new file with mode: 0644]
wearable/pdpushsrc/Makefile.am [new file with mode: 0755]
wearable/pdpushsrc/src/Makefile.am [new file with mode: 0755]
wearable/pdpushsrc/src/gstpdpushsrc.c [new file with mode: 0755]
wearable/pdpushsrc/src/gstpdpushsrc.h [new file with mode: 0755]
wearable/toggle/Makefile.am [new file with mode: 0755]
wearable/toggle/src/Makefile.am [new file with mode: 0755]
wearable/toggle/src/gsttoggle.c [new file with mode: 0755]
wearable/toggle/src/gsttoggle.h [new file with mode: 0755]
wearable/uninstall.sh [new file with mode: 0755]
wearable/xvimagesrc/Makefile.am [new file with mode: 0644]
wearable/xvimagesrc/src/Makefile.am [new file with mode: 0644]
wearable/xvimagesrc/src/gstxvimagesrc.c [new file with mode: 0755]
wearable/xvimagesrc/src/gstxvimagesrc.h [new file with mode: 0755]
wearable/xvimagesrc/src/xv_types.h [new file with mode: 0644]

diff --git a/mobile/AUTHORS b/mobile/AUTHORS
new file mode 100644 (file)
index 0000000..6f522a8
--- /dev/null
@@ -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/mobile/COPYING b/mobile/COPYING
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/mobile/INSTALL b/mobile/INSTALL
new file mode 100644 (file)
index 0000000..23e5f25
--- /dev/null
@@ -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/mobile/LICENSE.LGPLv2.1 b/mobile/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/mobile/Makefile.am b/mobile/Makefile.am
new file mode 100755 (executable)
index 0000000..16eea53
--- /dev/null
@@ -0,0 +1,82 @@
+
+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_EVASPIXMAPSINK
+SUBDIRS += evaspixmapsink
+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/mobile/NOTICE b/mobile/NOTICE
new file mode 100644 (file)
index 0000000..0e6ffbb
--- /dev/null
@@ -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/mobile/PLUGINS b/mobile/PLUGINS
new file mode 100644 (file)
index 0000000..a737f3a
--- /dev/null
@@ -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/mobile/README b/mobile/README
new file mode 100644 (file)
index 0000000..9681276
--- /dev/null
@@ -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/mobile/audioeq/Makefile.am b/mobile/audioeq/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/mobile/audioeq/src/Makefile.am b/mobile/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/mobile/audioeq/src/gstaudioeq.c b/mobile/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/mobile/audioeq/src/gstaudioeq.h b/mobile/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/mobile/audiotp/Makefile.am b/mobile/audiotp/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/mobile/audiotp/src/Makefile.am b/mobile/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/mobile/audiotp/src/gstaudiotp.c b/mobile/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/mobile/audiotp/src/gstaudiotp.h b/mobile/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/mobile/autogen.sh b/mobile/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/mobile/autoregen.sh b/mobile/autoregen.sh
new file mode 100755 (executable)
index 0000000..c67a299
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./autogen.sh  $@
diff --git a/mobile/avsystem/Makefile.am b/mobile/avsystem/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/mobile/avsystem/src/Makefile.am b/mobile/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/mobile/avsystem/src/gstavsysaudiosink.c b/mobile/avsystem/src/gstavsysaudiosink.c
new file mode 100644 (file)
index 0000000..b6e5c94
--- /dev/null
@@ -0,0 +1,905 @@
+/*
+ * 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
+#define DEFAULT_AUDIO_CLOSE_HANDLE_ON_PREPARE  FALSE
+
+//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,
+       PROP_AUDIO_CLOSE_HANDLE_ON_PREPARE,
+};
+
+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) 44100, "
+                                                                        "channels = (int) [ 1, 6 ]; "
+                                                                        "audio/x-raw-int, "
+                                                                        "signed = (boolean) { FALSE }, "
+                                                                        "width = (int) 8, "
+                                                                        "depth = (int) 8, "
+                                                                        "rate = (int) 44100, "
+                                                                        "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 ));
+
+       g_object_class_install_property (gobject_class, PROP_AUDIO_CLOSE_HANDLE_ON_PREPARE,
+                       g_param_spec_boolean ("close-handle-on-prepare", "Close Handle on Prepare",
+                                       "Close Handle on Prepare",
+                                       DEFAULT_AUDIO_CLOSE_HANDLE_ON_PREPARE, G_PARAM_READWRITE));
+}
+
+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;
+       case PROP_AUDIO_CLOSE_HANDLE_ON_PREPARE:
+               nbool = g_value_get_boolean(value);
+               sink->close_handle_on_prepare = nbool;
+               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;
+       case PROP_AUDIO_CLOSE_HANDLE_ON_PREPARE:
+               g_value_set_boolean(value, sink->close_handle_on_prepare);
+               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;
+       avsysaudiosink->close_handle_on_prepare = DEFAULT_AUDIO_CLOSE_HANDLE_ON_PREPARE;
+#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_LOW_LATENCY;
+               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);
+
+       GST_WARNING("Start");
+
+       // 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");
+               goto OPEN_FAILED;
+       }
+
+       /* 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 {
+               GST_WARNING_OBJECT(avsys_audio, "");
+               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;
+
+       if (avsys_audio->close_handle_on_prepare) {
+               if (gst_avsysaudiosink_avsys_close(avsys_audio) == FALSE) {
+                       GST_ERROR_OBJECT(avsys_audio, "gst_avsysaudiosink_avsys_close() failed");
+                       return FALSE;
+               }
+       }
+
+       GST_WARNING("End");
+       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;
+       }
+
+OPEN_FAILED:
+       avsysaudiosink_post_message(avsys_audio, GST_RESOURCE_ERROR_OPEN_READ);
+       return FALSE;
+}
+
+static gboolean
+gst_avsysaudiosink_unprepare (GstAudioSink * asink)
+{
+       GstAvsysAudioSink       *avsys_audio = NULL;
+       gboolean                        result = TRUE;
+       avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+
+       GST_WARNING("Start");
+       if(!gst_avsysaudiosink_avsys_close(avsys_audio))
+       {
+               GST_ERROR_OBJECT(avsys_audio, "gst_avsysaudiosink_avsys_close() failed");
+               result = FALSE;
+       }
+       GST_WARNING("End");
+
+       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_WARNING("Start");
+       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);
+       GST_WARNING("End");
+
+       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, GST_RESOURCE_ERROR_OPEN_READ);
+                       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 = errorcode;
+               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/mobile/avsystem/src/gstavsysaudiosink.h b/mobile/avsystem/src/gstavsysaudiosink.h
new file mode 100644 (file)
index 0000000..47da754
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * 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                                            close_handle_on_prepare;
+       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/mobile/avsystem/src/gstavsysaudiosrc.c b/mobile/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/mobile/avsystem/src/gstavsysaudiosrc.h b/mobile/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/mobile/avsystem/src/gstavsysmemsink.c b/mobile/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/mobile/avsystem/src/gstavsysmemsink.h b/mobile/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/mobile/avsystem/src/gstavsyssink.c b/mobile/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/mobile/avsystem/src/gstavsyssrc.c b/mobile/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/mobile/common/ChangeLog b/mobile/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/mobile/common/Makefile.am b/mobile/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/mobile/common/c-to-xml.py b/mobile/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/mobile/common/check-exports b/mobile/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/mobile/common/check.mak b/mobile/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/mobile/common/coverage/coverage-report-entry.pl b/mobile/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/mobile/common/coverage/coverage-report.pl b/mobile/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/mobile/common/coverage/coverage-report.xsl b/mobile/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/mobile/common/coverage/lcov.mak b/mobile/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/mobile/common/gettext.patch b/mobile/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/mobile/common/glib-gen.mak b/mobile/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/mobile/common/gst-autogen.sh b/mobile/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/mobile/common/gst-xmlinspect.py b/mobile/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/mobile/common/gst.supp b/mobile/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/mobile/common/gstdoc-scangobj b/mobile/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/mobile/common/gtk-doc-plugins.mak b/mobile/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/mobile/common/gtk-doc.mak b/mobile/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/mobile/common/m4/Makefile.am b/mobile/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/mobile/common/m4/README b/mobile/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/mobile/common/m4/as-ac-expand.m4 b/mobile/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/mobile/common/m4/as-auto-alt.m4 b/mobile/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/mobile/common/m4/as-compiler-flag.m4 b/mobile/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/mobile/common/m4/as-compiler.m4 b/mobile/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/mobile/common/m4/as-docbook.m4 b/mobile/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/mobile/common/m4/as-gcc-inline-assembly.m4 b/mobile/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/mobile/common/m4/as-libtool-tags.m4 b/mobile/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/mobile/common/m4/as-libtool.m4 b/mobile/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/mobile/common/m4/as-python.m4 b/mobile/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/mobile/common/m4/as-scrub-include.m4 b/mobile/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/mobile/common/m4/as-version.m4 b/mobile/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/mobile/common/m4/ax_create_stdint_h.m4 b/mobile/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/mobile/common/m4/check.m4 b/mobile/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/mobile/common/m4/gettext.m4 b/mobile/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/mobile/common/m4/glib-gettext.m4 b/mobile/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/mobile/common/m4/gst-arch.m4 b/mobile/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/mobile/common/m4/gst-args.m4 b/mobile/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/mobile/common/m4/gst-check.m4 b/mobile/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/mobile/common/m4/gst-debuginfo.m4 b/mobile/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/mobile/common/m4/gst-default.m4 b/mobile/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/mobile/common/m4/gst-doc.m4 b/mobile/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/mobile/common/m4/gst-error.m4 b/mobile/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/mobile/common/m4/gst-feature.m4 b/mobile/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/mobile/common/m4/gst-function.m4 b/mobile/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/mobile/common/m4/gst-gettext.m4 b/mobile/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/mobile/common/m4/gst-glib2.m4 b/mobile/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/mobile/common/m4/gst-libxml2.m4 b/mobile/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/mobile/common/m4/gst-parser.m4 b/mobile/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/mobile/common/m4/gst-plugin-docs.m4 b/mobile/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/mobile/common/m4/gst-plugindir.m4 b/mobile/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/mobile/common/m4/gst-valgrind.m4 b/mobile/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/mobile/common/m4/gst-x11.m4 b/mobile/common/m4/gst-x11.m4
new file mode 100644 (file)
index 0000000..d3baf2d
--- /dev/null
@@ -0,0 +1,70 @@
+dnl macros for X-related detections
+dnl AC_SUBST's HAVE_X, X_CFLAGS, X_LIBS
+AC_DEFUN([AG_GST_CHECK_X],
+[
+  AC_PATH_XTRA
+  ac_cflags_save="$CFLAGS"
+  ac_cppflags_save="$CPPFLAGS"
+  CFLAGS="$CFLAGS $X_CFLAGS"
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  dnl now try to find the HEADER
+  AC_CHECK_HEADER(X11/Xlib.h, HAVE_X="yes", HAVE_X="no")
+
+  if test "x$HAVE_X" = "xno"
+  then
+    AC_MSG_NOTICE([cannot find X11 development files])
+  else
+    dnl this is much more than we want
+    X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
+    dnl AC_PATH_XTRA only defines the path needed to find the X libs,
+    dnl it does not add the libs; therefore we add them here
+    X_LIBS="$X_LIBS -lX11"
+    AC_SUBST(X_CFLAGS)
+    AC_SUBST(X_LIBS)
+  fi
+  AC_SUBST(HAVE_X)
+
+  CFLAGS="$ac_cflags_save"
+  CPPFLAGS="$ac_cppflags_save"
+])
+
+dnl *** XVideo ***
+dnl Look for the PIC library first, Debian requires it.
+dnl Check debian-devel archives for gory details.
+dnl 20020110:
+dnl At the moment XFree86 doesn't distribute shared libXv due
+dnl to unstable API.  On many platforms you CAN NOT link a shared
+dnl lib to a static non-PIC lib.  This is what the xvideo GStreamer
+dnl plug-in wants to do.  So Debian distributes a PIC compiled
+dnl version of the static lib for plug-ins to link to when it is
+dnl inappropriate to link the main application to libXv directly.
+dnl FIXME: add check if this platform can support linking to a
+dnl        non-PIC libXv, if not then don not use Xv.
+dnl FIXME: perhaps warn user if they have a shared libXv since
+dnl        this is an error until XFree86 starts shipping one
+AC_DEFUN([AG_GST_CHECK_XV],
+[
+  if test x$HAVE_X = xyes; then
+    AC_CHECK_LIB(Xv_pic, XvQueryExtension,
+                 HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
+                 $X_LIBS -lXext)
+
+    if test x$HAVE_XVIDEO = xyes; then
+      XVIDEO_LIBS="-lXv_pic -lXext"
+      AC_SUBST(XVIDEO_LIBS)
+    else
+      dnl try again using something else if we didn't find it first
+      if test x$HAVE_XVIDEO = xno; then
+        AC_CHECK_LIB(Xv, XvQueryExtension,
+                   HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
+                   $X_LIBS -lXext)
+
+        if test x$HAVE_XVIDEO = xyes; then
+          XVIDEO_LIBS="-lXv -lXext"
+          AC_SUBST(XVIDEO_LIBS)
+        fi
+      fi
+    fi
+  fi
+])
diff --git a/mobile/common/m4/gst.m4 b/mobile/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/mobile/common/m4/gtk-doc.m4 b/mobile/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/mobile/common/m4/iconv.m4 b/mobile/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/mobile/common/m4/isc-posix.m4 b/mobile/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/mobile/common/m4/lib-ld.m4 b/mobile/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/mobile/common/m4/lib-link.m4 b/mobile/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/mobile/common/m4/lib-prefix.m4 b/mobile/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/mobile/common/m4/libtool.m4 b/mobile/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/mobile/common/m4/ltoptions.m4 b/mobile/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/mobile/common/m4/ltsugar.m4 b/mobile/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/mobile/common/m4/ltversion.m4 b/mobile/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/mobile/common/m4/lt~obsolete.m4 b/mobile/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/mobile/common/m4/pkg.m4 b/mobile/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/mobile/common/m4/progtest.m4 b/mobile/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/mobile/common/mangle-tmpl.py b/mobile/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/mobile/common/plugins.xsl b/mobile/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/mobile/common/po.mak b/mobile/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/mobile/common/release.mak b/mobile/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/mobile/common/scangobj-merge.py b/mobile/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/mobile/common/upload.mak b/mobile/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/mobile/common/win32.mak b/mobile/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/mobile/configure.ac b/mobile/configure.ac
new file mode 100644 (file)
index 0000000..60d51b0
--- /dev/null
@@ -0,0 +1,479 @@
+
+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(TBM, libtbm)
+AC_SUBST(TBM_CFLAGS)
+AC_SUBST(TBM_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/evaspixmapsink
+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 *** belows are related to evaspixmapsink plug-ins ***
+AG_GST_ARG_WITH_PACKAGE_NAME
+AG_GST_ARG_WITH_PACKAGE_ORIGIN
+
+dnl set license and copyright notice
+GST_LICENSE="LGPL"
+AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
+AC_SUBST(GST_LICENSE)
+
+echo
+AC_MSG_NOTICE([Checking libraries for evaspixmapsink plugin])
+echo
+dnl *** X11 ***
+translit(dnm, m, l) AM_CONDITIONAL(USE_X, true)
+AG_GST_CHECK_FEATURE(X, [X libraries and plugins],
+                  [evaspixmapsink], [
+  AC_PATH_XTRA
+  ac_cflags_save="$CFLAGS"
+  ac_cppflags_save="$CPPFLAGS"
+  CFLAGS="$CFLAGS $X_CFLAGS"
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  dnl now try to find the HEADER
+  AC_CHECK_HEADER(X11/Xlib.h, HAVE_X="yes", HAVE_X="no")
+
+  if test "x$HAVE_X" = "xno"
+  then
+    AC_MSG_NOTICE([cannot find X11 development files])
+  else
+    dnl this is much more than we want
+    X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
+    dnl AC_PATH_XTRA only defines the path needed to find the X libs,
+    dnl it does not add the libs; therefore we add them here
+    X_LIBS="$X_LIBS -lX11"
+    AC_SUBST(X_CFLAGS)
+    AC_SUBST(X_LIBS)
+  fi
+  AC_SUBST(HAVE_X)
+  CFLAGS="$ac_cflags_save"
+  CPPFLAGS="$ac_cppflags_save"
+])
+
+dnl Check for Xv extension
+translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
+AG_GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
+                  [evaspixmapsink], [
+AG_GST_CHECK_XV
+])
+
+dnl check for X Shm
+translit(dnm, m, l) AM_CONDITIONAL(USE_XSHM, true)
+AG_GST_CHECK_FEATURE(XSHM, [X Shared Memory extension], , [
+  if test x$HAVE_X = xyes; then
+    AC_CHECK_LIB(Xext, XShmAttach,
+                HAVE_XSHM="yes", HAVE_XSHM="no",
+                $X_LIBS)
+    if test "x$HAVE_XSHM" = "xyes"; then
+      XSHM_LIBS="-lXext"
+    else
+      dnl On AIX, it is in XextSam instead, but we still need -lXext
+      AC_CHECK_LIB(XextSam, XShmAttach,
+                  HAVE_XSHM="yes", HAVE_XSHM="no",
+                  $X_LIBS)
+      if test "x$HAVE_XSHM" = "xyes"; then
+       XSHM_LIBS="-lXext -lXextSam"
+      fi
+    fi
+  fi
+], , [
+  AC_SUBST(HAVE_XSHM)
+  AC_SUBST(XSHM_LIBS)
+])
+
+dnl use tbm
+PKG_CHECK_MODULES(TBM, libtbm)
+AC_SUBST(TBM_CFLAGS)
+AC_SUBST(TBM_LIBS)
+
+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 evaspixmapsink ---------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-evaspixmapsink, AC_HELP_STRING([--enable-ext-evaspixmapsink], [using evaspixmapsink]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_EVASPIXMAPSINK=yes ;;
+      no)  GST_EXT_USE_EXT_EVASPIXMAPSINK=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-evaspixmapsink) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_EVASPIXMAPSINK=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_EVASPIXMAPSINK, test "x$GST_EXT_USE_EXT_EVASPIXMAPSINK" = "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
+evaspixmapsink/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/mobile/drmsrc/Makefile.am b/mobile/drmsrc/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/mobile/drmsrc/src/Makefile.am b/mobile/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/mobile/drmsrc/src/gstdrmsrc.c b/mobile/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/mobile/drmsrc/src/gstdrmsrc.h b/mobile/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/mobile/encodebin/Makefile.am b/mobile/encodebin/Makefile.am
new file mode 100644 (file)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/mobile/encodebin/src/Makefile.am b/mobile/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/mobile/encodebin/src/gstencodebin.c b/mobile/encodebin/src/gstencodebin.c
new file mode 100644 (file)
index 0000000..5ee9617
--- /dev/null
@@ -0,0 +1,3352 @@
+/*
+ * 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"
+#define DEFAULT_PROP_VCONV_NAME         "ffmpegcolorspace"
+
+/* 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,
+       PROP_VCONV_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,
+       PROP_VIDEO_CONV,
+       //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,
+       ENCODEBIN_ELEMENT_VIDEO_CONV
+}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;
+               case PROP_VCONV_NAME:
+                       g_value_set_string (value, encodebin->vconv_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_VIDEO_CONV:
+                       if(encodebin->color_space == NULL && (encodebin->profile != GST_ENCODE_BIN_PROFILE_AUDIO)) {
+                               encodebin->color_space = gst_element_factory_make (encodebin->vconv_name, "video_convert");
+                               if(encodebin->color_space != NULL)
+                                       gst_bin_add(GST_BIN(encodebin), encodebin->color_space);
+                       }
+                       g_value_set_object (value, encodebin->color_space);
+                       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;
+               }
+               case PROP_VCONV_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->color_space == NULL) {
+                               if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_VIDEO_CONV, new_name))
+                                       encodebin->vconv_name = g_strdup (new_name);
+                       } else {
+                               if(strcmp (encodebin->vconv_name, new_name)) {
+                                       gst_encode_bin_remove_element(encodebin, encodebin->color_space);
+                                       if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_VIDEO_CONV, new_name))
+                                               encodebin->vconv_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_VIDEO_CONV: {
+                       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->color_space);
+                               encodebin->color_space = newelement;
+                               gst_object_ref (encodebin->color_space);
+                               gst_object_sink (GST_OBJECT_CAST (encodebin->color_space));
+                               gst_bin_add(GST_BIN(encodebin), encodebin->color_space);
+                       }
+                       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_VCONV_NAME,
+         g_param_spec_string ("vconv-name", "Video converter name", "the name of video color converter to use",
+             DEFAULT_PROP_VCONV_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_VIDEO_CONV,
+         g_param_spec_object ("video-convert", "Video converter",
+             "the video converter 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->vconv_name = g_strdup(DEFAULT_PROP_VCONV_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;
+
+       g_free(encodebin->vconv_name);
+       encodebin->vconv_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);
+                               encodebin->venc_name = NULL;
+                       } 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);
+                               encodebin->aenc_name = NULL;
+                       } 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);
+                               encodebin->ienc_name = NULL;
+                       } 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);
+                               encodebin->mux_name = NULL;
+                       } else {
+                               goto element_make_fail;
+                       }
+                       break;
+               case ENCODEBIN_ELEMENT_VIDEO_CONV:
+                       encodebin->color_space = gst_element_factory_make(name, "video_convert");
+                       if (encodebin->color_space != NULL) {
+                               gst_bin_add(GST_BIN(encodebin), encodebin->color_space);
+                               g_free(encodebin->vconv_name);
+                               encodebin->vconv_name = NULL;
+                       } 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_INFO_OBJECT (encodebin, "gst_encode_bin_remove_element");
+
+       if (element == NULL) {
+               GST_INFO_OBJECT (encodebin, "element is already 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)) {
+                               gchar *caps_str = NULL;
+                               caps_str = gst_caps_to_string(encodebin->vcaps);
+                               if (caps_str) {
+                                       GST_INFO_OBJECT(encodebin, "vconv caps [%s]", caps_str);
+                                       g_free(caps_str);
+                                       caps_str = NULL;
+                               }
+
+                               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 (encodebin->vconv_name, "video_convert");
+                                       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/mobile/encodebin/src/gstencodebin.h b/mobile/encodebin/src/gstencodebin.h
new file mode 100644 (file)
index 0000000..136fc92
--- /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;
+  gchar *vconv_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/mobile/evasimagesink/Makefile.am b/mobile/evasimagesink/Makefile.am
new file mode 100644 (file)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/mobile/evasimagesink/src/Makefile.am b/mobile/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/mobile/evasimagesink/src/gstevasimagesink.c b/mobile/evasimagesink/src/gstevasimagesink.c
new file mode 100644 (file)
index 0000000..0647bf6
--- /dev/null
@@ -0,0 +1,684 @@
+/*
+ * 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
+{
+       LAST_SIGNAL
+};
+
+enum
+{
+       PROP_0,
+       PROP_EVAS_OBJECT,
+       PROP_EVAS_OBJECT_SHOW
+};
+
+enum
+{
+       UPDATE_FALSE,
+       UPDATE_TRUE
+};
+
+#define COLOR_DEPTH 4
+#define GL_X11_ENGINE "gl_x11"
+#define DO_RENDER_FROM_FIMC 1
+#define SIZE_FOR_UPDATE_VISIBILITY sizeof(gchar)
+
+#define EVASIMAGESINK_SET_EVAS_OBJECT_EVENT_CALLBACK( x_evas_image_object, x_usr_data ) \
+do \
+{ \
+       if (x_evas_image_object) { \
+               evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_DEL, evas_callback_del_event, x_usr_data); \
+               evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_RESIZE, evas_callback_resize_event, x_usr_data); \
+       } \
+}while(0)
+
+#define EVASIMAGESINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK( x_evas_image_object ) \
+do \
+{ \
+       if (x_evas_image_object) { \
+               evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_DEL, evas_callback_del_event); \
+               evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_RESIZE, evas_callback_resize_event); \
+       } \
+}while(0)
+
+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_callback_del_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void evas_callback_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",
+               "Samsung Electronics <www.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_DEBUG ("[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;
+       }
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+static void
+evas_image_sink_cb_pipe (void *data, void *buffer, unsigned int nbyte)
+{
+       GstBuffer *buf;
+       GstEvasImageSink *esink = data;
+       void *img_data;
+
+       GST_DEBUG ("[ENTER]");
+
+       if (!esink || !esink->eo) {
+               return;
+       }
+       if (nbyte == SIZE_FOR_UPDATE_VISIBILITY) {
+               if(!esink->object_show) {
+                       evas_object_hide(esink->eo);
+                       GST_INFO ("object hide..");
+               } else {
+                       evas_object_show(esink->eo);
+                       GST_INFO ("object show..");
+               }
+               GST_DEBUG ("[LEAVE]");
+               return;
+       }
+       if (!buffer || nbyte != sizeof (GstBuffer *)) {
+               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);
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+static void
+gst_evas_image_sink_init (GstEvasImageSink *esink, GstEvasImageSinkClass *gclass)
+{
+       GST_DEBUG ("[ENTER]");
+
+       esink->eo = NULL;
+       esink->epipe = NULL;
+       esink->object_show = FALSE;
+       esink->update_visibility = UPDATE_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);
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+static void
+evas_callback_del_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       GST_DEBUG ("[ENTER]");
+
+       GstEvasImageSink *esink = data;
+       if (!esink) {
+               return;
+       }
+
+       EVASIMAGESINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK (esink->eo);
+       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;
+       }
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+static void
+evas_callback_resize_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       int w = 0;
+       int h = 0;
+
+       GST_DEBUG ("[ENTER]");
+
+       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);
+       }
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+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 ***");
+                       EVASIMAGESINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK (esink->eo);
+                       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) {
+                               Eina_Bool r;
+
+                               /* delete evas object callbacks registrated on a previous evas image object */
+                               EVASIMAGESINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK (esink->eo);
+                               esink->eo = eo;
+                               /* add evas object callbacks on a new evas image object */
+                               EVASIMAGESINK_SET_EVAS_OBJECT_EVENT_CALLBACK (esink->eo, 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);
+                               esink->is_evas_object_size_set = FALSE;
+                               if (!esink->epipe) {
+                                       esink->epipe = ecore_pipe_add (evas_image_sink_cb_pipe, esink);
+                                       if (!esink->epipe) {
+                                               GST_ERROR ("ecore-pipe create failed");
+                                               break;
+                                       }
+                               }
+                       }
+               } else {
+                       GST_ERROR ("Cannot set evas-object property: value is not an evas image object");
+               }
+               break;
+
+       case PROP_EVAS_OBJECT_SHOW:
+       {
+               Eina_Bool r;
+               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;
+               }
+               esink->update_visibility = UPDATE_TRUE;
+               if (!esink->epipe) {
+                       esink->epipe = ecore_pipe_add (evas_image_sink_cb_pipe, esink);
+                       if (!esink->epipe) {
+                               GST_ERROR ("ecore-pipe create failed");
+                               break;
+                       }
+               }
+               r = ecore_pipe_write (esink->epipe, &esink->update_visibility, SIZE_FOR_UPDATE_VISIBILITY);
+               if (r == EINA_FALSE)  {
+                       GST_WARNING ("Failed to ecore_pipe_write() for updating visibility)\n");
+               }
+               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;
+               }
+       }
+
+       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 ("ecore_pipe_write() was called with GST_BUFFER_DATA(buf):%x", GST_BUFFER_DATA(buf));
+
+       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/mobile/evasimagesink/src/gstevasimagesink.h b/mobile/evasimagesink/src/gstevasimagesink.h
new file mode 100644 (file)
index 0000000..09c8102
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * 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;
+       gchar update_visibility;
+       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/mobile/evaspixmapsink/Makefile.am b/mobile/evaspixmapsink/Makefile.am
new file mode 100644 (file)
index 0000000..f05ccbd
--- /dev/null
@@ -0,0 +1,15 @@
+plugin_LTLIBRARIES = libgstevaspixmapsink.la
+
+libgstevaspixmapsink_la_SOURCES = evaspixmapsink.c
+libgstevaspixmapsink_la_CFLAGS = $(GST_CFLAGS) $(X_CFLAGS) $(EFL_CFLAGS) $(MMTA_CFLAGS) \
+       $(XFIXES_CFLAGS) $(DRI2PROTO_CFLAGS) $(DRI2_CFLAGS) $(X11_CFLAGS) $(XDAMAGE_CFLAGS) $(XV_CFLAGS) $(TBM_CFLAGS)
+libgstevaspixmapsink_la_LIBADD = \
+       $(GST_LIBS) -lgstvideo-$(GST_MAJORMINOR) -lgstinterfaces-$(GST_MAJORMINOR) \
+       $(X_LIBS) $(XVIDEO_LIBS) $(XSHM_LIBS) $(LIBM) \
+       $(EFL_LIBS) \
+       $(MMTA_LIBS) \
+       $(XFIXES_LIBS) $(DRI2PROTO_LIBS) $(DRI2_LIBS) $(X11_LIBS) $(XDAMAGE_LIBS) $(XV_LIBS) $(TBM_LIBS)
+libgstevaspixmapsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstxvimagesink_la_LIBTOOLFLAGS = --tag=disable-static
+
+noinst_HEADERS = evaspixmapsink.h
diff --git a/mobile/evaspixmapsink/evaspixmapsink.c b/mobile/evaspixmapsink/evaspixmapsink.c
new file mode 100644 (file)
index 0000000..8d62714
--- /dev/null
@@ -0,0 +1,4432 @@
+/*
+ * EvasPixmapSink
+ *
+ * Copyright (c) 2000 - 2012 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
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* Our interfaces */
+#include <gst/interfaces/navigation.h>
+#include <gst/interfaces/colorbalance.h>
+#include <gst/interfaces/propertyprobe.h>
+/* Helper functions */
+#include <gst/video/video.h>
+
+/* Object header */
+#include "evaspixmapsink.h"
+
+#include <time.h>
+
+/* Samsung extension headers */
+/* For xv extension header for buffer transfer (output) */
+#include "xv_types.h"
+
+/* headers for drm */
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <X11/Xmd.h>
+#include <dri2/dri2.h>
+#include <libdrm/drm.h>
+
+/* 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];
+       /* dma buf fd */
+       int dma_buf_fd[SCMN_IMGB_MAX_PLANE];
+       /* buffer share method */
+       int buf_share_method;
+       /* Y plane size in case of ST12 */
+       int y_size;
+       /* UV plane size in case of ST12 */
+       int uv_size;
+       /* Tizen buffer object */
+       void *bo[SCMN_IMGB_MAX_PLANE];
+       /* JPEG data */
+       void *jpeg_data;
+       /* JPEG size */
+       int jpeg_size;
+       /* TZ memory buffer */
+       int tz_enable;
+} SCMN_IMGB;
+
+/* Debugging category */
+#include <gst/gstinfo.h>
+GST_DEBUG_CATEGORY_STATIC (gst_debug_evaspixmapsink);
+#define GST_CAT_DEFAULT gst_debug_evaspixmapsink
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
+
+enum {
+    UPDATE_FALSE,
+    UPDATE_TRUE
+};
+
+enum {
+    DEGREE_0,
+    DEGREE_90,
+    DEGREE_180,
+    DEGREE_270,
+    DEGREE_NUM,
+};
+
+enum {
+    DISP_GEO_METHOD_LETTER_BOX = 0,
+    DISP_GEO_METHOD_ORIGIN_SIZE,
+    DISP_GEO_METHOD_FULL_SCREEN,
+    DISP_GEO_METHOD_CROPPED_FULL_SCREEN,
+    DISP_GEO_METHOD_CUSTOM_ROI,
+    DISP_GEO_METHOD_NUM,
+};
+
+enum {
+    FLIP_NONE = 0,
+    FLIP_HORIZONTAL,
+    FLIP_VERTICAL,
+    FLIP_BOTH,
+    FLIP_NUM,
+};
+
+#define DEF_DISPLAY_GEOMETRY_METHOD                     DISP_GEO_METHOD_LETTER_BOX
+#define DEF_DISPLAY_FLIP                                FLIP_NONE
+#define GST_TYPE_EVASPIXMAPSINK_FLIP                    (gst_evaspixmapsink_flip_get_type())
+#define GST_TYPE_EVASPIXMAPSINK_ROTATE_ANGLE            (gst_evaspixmapsink_rotate_angle_get_type())
+#define GST_TYPE_EVASPIXMAPSINK_DISPLAY_GEOMETRY_METHOD (gst_evaspixmapsink_display_geometry_method_get_type())
+#define SIZE_FOR_UPDATE_VISIBILITY                      sizeof(gchar)
+#define EPIPE_REQUEST_LIMIT                             20
+
+/* macro ******************************************************/
+#define EVASPIXMAPSINK_SET_PIXMAP_ID_TO_GEM_INFO( x_evaspixmapsink, x_pixmap_id ) \
+do \
+{ \
+       int i = 0; \
+       XV_DATA_PTR data = (XV_DATA_PTR)x_evaspixmapsink->evas_pixmap_buf->xvimage->data; \
+       if (data->YBuf > 0) { \
+               for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) { \
+                       if (evaspixmapsink->gem_info[i].gem_name == data->YBuf) { \
+                               evaspixmapsink->gem_info[i].ref_pixmap = x_pixmap_id; \
+                               GST_LOG_OBJECT (x_evaspixmapsink,"pixmap(%d) is marked at index(%d) of gem_info(YBuf)->gem_handle(%d)", x_pixmap_id, i, evaspixmapsink->gem_info[i].gem_handle); \
+                               break; \
+                       } \
+               } \
+       } \
+       if (data->CbBuf > 0) { \
+               for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) { \
+                       if (evaspixmapsink->gem_info[i].gem_name == data->CbBuf) { \
+                               evaspixmapsink->gem_info[i].ref_pixmap = x_pixmap_id; \
+                               GST_LOG_OBJECT (x_evaspixmapsink,"pixmap(%d) is marked at index(%d) of gem_info(CbBuf)->gem_handle(%d)", x_pixmap_id, i, evaspixmapsink->gem_info[i].gem_handle); \
+                               break; \
+                       } \
+               } \
+       } \
+       if (data->CrBuf > 0) { \
+               for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) { \
+                       if (evaspixmapsink->gem_info[i].gem_name == data->CrBuf) { \
+                               evaspixmapsink->gem_info[i].ref_pixmap = x_pixmap_id; \
+                               GST_LOG_OBJECT (x_evaspixmapsink,"pixmap(%d) is marked at index(%d) of gem_info(CrBuf)->gem_handle(%d)", x_pixmap_id, i, evaspixmapsink->gem_info[i].gem_handle); \
+                               break; \
+                       } \
+               } \
+       } \
+}while(0)
+
+#define EVASPIXMAPSINK_SET_EVAS_OBJECT_EVENT_CALLBACK( x_evas_image_object, x_usr_data ) \
+do \
+{ \
+       evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_DEL, evas_callback_del_event, x_usr_data); \
+       evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_RESIZE, evas_callback_resize_event, x_usr_data); \
+       evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_SHOW, evas_callback_show_event, x_usr_data); \
+       evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_HIDE, evas_callback_hide_event, x_usr_data); \
+}while(0)
+
+#define EVASPIXMAPSINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK( x_evas_image_object ) \
+do \
+{ \
+       evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_DEL, evas_callback_del_event); \
+       evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_RESIZE, evas_callback_resize_event); \
+       evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_SHOW, evas_callback_show_event); \
+       evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_HIDE, evas_callback_hide_event); \
+}while(0)
+
+static GType
+gst_evaspixmapsink_flip_get_type(void)
+{
+       static GType evaspixmapsink_flip_type = 0;
+       static const GEnumValue flip_type[] = {
+               { FLIP_NONE,       "Flip NONE", "FLIP_NONE"},
+               { FLIP_HORIZONTAL, "Flip HORIZONTAL", "FLIP_HORIZONTAL"},
+               { FLIP_VERTICAL,   "Flip VERTICAL", "FLIP_VERTICAL"},
+               { FLIP_BOTH,       "Flip BOTH", "FLIP_BOTH"},
+               { FLIP_NUM, NULL, NULL},
+       };
+
+       if (!evaspixmapsink_flip_type) {
+               evaspixmapsink_flip_type = g_enum_register_static("GstEvasPixmapSinkFlipType", flip_type);
+       }
+
+       return evaspixmapsink_flip_type;
+}
+
+static GType
+gst_evaspixmapsink_rotate_angle_get_type(void)
+{
+       static GType evaspixmapsink_rotate_angle_type = 0;
+       static const GEnumValue rotate_angle_type[] = {
+               { 0, "No rotate", "DEGREE_0"},
+               { 1, "Rotate 90 degree", "DEGREE_90"},
+               { 2, "Rotate 180 degree", "DEGREE_180"},
+               { 3, "Rotate 270 degree", "DEGREE_270"},
+               { 4, NULL, NULL},
+       };
+
+       if (!evaspixmapsink_rotate_angle_type) {
+               evaspixmapsink_rotate_angle_type = g_enum_register_static("GstEvasPixmapSinkRotateAngleType", rotate_angle_type);
+       }
+
+       return evaspixmapsink_rotate_angle_type;
+}
+
+static GType
+gst_evaspixmapsink_display_geometry_method_get_type(void)
+{
+       static GType evaspixmapsink_display_geometry_method_type = 0;
+       static const GEnumValue display_geometry_method_type[] = {
+               { 0, "Letter box", "LETTER_BOX"},
+               { 1, "Origin size", "ORIGIN_SIZE"},
+               { 2, "Full-screen", "FULL_SCREEN"},
+               { 3, "Cropped Full-screen", "CROPPED_FULL_SCREEN"},
+               { 4, "Explicitely described destination ROI", "CUSTOM_ROI"},
+               { 5, NULL, NULL},
+       };
+
+       if (!evaspixmapsink_display_geometry_method_type) {
+               evaspixmapsink_display_geometry_method_type = g_enum_register_static("GstEvasPixmapSinkDisplayGeometryMethodType", display_geometry_method_type);
+       }
+
+       return evaspixmapsink_display_geometry_method_type;
+}
+
+typedef struct
+{
+  unsigned long flags;
+  unsigned long functions;
+  unsigned long decorations;
+  long input_mode;
+  unsigned long status;
+}
+MotifWmHints, MwmHints;
+
+#define MWM_HINTS_DECORATIONS   (1L << 1)
+
+static void gst_evaspixmapsink_reset (GstEvasPixmapSink *evaspixmapsink);
+static GstBufferClass *evaspixmap_buffer_parent_class = NULL;
+static void gst_evaspixmap_buffer_finalize (GstEvasPixmapBuffer *evaspixmapbuf);
+static void gst_evaspixmapsink_xcontext_clear (GstEvasPixmapSink *evaspixmapsink);
+static void gst_evaspixmapsink_xpixmap_destroy (GstEvasPixmapSink *evaspixmapsink, GstXPixmap *xpixmap);
+static void gst_evaspixmapsink_xpixmap_update_geometry (GstEvasPixmapSink *evaspixmapsink, int idx);
+static gboolean gst_evaspixmap_buffer_put (GstEvasPixmapSink *evaspixmapsink, GstEvasPixmapBuffer *evaspixmapbuf);
+static gboolean gst_evaspixmapsink_xpixmap_link (GstEvasPixmapSink *evaspixmapsink);
+static void gst_evaspixmapsink_xpixmap_clear (GstEvasPixmapSink *evaspixmapsink, GstXPixmap *xpixmap);
+static gint gst_evaspixmapsink_get_format_from_caps (GstEvasPixmapSink *evaspixmapsink, GstCaps *caps);
+static void drm_close_gem(GstEvasPixmapSink *evaspixmapsink, unsigned int gem_handle);
+static void drm_fini_close_gem_handle(GstEvasPixmapSink *evaspixmapsink, Pixmap pixmap_id);
+static void evas_callback_resize_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void evas_callback_del_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void evas_callback_show_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void evas_callback_hide_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+/* Default template - initiated with class struct to allow gst-register to work
+   without X running */
+static GstStaticPadTemplate gst_evaspixmapsink_sink_template_factory =
+    GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw-rgb, "
+        "framerate = (fraction) [ 0, MAX ], "
+        "width = (int) [ 1, MAX ], "
+        "height = (int) [ 1, MAX ]; "
+        "video/x-raw-yuv, "
+        "framerate = (fraction) [ 0, MAX ], "
+        "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
+    );
+
+enum
+{
+  PROP_0,
+  PROP_CONTRAST,
+  PROP_BRIGHTNESS,
+  PROP_HUE,
+  PROP_SATURATION,
+  PROP_DISPLAY,
+  PROP_SYNCHRONOUS,
+  PROP_PIXEL_ASPECT_RATIO,
+  PROP_DEVICE,
+  PROP_DEVICE_NAME,
+  PROP_DOUBLE_BUFFER,
+  PROP_AUTOPAINT_COLORKEY,
+  PROP_COLORKEY,
+  PROP_PIXMAP_WIDTH,
+  PROP_PIXMAP_HEIGHT,
+  PROP_FLIP,
+  PROP_ROTATE_ANGLE,
+  PROP_DISPLAY_GEOMETRY_METHOD,
+  PROP_ZOOM,
+  PROP_DST_ROI_X,
+  PROP_DST_ROI_Y,
+  PROP_DST_ROI_W,
+  PROP_DST_ROI_H,
+  PROP_STOP_VIDEO,
+  PROP_EVAS_OBJECT,
+  PROP_VISIBLE,
+  PROP_ORIGIN_SIZE,
+};
+
+static GstVideoSinkClass *parent_class = NULL;
+
+/* ============================================================= */
+/*                                                               */
+/*                       Private Methods                         */
+/*                                                               */
+/* ============================================================= */
+
+/* evaspixmap buffers */
+
+#define GST_TYPE_EVASPIXMAP_BUFFER (gst_evaspixmap_buffer_get_type())
+
+#define GST_IS_EVASPIXMAP_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_EVASPIXMAP_BUFFER))
+#define GST_EVASPIXMAP_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_EVASPIXMAP_BUFFER, GstEvasPixmapBuffer))
+
+static int get_millis_time()
+{
+    struct timespec tp;
+    clock_gettime(CLOCK_MONOTONIC, &tp);
+    return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
+}
+
+static void
+ecore_pipe_callback_handler (void *data, void *buffer, unsigned int nbyte)
+{
+       GstEvasPixmapSink *evaspixmapsink = (GstEvasPixmapSink*)data;
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START] Evas_Object(0x%x)", evaspixmapsink->eo);
+       MMTA_ACUM_ITEM_BEGIN("evaspixmapsink - ecore thread cb : TOTAL", FALSE);
+       int i = 0;
+       guint idx = 0;
+       GstXPixmap *xpixmap = NULL;
+
+       if (!data ) {
+               GST_WARNING_OBJECT (evaspixmapsink,"data is NULL..");
+               return;
+       }
+       evaspixmapsink->epipe_request_count--;
+       if (!evaspixmapsink->eo) {
+               GST_WARNING_OBJECT (evaspixmapsink,"evas object is NULL..");
+               return;
+       }
+
+       /* setting evas object hide and show */
+       if (nbyte == SIZE_FOR_UPDATE_VISIBILITY) {
+               if(!evaspixmapsink->visible) {
+                       evas_object_hide(evaspixmapsink->eo);
+                       GST_INFO_OBJECT (evaspixmapsink, "object hide");
+               } else {
+                       if (!evas_object_image_native_surface_get(evaspixmapsink->eo)) {
+                               GST_WARNING_OBJECT (evaspixmapsink, "native surface is not set, skip evas_object_show()..");
+                       } else {
+                               evas_object_show(evaspixmapsink->eo);
+                               GST_INFO_OBJECT (evaspixmapsink, "object show");
+                       }
+               }
+               return;
+       }
+
+       /* mapping evas object with xpixmap */
+       if (evaspixmapsink->do_link) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"do link");
+               evas_object_image_size_set(evaspixmapsink->eo, evaspixmapsink->w, evaspixmapsink->h);
+               if (evaspixmapsink->xpixmap[idx]->pixmap) {
+                       Evas_Native_Surface surf;
+                       surf.version = EVAS_NATIVE_SURFACE_VERSION;
+                       surf.type = EVAS_NATIVE_SURFACE_X11;
+                       surf.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
+                       surf.data.x11.pixmap = evaspixmapsink->xpixmap[idx]->pixmap;
+                       __ta__("evaspixmapsink - ecore thread cb : _native_surface_set(LINK)", evas_object_image_native_surface_set(evaspixmapsink->eo, &surf); );
+                       evaspixmapsink->do_link = FALSE;
+               } else {
+                       GST_WARNING_OBJECT (evaspixmapsink,"pixmap is NULL..");
+                       return;
+               }
+               for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                       if (evaspixmapsink->xpixmap[i]->prev_pixmap && evaspixmapsink->xpixmap[i]->prev_gc && evaspixmapsink->prev_damage[i]) {
+                               GST_LOG_OBJECT (evaspixmapsink,"Free pixmap(%d), gc(%x), destroy previous damage(%d)",
+                                               evaspixmapsink->xpixmap[i]->prev_pixmap, evaspixmapsink->xpixmap[i]->prev_gc, evaspixmapsink->prev_damage[i]);
+                               g_mutex_lock (evaspixmapsink->x_lock);
+                               XFreePixmap(evaspixmapsink->xcontext->disp, evaspixmapsink->xpixmap[i]->prev_pixmap);
+                               XFreeGC (evaspixmapsink->xcontext->disp, evaspixmapsink->xpixmap[i]->prev_gc);
+                               XDamageDestroy(evaspixmapsink->xcontext->disp, evaspixmapsink->prev_damage[i]);
+                               XSync(evaspixmapsink->xcontext->disp, FALSE);
+                               g_mutex_unlock (evaspixmapsink->x_lock);
+                               evaspixmapsink->xpixmap[i]->prev_pixmap = 0;
+                               evaspixmapsink->xpixmap[i]->prev_gc = 0;
+                               evaspixmapsink->prev_damage[i] = NULL;
+                       }
+               }
+               if (evaspixmapsink->visible && !evas_object_visible_get(evaspixmapsink->eo)) {
+                       evas_object_show(evaspixmapsink->eo);
+                       GST_WARNING_OBJECT (evaspixmapsink, "object show (lazy)");
+               }
+
+       } else {
+               GST_DEBUG_OBJECT (evaspixmapsink,"update");
+               /* update evas image object size */
+               if (evaspixmapsink->use_origin_size) {
+                       evas_object_geometry_get(evaspixmapsink->eo, NULL, NULL, &evaspixmapsink->w, &evaspixmapsink->h);
+               }
+
+               g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+
+               /* find a oldest damaged pixmap */
+               int temp_time = 0;
+               for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                       if (evaspixmapsink->last_updated_idx == i) {
+                               continue;
+                       } else {
+                               xpixmap = evaspixmapsink->xpixmap[i];
+                               if (xpixmap->ref > 0 && xpixmap->damaged_time) {
+                                       if (temp_time == 0) {
+                                               temp_time = xpixmap->damaged_time;
+                                               idx = i;
+                                       } else {
+                                               if (temp_time > xpixmap->damaged_time) {
+                                                       temp_time = xpixmap->damaged_time;
+                                                       idx = i;
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               xpixmap = evaspixmapsink->xpixmap[idx];
+               if (xpixmap->pixmap) {
+                       if (evaspixmapsink->last_updated_idx != idx) {
+                               Evas_Native_Surface surf;
+                               surf.version = EVAS_NATIVE_SURFACE_VERSION;
+                               surf.type = EVAS_NATIVE_SURFACE_X11;
+                               surf.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
+                               surf.data.x11.pixmap = xpixmap->pixmap;
+                               if (evaspixmapsink->eo) {
+                                       evas_object_image_native_surface_set(evaspixmapsink->eo, NULL);
+                               }
+                               __ta__("evaspixmapsink - ecore thread cb : _native_surface_set", evas_object_image_native_surface_set(evaspixmapsink->eo, &surf); );
+                               GST_LOG_OBJECT (evaspixmapsink,"update, native_surface_set of xpixmap[%d]",idx);
+                               if (evaspixmapsink->last_updated_idx == -1) {
+                                       xpixmap->damaged_time = 0;
+                                       GST_INFO_OBJECT (evaspixmapsink,"this is the first time to request to update(do not DECREASE ref-count) : pixmap(%d), refcount(%d), damaged_time(%d), idx(%d)",
+                                                                       xpixmap->pixmap, xpixmap->ref, xpixmap->damaged_time, idx);
+                               } else {
+                                       xpixmap = evaspixmapsink->xpixmap[evaspixmapsink->last_updated_idx];
+                                       xpixmap->ref--;
+                                       xpixmap->damaged_time = 0;
+                                       GST_INFO_OBJECT (evaspixmapsink,"pixmap ref-count DECREASED : pixmap(%d), refcount(%d), damaged_time(%d), idx(%d)",
+                                                                                       xpixmap->pixmap, xpixmap->ref, xpixmap->damaged_time, evaspixmapsink->last_updated_idx);
+                               }
+                               evaspixmapsink->last_updated_idx = idx;
+                       }
+
+                       MMTA_ACUM_ITEM_BEGIN("evaspixmapsink evas_object_image update", FALSE);
+                       evas_object_image_pixels_dirty_set (evaspixmapsink->eo, 1);
+                       evas_object_image_fill_set(evaspixmapsink->eo, 0, 0, evaspixmapsink->w, evaspixmapsink->h);
+                       evas_object_image_data_update_add(evaspixmapsink->eo, 0, 0, evaspixmapsink->w, evaspixmapsink->h);
+                       MMTA_ACUM_ITEM_END("evaspixmapsink evas_object_image update", FALSE);
+                       //GST_LOG_OBJECT (evaspixmapsink,"request to update : pixmap idx(%d), ref(%d)", idx, xpixmap->ref);
+               } else {
+                       GST_ERROR_OBJECT (evaspixmapsink,"pixmap is NULL..");
+               }
+               g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+       }
+
+       MMTA_ACUM_ITEM_END("evaspixmapsink - ecore thread cb : TOTAL", FALSE);
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+}
+
+static inline gboolean
+is_evas_image_object (Evas_Object *obj)
+{
+       const char *type;
+       if (!obj) {
+               GST_ERROR ("evas image object is NULL..");
+               return FALSE;
+       }
+       type = evas_object_type_get (obj);
+       if (!type) {
+               GST_ERROR ("could not find type of the evas object..");
+               return FALSE;
+       }
+       if (strcmp (type, "image") == 0) {
+               return TRUE;
+       }
+       return FALSE;
+}
+
+static void
+evas_callback_resize_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       int w = 0;
+       int h = 0;
+       float former_ratio = 0;
+       float ratio = 0;
+       int i = 0;
+#ifdef COMPARE_RATIO
+       float abs_margin = 0;
+#endif
+
+       GstEvasPixmapSink *evaspixmapsink = (GstEvasPixmapSink *)data;
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START] evas_image_object(%x), tid(%u)", obj, (unsigned int)pthread_self());
+
+       evas_object_geometry_get(evaspixmapsink->eo, NULL, NULL, &w, &h);
+       GST_DEBUG_OBJECT (evaspixmapsink,"resized : w(%d), h(%d)", w, h);
+       if (!evaspixmapsink->use_origin_size &&
+                       (evaspixmapsink->w != w || evaspixmapsink->h != h)) {
+               former_ratio = (float)evaspixmapsink->w / evaspixmapsink->h;
+               ratio = (float)w / h;
+               evaspixmapsink->w = w;
+               evaspixmapsink->h = h;
+
+#ifdef COMPARE_RATIO
+               GST_DEBUG_OBJECT (evaspixmapsink,"resized : ratio(%.3f=>%.3f)", former_ratio, ratio);
+               if ( former_ratio >= ratio ) {
+                       abs_margin = former_ratio - ratio;
+               } else {
+                       abs_margin = ratio - former_ratio;
+               }
+               /* re-link_pixmap can only be set when ratio is changed */
+               if ( abs_margin >= MARGIN_OF_ERROR ) {
+#endif
+                       if (!gst_evaspixmapsink_xpixmap_link(evaspixmapsink)) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                               return;
+                       }
+                       for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) {
+                               if (evaspixmapsink->gem_info[i].ref_pixmap > 0) {
+                                       GST_LOG_OBJECT (evaspixmapsink,"set ref_pixmap(%d) to 0 in gem_info[%d]", evaspixmapsink->gem_info[i].ref_pixmap, i);
+                                       evaspixmapsink->gem_info[i].ref_pixmap = 0;
+                               }
+                       }
+#ifdef COMPARE_RATIO
+               }
+#endif
+       }
+
+       if (GST_STATE(evaspixmapsink) == GST_STATE_PAUSED) {
+               gst_evaspixmap_buffer_put (evaspixmapsink, evaspixmapsink->evas_pixmap_buf);
+       }
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+}
+
+static void
+evas_callback_del_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       GstEvasPixmapSink *evaspixmapsink = data;
+       if (!evaspixmapsink) {
+               GST_WARNING ("evaspixmapsink is NULL..");
+               return;
+       }
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START]");
+
+       EVASPIXMAPSINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK( evaspixmapsink->eo );
+       if (evaspixmapsink->eo) {
+               evas_object_image_native_surface_set(evaspixmapsink->eo, NULL);
+               evaspixmapsink->eo = NULL;
+       }
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+}
+
+static void
+evas_callback_show_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       GstEvasPixmapSink *evaspixmapsink = (GstEvasPixmapSink *)data;
+       GST_INFO_OBJECT (evaspixmapsink,"show evas_image_object(%x) from pid(%d), tid(%u)", obj, getpid(), (unsigned int)pthread_self());
+}
+
+static void
+evas_callback_hide_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       GstEvasPixmapSink *evaspixmapsink = (GstEvasPixmapSink *)data;
+       GST_INFO_OBJECT (evaspixmapsink,"hide evas_image_object(%x) from pid(%d), tid(%u)", obj, getpid(), (unsigned int)pthread_self());
+}
+
+/* X11 stuff */
+static gboolean error_caught = FALSE;
+
+static int
+gst_evaspixmapsink_handle_xerror (Display * display, XErrorEvent * xevent)
+{
+  char error_msg[1024];
+
+  XGetErrorText (display, xevent->error_code, error_msg, 1024);
+  GST_ERROR ("evaspixmapsink triggered an XError. error(%s), display(%p), xevent->request_code(%d)", error_msg, display, xevent->request_code);
+  error_caught = TRUE;
+  return 0;
+}
+
+#ifdef HAVE_XSHM
+/* This function checks that it is actually really possible to create an image
+   using XShm */
+static gboolean
+gst_evaspixmapsink_check_xshm_calls (GstXContext * xcontext)
+{
+  XvImage *xvimage;
+  XShmSegmentInfo SHMInfo;
+  gint size;
+  int (*handler) (Display *, XErrorEvent *);
+  gboolean result = FALSE;
+  gboolean did_attach = FALSE;
+
+  g_return_val_if_fail (xcontext != NULL, FALSE);
+
+  /* Sync to ensure any older errors are already processed */
+  XSync (xcontext->disp, FALSE);
+
+  /* Set defaults so we don't free these later unnecessarily */
+  SHMInfo.shmaddr = ((void *) -1);
+  SHMInfo.shmid = -1;
+
+  /* Setting an error handler to catch failure */
+  error_caught = FALSE;
+  handler = XSetErrorHandler (gst_evaspixmapsink_handle_xerror);
+
+  /* Trying to create a 1x1 picture */
+  GST_DEBUG ("XvShmCreateImage of 1x1");
+  xvimage = XvShmCreateImage (xcontext->disp, xcontext->xv_port_id,
+      xcontext->im_format, NULL, 1, 1, &SHMInfo);
+
+  /* Might cause an error, sync to ensure it is noticed */
+  XSync (xcontext->disp, FALSE);
+  if (!xvimage || error_caught) {
+    GST_WARNING ("could not XvShmCreateImage a 1x1 image");
+    goto beach;
+  }
+  size = xvimage->data_size;
+
+  SHMInfo.shmid = shmget (IPC_PRIVATE, size, IPC_CREAT | 0777);
+  if (SHMInfo.shmid == -1) {
+    GST_WARNING ("could not get shared memory of %d bytes", size);
+    goto beach;
+  }
+
+  SHMInfo.shmaddr = shmat (SHMInfo.shmid, NULL, 0);
+  if (SHMInfo.shmaddr == ((void *) -1)) {
+    GST_WARNING ("Failed to shmat: %s", g_strerror (errno));
+    /* Clean up the shared memory segment */
+    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+
+  xvimage->data = SHMInfo.shmaddr;
+  SHMInfo.readOnly = FALSE;
+
+  if (XShmAttach (xcontext->disp, &SHMInfo) == 0) {
+    GST_WARNING ("Failed to XShmAttach");
+    /* Clean up the shared memory segment */
+    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+
+  /* Sync to ensure we see any errors we caused */
+  XSync (xcontext->disp, FALSE);
+
+  /* Delete the shared memory segment as soon as everyone is attached.
+   * This way, it will be deleted as soon as we detach later, and not
+   * leaked if we crash. */
+  shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+
+  if (!error_caught) {
+    GST_DEBUG ("XServer ShmAttached to 0x%x, id 0x%lx", SHMInfo.shmid,
+        SHMInfo.shmseg);
+
+    did_attach = TRUE;
+    /* store whether we succeeded in result */
+    result = TRUE;
+  } else {
+    GST_WARNING ("MIT-SHM extension check failed at XShmAttach. "
+        "Not using shared memory.");
+  }
+
+beach:
+  /* Sync to ensure we swallow any errors we caused and reset error_caught */
+  XSync (xcontext->disp, FALSE);
+
+  error_caught = FALSE;
+  XSetErrorHandler (handler);
+
+  if (did_attach) {
+    GST_DEBUG ("XServer ShmDetaching from 0x%x id 0x%lx",
+        SHMInfo.shmid, SHMInfo.shmseg);
+    XShmDetach (xcontext->disp, &SHMInfo);
+    XSync (xcontext->disp, FALSE);
+  }
+  if (SHMInfo.shmaddr != ((void *) -1))
+    shmdt (SHMInfo.shmaddr);
+  if (xvimage)
+    XFree (xvimage);
+  return result;
+}
+#endif /* HAVE_XSHM */
+
+/* This function destroys a GstEvasPixmap handling XShm availability */
+static void
+gst_evaspixmap_buffer_destroy (GstEvasPixmapBuffer *evaspixmapbuf)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+
+       evaspixmapsink = evaspixmapbuf->evaspixmapsink;
+       if (G_UNLIKELY (evaspixmapsink == NULL)) {
+               goto no_sink;
+       }
+       GST_DEBUG_OBJECT (evaspixmapsink, "Destroying buffer");
+
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+       GST_OBJECT_LOCK (evaspixmapsink);
+
+       /* We might have some buffers destroyed after changing state to NULL */
+       if (evaspixmapsink->xcontext == NULL) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Destroying XvImage after Xcontext");
+#ifdef HAVE_XSHM
+               /* Need to free the shared memory segment even if the x context
+               * was already cleaned up */
+               if (evaspixmapbuf->SHMInfo.shmaddr != ((void *) -1)) {
+                       shmdt (evaspixmapbuf->SHMInfo.shmaddr);
+               }
+#endif
+               goto beach;
+       }
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+#ifdef HAVE_XSHM
+       if (evaspixmapsink->xcontext->use_xshm) {
+               if (evaspixmapbuf->SHMInfo.shmaddr != ((void *) -1)) {
+                       GST_DEBUG_OBJECT (evaspixmapsink,"XServer ShmDetaching from 0x%x id 0x%lx", evaspixmapbuf->SHMInfo.shmid, evaspixmapbuf->SHMInfo.shmseg);
+                       XShmDetach (evaspixmapsink->xcontext->disp, &evaspixmapbuf->SHMInfo);
+                       XSync (evaspixmapsink->xcontext->disp, FALSE);
+                       shmdt (evaspixmapbuf->SHMInfo.shmaddr);
+               }
+               if (evaspixmapbuf->xvimage)
+               XFree (evaspixmapbuf->xvimage);
+       } else
+#endif /* HAVE_XSHM */
+       {
+               if (evaspixmapbuf->xvimage) {
+                       if (evaspixmapbuf->xvimage->data) {
+                               g_free (evaspixmapbuf->xvimage->data);
+                       }
+                       XFree (evaspixmapbuf->xvimage);
+               }
+       }
+
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+beach:
+       GST_OBJECT_UNLOCK (evaspixmapsink);
+       evaspixmapbuf->evaspixmapsink = NULL;
+       gst_object_unref (evaspixmapsink);
+
+       GST_MINI_OBJECT_CLASS (evaspixmap_buffer_parent_class)->finalize (GST_MINI_OBJECT(evaspixmapbuf));
+
+       return;
+
+       no_sink:
+       {
+               GST_WARNING ("no sink found");
+               return;
+       }
+}
+
+static void
+gst_evaspixmap_buffer_finalize (GstEvasPixmapBuffer *evaspixmapbuf)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+
+       evaspixmapsink = evaspixmapbuf->evaspixmapsink;
+       if (G_UNLIKELY (evaspixmapsink == NULL)) {
+               GST_WARNING_OBJECT (evaspixmapsink,"no sink found");
+               return;
+       }
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+        /* If our geometry changed we can't reuse that image. */
+       GST_LOG_OBJECT (evaspixmapsink,"destroy image as sink is shutting down");
+       gst_evaspixmap_buffer_destroy (evaspixmapbuf);
+}
+
+static void
+gst_evaspixmap_buffer_free (GstEvasPixmapBuffer *evaspixmapbuf)
+{
+  /* make sure it is not recycled */
+  evaspixmapbuf->width = -1;
+  evaspixmapbuf->height = -1;
+  gst_buffer_unref (GST_BUFFER (evaspixmapbuf));
+}
+
+static void
+gst_evaspixmap_buffer_init (GstEvasPixmapBuffer *evaspixmapbuf, gpointer g_class)
+{
+#ifdef HAVE_XSHM
+  evaspixmapbuf->SHMInfo.shmaddr = ((void *) -1);
+  evaspixmapbuf->SHMInfo.shmid = -1;
+#endif
+}
+
+static void
+gst_evaspixmap_buffer_class_init (gpointer g_class, gpointer class_data)
+{
+  GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
+
+  evaspixmap_buffer_parent_class = g_type_class_peek_parent (g_class);
+
+  mini_object_class->finalize = (GstMiniObjectFinalizeFunction) gst_evaspixmap_buffer_finalize;
+}
+
+static GType
+gst_evaspixmap_buffer_get_type (void)
+{
+  static GType _gst_evaspixmap_buffer_type;
+
+  if (G_UNLIKELY (_gst_evaspixmap_buffer_type == 0)) {
+    static const GTypeInfo evaspixmap_buffer_info = {
+      sizeof (GstBufferClass),
+      NULL,
+      NULL,
+      gst_evaspixmap_buffer_class_init,
+      NULL,
+      NULL,
+      sizeof (GstEvasPixmapBuffer),
+      0,
+      (GInstanceInitFunc) gst_evaspixmap_buffer_init,
+      NULL
+    };
+    _gst_evaspixmap_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
+        "GstEvasPixmapBuffer", &evaspixmap_buffer_info, 0);
+  }
+  return _gst_evaspixmap_buffer_type;
+}
+
+/* This function handles GstEvasPixmapBuffer creation depending on XShm availability */
+static GstEvasPixmapBuffer*
+gst_evaspixmap_buffer_new (GstEvasPixmapSink *evaspixmapsink, GstCaps *caps)
+{
+       GstEvasPixmapBuffer *evaspixmapbuf = NULL;
+       GstStructure *structure = NULL;
+       gboolean succeeded = FALSE;
+       int (*handler) (Display *, XErrorEvent *);
+
+       g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), NULL);
+
+       if (caps == NULL) {
+               return NULL;
+       }
+
+       evaspixmapbuf = (GstEvasPixmapBuffer*) gst_mini_object_new (GST_TYPE_EVASPIXMAP_BUFFER);
+       GST_DEBUG_OBJECT (evaspixmapsink,"Creating new EvasPixmapBuffer");
+
+       structure = gst_caps_get_structure (caps, 0);
+
+       if (!gst_structure_get_int (structure, "width", &evaspixmapbuf->width) || !gst_structure_get_int (structure, "height", &evaspixmapbuf->height)) {
+               GST_WARNING_OBJECT (evaspixmapsink,"failed getting geometry from caps %" GST_PTR_FORMAT, caps);
+       }
+
+       GST_LOG_OBJECT (evaspixmapsink,"creating %dx%d", evaspixmapbuf->width, evaspixmapbuf->height);
+
+       GST_LOG_OBJECT (evaspixmapsink,"aligned size %dx%d", evaspixmapsink->aligned_width, evaspixmapsink->aligned_height);
+       if (evaspixmapsink->aligned_width == 0 || evaspixmapsink->aligned_height == 0) {
+               GST_INFO_OBJECT (evaspixmapsink,"aligned size is zero. set size of caps.");
+               evaspixmapsink->aligned_width = evaspixmapbuf->width;
+               evaspixmapsink->aligned_height = evaspixmapbuf->height;
+       }
+
+       evaspixmapbuf->im_format = gst_evaspixmapsink_get_format_from_caps (evaspixmapsink, caps);
+       if (evaspixmapbuf->im_format == -1) {
+               GST_WARNING_OBJECT (evaspixmapsink,"failed to get format from caps %"GST_PTR_FORMAT, caps);
+               GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,("Failed to create output image buffer of %dx%d pixels",
+                                  evaspixmapbuf->width, evaspixmapbuf->height), ("Invalid input caps"));
+               goto beach_unlocked;
+       }
+
+       GST_INFO_OBJECT (evaspixmapsink, "FOURCC format : %c%c%c%c", evaspixmapbuf->im_format, evaspixmapbuf->im_format>>8,
+                       evaspixmapbuf->im_format>>16, evaspixmapbuf->im_format>>24);
+
+       evaspixmapbuf->evaspixmapsink = gst_object_ref (evaspixmapsink);
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+       /* Sync to ensure we swallow any errors we caused and reset error_caught */
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       /* Setting an error handler to catch failure */
+       error_caught = FALSE;
+       handler = XSetErrorHandler (gst_evaspixmapsink_handle_xerror);
+
+#ifdef HAVE_XSHM
+       if (evaspixmapsink->xcontext->use_xshm) {
+               int expected_size;
+               evaspixmapbuf->xvimage = XvShmCreateImage (evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, evaspixmapbuf->im_format, NULL,
+               evaspixmapsink->aligned_width, evaspixmapsink->aligned_height, &evaspixmapbuf->SHMInfo);
+               if (!evaspixmapbuf->xvimage || error_caught) {
+                       if (error_caught) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"error_caught!");
+                       }
+                       if(!evaspixmapbuf->xvimage) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"XvShmCreateImage() failed");
+                       }
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       /* Reset error handler */
+                       error_caught = FALSE;
+                       XSetErrorHandler (handler);
+                       /* Push an error */
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,("Failed to create output image buffer of %dx%d pixels",evaspixmapbuf->width,
+                                  evaspixmapbuf->height),("could not XvShmCreateImage a %dx%d image",evaspixmapbuf->width, evaspixmapbuf->height));
+                       goto beach_unlocked;
+               }
+
+               /* we have to use the returned data_size for our shm size */
+               evaspixmapbuf->size = evaspixmapbuf->xvimage->data_size;
+               GST_LOG_OBJECT (evaspixmapsink,"XShm image size is %" G_GSIZE_FORMAT, evaspixmapbuf->size);
+
+               /* calculate the expected size.  This is only for sanity checking the
+               * number we get from X. */
+               switch (evaspixmapbuf->im_format) {
+               case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+               case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
+               {
+                       gint pitches[3];
+                       gint offsets[3];
+                       guint plane;
+
+                       offsets[0] = 0;
+                       pitches[0] = GST_ROUND_UP_4 (evaspixmapbuf->width);
+                       offsets[1] = offsets[0] + pitches[0] * GST_ROUND_UP_2 (evaspixmapbuf->height);
+                       pitches[1] = GST_ROUND_UP_8 (evaspixmapbuf->width) / 2;
+                       offsets[2] =
+                       offsets[1] + pitches[1] * GST_ROUND_UP_2 (evaspixmapbuf->height) / 2;
+                       pitches[2] = GST_ROUND_UP_8 (pitches[0]) / 2;
+
+                       expected_size = offsets[2] + pitches[2] * GST_ROUND_UP_2 (evaspixmapbuf->height) / 2;
+
+                       for (plane = 0; plane < evaspixmapbuf->xvimage->num_planes; plane++) {
+                               GST_DEBUG_OBJECT (evaspixmapsink,"Plane %u has a expected pitch of %d bytes, " "offset of %d",
+                                               plane, pitches[plane], offsets[plane]);
+                       }
+                       break;
+               }
+               case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
+               case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
+                       expected_size = evaspixmapbuf->height * GST_ROUND_UP_4 (evaspixmapbuf->width * 2);
+                       break;
+               case GST_MAKE_FOURCC ('S', 'T', '1', '2'):
+               case GST_MAKE_FOURCC ('S', 'N', '1', '2'):
+               case GST_MAKE_FOURCC ('S', 'U', 'Y', 'V'):
+               case GST_MAKE_FOURCC ('S', 'U', 'Y', '2'):
+               case GST_MAKE_FOURCC ('S', '4', '2', '0'):
+               case GST_MAKE_FOURCC ('S', 'Y', 'V', 'Y'):
+               case GST_MAKE_FOURCC ('I', 'T', 'L', 'V'):
+               case GST_MAKE_FOURCC ('S', 'R', '3', '2'):
+                       expected_size = sizeof(SCMN_IMGB);
+                       break;
+               default:
+                       expected_size = 0;
+                       break;
+               }
+               if (expected_size != 0 && evaspixmapbuf->size != expected_size) {
+                       GST_WARNING_OBJECT (evaspixmapsink,"unexpected XShm image size (got %" G_GSIZE_FORMAT ", expected %d)", evaspixmapbuf->size, expected_size);
+               }
+
+               /* Be verbose about our XvImage stride */
+               {
+                       guint plane;
+                       for (plane = 0; plane < evaspixmapbuf->xvimage->num_planes; plane++) {
+                               GST_DEBUG_OBJECT (evaspixmapsink,"Plane %u has a pitch of %d bytes, ""offset of %d", plane,
+                                               evaspixmapbuf->xvimage->pitches[plane], evaspixmapbuf->xvimage->offsets[plane]);
+                       }
+               }
+
+               evaspixmapbuf->SHMInfo.shmid = shmget (IPC_PRIVATE, evaspixmapbuf->size,IPC_CREAT | 0777);
+               if (evaspixmapbuf->SHMInfo.shmid == -1) {
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,
+                               ("Failed to create output image buffer of %dx%d pixels", evaspixmapbuf->width, evaspixmapbuf->height),
+                               ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",evaspixmapbuf->size));
+                       goto beach_unlocked;
+               }
+
+               evaspixmapbuf->SHMInfo.shmaddr = shmat (evaspixmapbuf->SHMInfo.shmid, NULL, 0);
+               if (evaspixmapbuf->SHMInfo.shmaddr == ((void *) -1)) {
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,
+                               ("Failed to create output image buffer of %dx%d pixels",
+                               evaspixmapbuf->width, evaspixmapbuf->height),
+                               ("Failed to shmat: %s", g_strerror (errno)));
+                       /* Clean up the shared memory segment */
+                       shmctl (evaspixmapbuf->SHMInfo.shmid, IPC_RMID, NULL);
+                       goto beach_unlocked;
+               }
+
+               evaspixmapbuf->xvimage->data = evaspixmapbuf->SHMInfo.shmaddr;
+               evaspixmapbuf->SHMInfo.readOnly = FALSE;
+
+               if (XShmAttach (evaspixmapsink->xcontext->disp, &evaspixmapbuf->SHMInfo) == 0) {
+               /* Clean up the shared memory segment */
+               shmctl (evaspixmapbuf->SHMInfo.shmid, IPC_RMID, NULL);
+
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,
+                       ("Failed to create output image buffer of %dx%d pixels",
+                       evaspixmapbuf->width, evaspixmapbuf->height), ("Failed to XShmAttach"));
+               goto beach_unlocked;
+               }
+
+               XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+               /* Delete the shared memory segment as soon as we everyone is attached.
+               * This way, it will be deleted as soon as we detach later, and not
+               * leaked if we crash. */
+               shmctl (evaspixmapbuf->SHMInfo.shmid, IPC_RMID, NULL);
+
+               GST_DEBUG_OBJECT (evaspixmapsink,"XServer ShmAttached to 0x%x, id 0x%lx", evaspixmapbuf->SHMInfo.shmid, evaspixmapbuf->SHMInfo.shmseg);
+       } else
+#endif /* HAVE_XSHM */
+       {
+               evaspixmapbuf->xvimage = XvCreateImage (evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id,
+               evaspixmapbuf->im_format, NULL, evaspixmapsink->aligned_width, evaspixmapsink->aligned_height);
+               if (!evaspixmapbuf->xvimage || error_caught) {
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       /* Reset error handler */
+                       error_caught = FALSE;
+                       XSetErrorHandler (handler);
+                       /* Push an error */
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,
+                               ("Failed to create outputimage buffer of %dx%d pixels",
+                               evaspixmapbuf->width, evaspixmapbuf->height),
+                               ("could not XvCreateImage a %dx%d image",
+                               evaspixmapbuf->width, evaspixmapbuf->height));
+                       goto beach_unlocked;
+               }
+
+               /* we have to use the returned data_size for our image size */
+               evaspixmapbuf->size = evaspixmapbuf->xvimage->data_size;
+               evaspixmapbuf->xvimage->data = g_malloc (evaspixmapbuf->size);
+
+               XSync (evaspixmapsink->xcontext->disp, FALSE);
+       }
+
+       /* Reset error handler */
+       error_caught = FALSE;
+       XSetErrorHandler (handler);
+
+       succeeded = TRUE;
+
+       GST_BUFFER_DATA (evaspixmapbuf) = (guchar *) evaspixmapbuf->xvimage->data;
+       GST_BUFFER_SIZE (evaspixmapbuf) = evaspixmapbuf->size;
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+beach_unlocked:
+       if (!succeeded) {
+               gst_evaspixmap_buffer_free (evaspixmapbuf);
+               evaspixmapbuf = NULL;
+       }
+
+       return evaspixmapbuf;
+}
+
+/* This function puts a GstEvasPixmapBuffer on a GstEvasPixmapSink's pixmap. Returns FALSE
+ * if no pixmap was available  */
+static gboolean
+gst_evaspixmap_buffer_put (GstEvasPixmapSink *evaspixmapsink, GstEvasPixmapBuffer *evaspixmapbuf)
+{
+       GstVideoRectangle result;
+
+       GstVideoRectangle src_origin = { 0, 0, 0, 0};
+       GstVideoRectangle src_input  = { 0, 0, 0, 0};
+       GstVideoRectangle src = { 0, 0, 0, 0};
+       GstVideoRectangle dst = { 0, 0, 0, 0};
+       int rotate = 0;
+       int ret = 0;
+       int idx = 0;
+       GstXPixmap *xpixmap = NULL;
+
+       MMTA_ACUM_ITEM_BEGIN("evaspixmapsink evaspixmap_buffer_put()", FALSE);
+
+       /* We take the flow_lock. If expose is in there we don't want to run
+       concurrently from the data flow thread */
+       g_mutex_lock (evaspixmapsink->flow_lock);
+
+       if (G_UNLIKELY (evaspixmapsink->xpixmap[idx] == NULL)) {
+               GST_WARNING_OBJECT (evaspixmapsink, "xpixmap is NULL. Skip buffer_put." );
+               g_mutex_unlock(evaspixmapsink->flow_lock);
+               return FALSE;
+       }
+       if (evaspixmapsink->visible == FALSE) {
+               GST_WARNING_OBJECT (evaspixmapsink, "visible is FALSE. Skip buffer_put." );
+               g_mutex_unlock(evaspixmapsink->flow_lock);
+               return TRUE;
+       }
+       if (!evaspixmapbuf) {
+               GST_WARNING_OBJECT (evaspixmapsink, "evaspixmapbuf is NULL. Skip buffer_put." );
+               g_mutex_unlock(evaspixmapsink->flow_lock);
+               return TRUE;
+       }
+
+       g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+       if (evaspixmapsink->last_updated_idx == -1) {
+               /* if it has never been updated any frame in Ecore thread, do below */
+               idx = 0;
+               xpixmap = evaspixmapsink->xpixmap[idx];
+               xpixmap->ref = 1;
+               GST_LOG_OBJECT (evaspixmapsink, "last_updated_idx(%d), we use index[%d] of pixmap buffers : pixmap(%d), ref(%d)",
+                               evaspixmapsink->last_updated_idx, idx, xpixmap->pixmap, xpixmap->ref);
+       } else {
+               for (idx = 0; idx < evaspixmapsink->num_of_pixmaps; idx++) {
+                       if (idx == evaspixmapsink->last_updated_idx) {
+                               continue;
+                       } else {
+                               xpixmap = evaspixmapsink->xpixmap[idx];
+                               if (xpixmap->ref == 0 && xpixmap->damaged_time == 0) {
+                                       xpixmap->ref++;
+                                       GST_LOG_OBJECT (evaspixmapsink, "found an available pixmap(%d) : xpixmap[%d]", xpixmap->pixmap, idx);
+                                       GST_INFO_OBJECT (evaspixmapsink,"pixmap ref-count INCREASED : pixmap(%d), refcount(%d)", xpixmap->pixmap, xpixmap->ref);
+                                       break;
+                               }
+                       }
+               }
+               if (idx == evaspixmapsink->num_of_pixmaps) {
+                       GST_LOG_OBJECT (evaspixmapsink, "Could not find a pixmap with idle state, skip buffer_put." );
+                       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+                       g_mutex_unlock(evaspixmapsink->flow_lock);
+                       return TRUE;
+               }
+       }
+       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+
+       gst_evaspixmapsink_xpixmap_update_geometry(evaspixmapsink, idx);
+
+       src.x = src.y = 0;
+       src_origin.x = src_origin.y = src_input.x = src_input.y = 0;
+       src_input.w = src_origin.w = evaspixmapsink->video_width;
+       src_input.h = src_origin.h = evaspixmapsink->video_height;
+       if (evaspixmapsink->use_origin_size ||
+               (evaspixmapsink->rotate_angle == DEGREE_0 ||
+               evaspixmapsink->rotate_angle == DEGREE_180)) {
+               src.w = src_origin.w;
+               src.h = src_origin.h;
+       } else {
+               src.w = src_origin.h;
+               src.h = src_origin.w;
+       }
+
+       dst.w = evaspixmapsink->render_rect.w; /* pixmap width */
+       dst.h = evaspixmapsink->render_rect.h; /* pixmap height */
+
+       if (!evaspixmapsink->use_origin_size) {
+               static Atom atom_rotation = None;
+               static Atom atom_hflip = None;
+               static Atom atom_vflip = None;
+               gboolean set_hflip = FALSE;
+               gboolean set_vflip = FALSE;
+
+               /* compensation of size information (between evas image object's and pixmap's) */
+               if (evaspixmapsink->sizediff_width > 1) {
+                       if (evaspixmapsink->sizediff_height > 1) {
+                               dst.w -= (evaspixmapsink->sizediff_width >> 1) << 1;
+                               dst.h -= (evaspixmapsink->sizediff_height >> 1) << 1;
+                       } else {
+                               dst.w -= (evaspixmapsink->sizediff_width >> 1) << 1;
+                       }
+               } else if (evaspixmapsink->sizediff_height > 1) {
+                       dst.h -= (evaspixmapsink->sizediff_height >> 1) << 1;
+               }
+
+               switch (evaspixmapsink->display_geometry_method) {
+               case DISP_GEO_METHOD_LETTER_BOX:
+                       gst_video_sink_center_rect (src, dst, &result, TRUE);
+                       result.x += evaspixmapsink->render_rect.x;
+                       result.y += evaspixmapsink->render_rect.y;
+                       GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : letter box");
+                       break;
+               case DISP_GEO_METHOD_ORIGIN_SIZE:
+                       gst_video_sink_center_rect (src, dst, &result, FALSE);
+                       gst_video_sink_center_rect (dst, src, &src_input, FALSE);
+                       GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : origin size");
+                       if (evaspixmapsink->rotate_angle == DEGREE_90 ||
+                               evaspixmapsink->rotate_angle == DEGREE_270) {
+                               src_input.x = src_input.x ^ src_input.y;
+                               src_input.y = src_input.x ^ src_input.y;
+                               src_input.x = src_input.x ^ src_input.y;
+                               src_input.w = src_input.w ^ src_input.h;
+                               src_input.h = src_input.w ^ src_input.h;
+                               src_input.w = src_input.w ^ src_input.h;
+                       }
+                       break;
+               case DISP_GEO_METHOD_FULL_SCREEN:
+                       result.x = result.y = 0;
+                       result.w = evaspixmapsink->xpixmap[idx]->width;
+                       result.h = evaspixmapsink->xpixmap[idx]->height;
+                       GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : full screen");
+                       break;
+               case DISP_GEO_METHOD_CROPPED_FULL_SCREEN:
+                       GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : cropped full screen");
+                       gst_video_sink_center_rect(dst, src, &src_input, TRUE);
+                       result.x = result.y = 0;
+                       result.w = dst.w;
+                       result.h = dst.h;
+                       if (evaspixmapsink->rotate_angle == DEGREE_90 ||
+                               evaspixmapsink->rotate_angle == DEGREE_270) {
+                               src_input.x = src_input.x ^ src_input.y;
+                               src_input.y = src_input.x ^ src_input.y;
+                               src_input.x = src_input.x ^ src_input.y;
+                               src_input.w = src_input.w ^ src_input.h;
+                               src_input.h = src_input.w ^ src_input.h;
+                               src_input.w = src_input.w ^ src_input.h;
+                       }
+                       break;
+               case DISP_GEO_METHOD_CUSTOM_ROI:
+                       switch (evaspixmapsink->rotate_angle) {
+                       case DEGREE_90:
+                               result.w = evaspixmapsink->dst_roi.h;
+                               result.h = evaspixmapsink->dst_roi.w;
+                               result.x = evaspixmapsink->dst_roi.y;
+                               result.y = evaspixmapsink->xpixmap[idx]->height - evaspixmapsink->dst_roi.x - evaspixmapsink->dst_roi.w;
+                               break;
+                       case DEGREE_180:
+                               result.w = evaspixmapsink->dst_roi.w;
+                               result.h = evaspixmapsink->dst_roi.h;
+                               result.x = evaspixmapsink->xpixmap[idx]->width - result.w - evaspixmapsink->dst_roi.x;
+                               result.y = evaspixmapsink->xpixmap[idx]->height - result.h - evaspixmapsink->dst_roi.y;
+                               break;
+                       case DEGREE_270:
+                               result.w = evaspixmapsink->dst_roi.h;
+                               result.h = evaspixmapsink->dst_roi.w;
+                               result.x = evaspixmapsink->xpixmap[idx]->width - evaspixmapsink->dst_roi.y - evaspixmapsink->dst_roi.h;
+                               result.y = evaspixmapsink->dst_roi.x;
+                               break;
+                       default:
+                               result.x = evaspixmapsink->dst_roi.x;
+                               result.y = evaspixmapsink->dst_roi.y;
+                               result.w = evaspixmapsink->dst_roi.w;
+                               result.h = evaspixmapsink->dst_roi.h;
+                               break;
+                       }
+                       GST_LOG_OBJECT(evaspixmapsink, "rotate[%d], ROI input[%d,%d,%dx%d] > result[%d,%d,%dx%d]",
+                                       evaspixmapsink->rotate_angle,
+                                       evaspixmapsink->dst_roi.x, evaspixmapsink->dst_roi.y, evaspixmapsink->dst_roi.w, evaspixmapsink->dst_roi.h,
+                                       result.x, result.y, result.w, result.h);
+                       break;
+               default:
+                       break;
+               }
+               GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : src(%dx%d), dst(%dx%d), result(%dx%d), result_x(%d), result_y(%d)",
+                               src.w,src.h,dst.w,dst.h,result.w,result.h,result.x,result.y);
+
+               switch( evaspixmapsink->rotate_angle ) {
+                       case DEGREE_0:
+                       break;
+                       case DEGREE_90:
+                       rotate = 270;
+                       break;
+                       case DEGREE_180:
+                       rotate = 180;
+                       break;
+                       case DEGREE_270:
+                       rotate = 90;
+                       break;
+                       default:
+                       GST_WARNING_OBJECT( evaspixmapsink, "Unsupported rotation [%d]... set DEGREE 0.",
+                                       evaspixmapsink->rotate_angle );
+                       break;
+               }
+
+               /* set display rotation */
+               if (atom_rotation == None) {
+                       atom_rotation = XInternAtom(evaspixmapsink->xcontext->disp, "_USER_WM_PORT_ATTRIBUTE_ROTATION", False);
+               }
+
+               ret = XvSetPortAttribute(evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_rotation, rotate);
+               if (ret != Success) {
+                       GST_ERROR_OBJECT( evaspixmapsink, "XvSetPortAttribute failed[%d]. disp[%x],xv_port_id[%d],atom[%x],rotate[%d]",
+                                       ret, evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_rotation, rotate );
+                       return FALSE;
+               }
+
+               /* set display flip */
+               if (atom_hflip == None) {
+                       atom_hflip = XInternAtom(evaspixmapsink->xcontext->disp, "_USER_WM_PORT_ATTRIBUTE_HFLIP", False);
+               }
+               if (atom_vflip == None) {
+                       atom_vflip = XInternAtom(evaspixmapsink->xcontext->disp, "_USER_WM_PORT_ATTRIBUTE_VFLIP", False);
+               }
+
+               switch (evaspixmapsink->flip) {
+               case FLIP_HORIZONTAL:
+                       set_hflip = TRUE;
+                       set_vflip = FALSE;
+                       break;
+               case FLIP_VERTICAL:
+                       set_hflip = FALSE;
+                       set_vflip = TRUE;
+                       break;
+               case FLIP_BOTH:
+                       set_hflip = TRUE;
+                       set_vflip = TRUE;
+                       break;
+               case FLIP_NONE:
+               default:
+                       set_hflip = FALSE;
+                       set_vflip = FALSE;
+                       break;
+               }
+               GST_INFO_OBJECT(evaspixmapsink, "set rotate %d HFLIP %d, VFLIP %d", rotate, set_hflip, set_vflip);
+
+               ret = XvSetPortAttribute(evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_hflip, set_hflip);
+               if (ret != Success) {
+                       GST_WARNING("set HFLIP failed[%d]. disp[%x],xv_port_id[%d],atom[%x],hflip[%d]",
+                                       ret, evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_hflip, set_hflip);
+               }
+               ret = XvSetPortAttribute(evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_vflip, set_vflip);
+               if (ret != Success) {
+                       GST_WARNING("set VFLIP failed[%d]. disp[%x],xv_port_id[%d],atom[%x],vflip[%d]",
+                                       ret, evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_vflip, set_vflip);
+               }
+
+       } else {
+               result.x = result.y = 0;
+               result.w = evaspixmapsink->xpixmap[idx]->width;
+               result.h = evaspixmapsink->xpixmap[idx]->height;
+               GST_INFO_OBJECT (evaspixmapsink, "USE ORIGIN SIZE, no geometry method, no rotation/flip" );
+       }
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+  /* We scale to the pixmap's geometry */
+#ifdef HAVE_XSHM
+       if (evaspixmapsink->xcontext->use_xshm) {
+               GST_LOG_OBJECT (evaspixmapsink,"XvShmPutImage with image %dx%d and pixmap %dx%d, from xvimage %"
+                               GST_PTR_FORMAT,
+                               evaspixmapbuf->width, evaspixmapbuf->height,
+                               evaspixmapsink->render_rect.w, evaspixmapsink->render_rect.h, evaspixmapbuf);
+
+       /* Trim as proper size */
+       if (src_input.w % 2 == 1) {
+               src_input.w += 1;
+       }
+       if (src_input.h % 2 == 1) {
+               src_input.h += 1;
+       }
+
+       GST_LOG_OBJECT (evaspixmapsink, "screen[%dx%d],pixmap[%d,%d,%dx%d],method[%d],rotate[%d],src[%dx%d],dst[%d,%d,%dx%d],input[%d,%d,%dx%d],result[%d,%d,%dx%d]",
+               evaspixmapsink->scr_w, evaspixmapsink->scr_h,
+               evaspixmapsink->xpixmap[idx]->x, evaspixmapsink->xpixmap[idx]->y, evaspixmapsink->xpixmap[idx]->width, evaspixmapsink->xpixmap[idx]->height,
+               evaspixmapsink->display_geometry_method, rotate,
+               src_origin.w, src_origin.h,
+               dst.x, dst.y, dst.w, dst.h,
+               src_input.x, src_input.y, src_input.w, src_input.h,
+               result.x, result.y, result.w, result.h );
+
+       if (evaspixmapsink->visible) {
+               if (evaspixmapsink->buf_shared_type == BUF_SHARE_METHOD_FD) {
+                       EVASPIXMAPSINK_SET_PIXMAP_ID_TO_GEM_INFO (evaspixmapsink, evaspixmapsink->xpixmap[idx]->pixmap);
+               }
+               ret = XvShmPutImage (evaspixmapsink->xcontext->disp,
+                       evaspixmapsink->xcontext->xv_port_id,
+                       evaspixmapsink->xpixmap[idx]->pixmap,
+                       evaspixmapsink->xpixmap[idx]->gc, evaspixmapbuf->xvimage,
+                       src_input.x, src_input.y, src_input.w, src_input.h,
+                       result.x, result.y, result.w, result.h, FALSE);
+               GST_LOG_OBJECT (evaspixmapsink, "XvShmPutImage return value [%d]", ret );
+       } else {
+               GST_WARNING_OBJECT (evaspixmapsink, "visible is FALSE. skip this image..." );
+       }
+  } else
+#endif /* HAVE_XSHM */
+       {
+               if (evaspixmapsink->visible) {
+                       XvPutImage (evaspixmapsink->xcontext->disp,
+                                       evaspixmapsink->xcontext->xv_port_id,
+                                       evaspixmapsink->xpixmap[idx]->pixmap,
+                                       evaspixmapsink->xpixmap[idx]->gc, evaspixmapbuf->xvimage,
+                                       evaspixmapsink->disp_x, evaspixmapsink->disp_y,
+                                       evaspixmapsink->disp_width, evaspixmapsink->disp_height,
+                                       result.x, result.y, result.w, result.h);
+               } else {
+                       GST_WARNING_OBJECT (evaspixmapsink, "visible is FALSE. skip this image..." );
+               }
+       }
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+       g_mutex_unlock (evaspixmapsink->flow_lock);
+
+       MMTA_ACUM_ITEM_END("evaspixmapsink evaspixmap_buffer_put()", FALSE);
+
+       return TRUE;
+}
+
+static int
+drm_init(GstEvasPixmapSink *evaspixmapsink)
+{
+       Display *dpy;
+       int i = 0;
+       int eventBase = 0;
+       int errorBase = 0;
+       int dri2Major = 0;
+       int dri2Minor = 0;
+       char *driverName = NULL;
+       char *deviceName = NULL;
+       struct drm_auth auth_arg = {0};
+
+       evaspixmapsink->drm_fd = -1;
+
+       dpy = XOpenDisplay(0);
+
+       /* DRI2 */
+       if (!DRI2QueryExtension(dpy, &eventBase, &errorBase)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"failed to DRI2QueryExtension()");
+               goto ERROR_CASE;
+       }
+
+       if (!DRI2QueryVersion(dpy, &dri2Major, &dri2Minor)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"failed to DRI2QueryVersion");
+               goto ERROR_CASE;
+       }
+
+       if (!DRI2Connect(dpy, RootWindow(dpy, DefaultScreen(dpy)), &driverName, &deviceName)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"failed to DRI2Connect");
+               goto ERROR_CASE;
+       }
+
+       if (!driverName || !deviceName) {
+               GST_ERROR_OBJECT (evaspixmapsink,"driverName or deviceName is not valid");
+               goto ERROR_CASE;
+       }
+
+       GST_INFO_OBJECT (evaspixmapsink,"Open drm device : %s", deviceName);
+
+       /* get the drm_fd though opening the deviceName */
+       evaspixmapsink->drm_fd = open(deviceName, O_RDWR);
+       if (evaspixmapsink->drm_fd < 0) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot open drm device (%s)", deviceName);
+               goto ERROR_CASE;
+       }
+
+       /* get magic from drm to authentication */
+       if (ioctl(evaspixmapsink->drm_fd, DRM_IOCTL_GET_MAGIC, &auth_arg)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot get drm auth magic");
+               close(evaspixmapsink->drm_fd);
+               evaspixmapsink->drm_fd = -1;
+               goto ERROR_CASE;
+       }
+
+       if (!DRI2Authenticate(dpy, RootWindow(dpy, DefaultScreen(dpy)), auth_arg.magic)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot get drm authentication from X");
+               close(evaspixmapsink->drm_fd);
+               evaspixmapsink->drm_fd = -1;
+               goto ERROR_CASE;
+       }
+
+       /* init gem handle */
+       for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) {
+               evaspixmapsink->gem_info[i].dmabuf_fd = 0;
+               evaspixmapsink->gem_info[i].gem_handle = 0;
+               evaspixmapsink->gem_info[i].gem_name = 0;
+               evaspixmapsink->gem_info[i].bo = 0;
+               evaspixmapsink->gem_info[i].ref_pixmap = 0;
+       }
+
+       XCloseDisplay(dpy);
+       free(driverName);
+       free(deviceName);
+
+       return 0;
+
+ERROR_CASE:
+       XCloseDisplay(dpy);
+       if (driverName) {
+               free(driverName);
+       }
+       if (deviceName) {
+               free(deviceName);
+       }
+
+       return -1;
+}
+
+static void
+drm_fini(GstEvasPixmapSink *evaspixmapsink)
+{
+       if (evaspixmapsink->drm_fd >= 0) {
+               GST_INFO_OBJECT (evaspixmapsink,"close drm_fd(%d)", evaspixmapsink->drm_fd);
+               close(evaspixmapsink->drm_fd);
+               evaspixmapsink->drm_fd = -1;
+       }
+}
+
+static unsigned int
+drm_init_convert_dmabuf_gemname(GstEvasPixmapSink *evaspixmapsink, int dmabuf_fd)
+{
+       struct drm_prime_handle prime_arg = {0,};
+       struct drm_gem_flink flink_arg = {0,};
+       int i = 0;
+
+       if (evaspixmapsink->drm_fd < 0) {
+               GST_ERROR_OBJECT (evaspixmapsink,"DRM is not opened");
+               return 0;
+       }
+
+       if (dmabuf_fd <= 0) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Ignore wrong dmabuf fd(%d)", dmabuf_fd);              /* temporarily change log level to DEBUG for reducing WARNING level log */
+               return 0;
+       }
+
+       /* check duplicated dmabuf fd */
+       for (i = 0 ; i < MAX_GEM_BUFFER_NUM ; i++) {
+               if (evaspixmapsink->gem_info[i].dmabuf_fd == dmabuf_fd) {
+                       GST_LOG_OBJECT (evaspixmapsink,"already got fd(%u) with name(%u)", dmabuf_fd, evaspixmapsink->gem_info[i].gem_name);
+                       return evaspixmapsink->gem_info[i].gem_name;
+               }
+
+               if (evaspixmapsink->gem_info[i].dmabuf_fd == 0) {
+                       GST_LOG_OBJECT (evaspixmapsink,"empty gem_info[%d] found", i);
+                       break;
+               }
+       }
+
+       if (i == MAX_GEM_BUFFER_NUM) {
+               GST_WARNING_OBJECT (evaspixmapsink,"too many buffers[dmabuf_fd(%d). skip it]", dmabuf_fd);
+               return 0;
+       }
+
+       evaspixmapsink->gem_info[i].dmabuf_fd = dmabuf_fd;
+       prime_arg.fd = dmabuf_fd;
+       if (ioctl(evaspixmapsink->drm_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &prime_arg)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"non dmabuf fd(%d)", dmabuf_fd);
+               return 0;
+       }
+
+       evaspixmapsink->gem_info[i].gem_handle = prime_arg.handle;
+       GST_LOG_OBJECT (evaspixmapsink,"gem_info[%d].gem_handle = %u", i, prime_arg.handle);
+
+       flink_arg.handle = prime_arg.handle;
+       if (ioctl(evaspixmapsink->drm_fd, DRM_IOCTL_GEM_FLINK, &flink_arg)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot convert drm handle to name");
+               return 0;
+       }
+
+       evaspixmapsink->gem_info[i].gem_name = flink_arg.name;
+       GST_LOG_OBJECT (evaspixmapsink,"gem_info[%d].gem_name = %u", i, flink_arg.name);
+
+       return flink_arg.name;
+}
+
+static unsigned int
+tbm_init_convert_bo_gemname(GstEvasPixmapSink *evaspixmapsink, tbm_bo bo)
+{
+       int i = 0;
+
+       if (bo == NULL) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Ignore wrong bo(%u)", bo);            /* temporarily change log level to DEBUG for reducing WARNING level log */
+               return 0;
+       }
+
+       /* check duplicated dmabuf bo */
+       for (i = 0 ; i < MAX_GEM_BUFFER_NUM ; i++) {
+               if (evaspixmapsink->gem_info[i].bo == bo) {
+                       GST_LOG_OBJECT (evaspixmapsink,"already got bo(%u) with name(%u)", bo, evaspixmapsink->gem_info[i].gem_name);
+                       return evaspixmapsink->gem_info[i].gem_name;
+               }
+
+               if (evaspixmapsink->gem_info[i].bo == 0) {
+                       GST_LOG_OBJECT (evaspixmapsink,"empty gem_info[%d] found", i);
+                       break;
+               }
+       }
+
+       if (i == MAX_GEM_BUFFER_NUM) {
+               GST_WARNING_OBJECT (evaspixmapsink,"too many buffers[dmabuf_bo(%d). skip it]", bo);
+               return 0;
+       }
+
+       evaspixmapsink->gem_info[i].bo = bo;
+       evaspixmapsink->gem_info[i].gem_name = tbm_bo_export(bo);
+       GST_LOG_OBJECT (evaspixmapsink,"gem_info[%d].gem_name = %u", i, evaspixmapsink->gem_info[i].gem_name);
+
+       return evaspixmapsink->gem_info[i].gem_name;
+}
+
+static void
+drm_fini_close_gem_handle(GstEvasPixmapSink *evaspixmapsink, Pixmap pixmap_id)
+{
+       int i = 0;
+       if (evaspixmapsink->drm_fd >= 0) {
+               if (pixmap_id == 0) {
+                       for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) {
+                               if (evaspixmapsink->gem_info[i].dmabuf_fd > 0 || evaspixmapsink->gem_info[i].bo > 0) {
+                                       if (evaspixmapsink->buf_shared_type == BUF_SHARE_METHOD_FD) {
+                                               GST_INFO_OBJECT (evaspixmapsink,"close gem_handle(%u)", evaspixmapsink->gem_info[i].gem_handle);
+                                               drm_close_gem(evaspixmapsink, evaspixmapsink->gem_info[i].gem_handle);
+                                       }
+                                       evaspixmapsink->gem_info[i].dmabuf_fd = 0;
+                                       evaspixmapsink->gem_info[i].gem_handle = 0;
+                                       evaspixmapsink->gem_info[i].gem_name = 0;
+                                       evaspixmapsink->gem_info[i].bo = 0;
+                                       evaspixmapsink->gem_info[i].ref_pixmap = 0;
+                                       GST_LOG_OBJECT (evaspixmapsink,"gem_info[%d] is cleared",i);
+                               }
+                       }
+               } else {
+                       for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) {
+                               if (evaspixmapsink->gem_info[i].ref_pixmap == pixmap_id) {
+                                       if (evaspixmapsink->buf_shared_type == BUF_SHARE_METHOD_FD) {
+                                               GST_INFO_OBJECT (evaspixmapsink,"close gem_handle(%u) for pixmap_id(%d)",
+                                                                               evaspixmapsink->gem_info[i].gem_handle, pixmap_id);
+                                               drm_close_gem(evaspixmapsink, evaspixmapsink->gem_info[i].gem_handle);
+                                       }
+                                       evaspixmapsink->gem_info[i].dmabuf_fd = 0;
+                                       evaspixmapsink->gem_info[i].gem_handle = 0;
+                                       evaspixmapsink->gem_info[i].gem_name = 0;
+                                       evaspixmapsink->gem_info[i].bo = 0;
+                                       evaspixmapsink->gem_info[i].ref_pixmap = 0;
+                                       GST_LOG_OBJECT (evaspixmapsink,"gem_info[%d] is cleared",i);
+                                       break;
+                               }
+                       }
+               }
+       }
+}
+
+static void
+drm_close_gem(GstEvasPixmapSink *evaspixmapsink, unsigned int gem_handle)
+{
+       struct drm_gem_close close_arg = {0,};
+
+       if (evaspixmapsink->drm_fd < 0) {
+               GST_ERROR_OBJECT (evaspixmapsink,"DRM is not opened");
+               return;
+       }
+
+       if (gem_handle == 0) {
+               GST_ERROR_OBJECT (evaspixmapsink,"invalid gem_handle(%d)",gem_handle);
+               return;
+       }
+
+       close_arg.handle = gem_handle;
+       if (gem_handle > 0 && ioctl(evaspixmapsink->drm_fd, DRM_IOCTL_GEM_CLOSE, &close_arg)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot close drm gem handle(%d)", gem_handle);
+               return;
+       }
+
+       return;
+}
+
+/* This function destroys a GstXPixmap */
+static void
+gst_evaspixmapsink_xpixmap_destroy (GstEvasPixmapSink *evaspixmapsink, GstXPixmap *xpixmap)
+{
+       g_return_if_fail (xpixmap != NULL);
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+       if(xpixmap->pixmap) {
+               GST_LOG_OBJECT (evaspixmapsink,"Free pixmap(%d)", xpixmap->pixmap);
+               XFreePixmap(evaspixmapsink->xcontext->disp, xpixmap->pixmap);
+               xpixmap->pixmap = 0;
+       }
+
+       if (xpixmap->gc) {
+               XFreeGC (evaspixmapsink->xcontext->disp, xpixmap->gc);
+       }
+
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+       g_free (xpixmap);
+}
+
+static void
+gst_evaspixmapsink_xpixmap_update_geometry (GstEvasPixmapSink *evaspixmapsink, int idx)
+{
+       Window root_window;
+       XWindowAttributes root_attr;
+
+       int cur_pixmap_x = 0;
+       int cur_pixmap_y = 0;
+       unsigned int cur_pixmap_width = 0;
+       unsigned int cur_pixmap_height = 0;
+       unsigned int cur_pixmap_border_width = 0;
+       unsigned int cur_pixmap_depth = 0;
+
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+       /* Update the window geometry */
+       g_mutex_lock (evaspixmapsink->x_lock);
+       if (G_UNLIKELY (evaspixmapsink->xpixmap[idx] == NULL)) {
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               return;
+       }
+
+       /* Get root window and size of current pixmap */
+       XGetGeometry( evaspixmapsink->xcontext->disp, evaspixmapsink->xpixmap[idx]->pixmap, &root_window,
+                       &cur_pixmap_x, &cur_pixmap_y, /* relative x, y, for pixmap these are alway 0 */
+                       &cur_pixmap_width, &cur_pixmap_height,
+                       &cur_pixmap_border_width, &cur_pixmap_depth ); /* cur_pixmap_border_width, cur_pixmap_depth are not used */
+
+       evaspixmapsink->xpixmap[idx]->width = cur_pixmap_width;
+       evaspixmapsink->xpixmap[idx]->height = cur_pixmap_height;
+
+       evaspixmapsink->xpixmap[idx]->x = cur_pixmap_x;
+       evaspixmapsink->xpixmap[idx]->y = cur_pixmap_y;
+
+       /* Get size of root window == size of screen */
+       XGetWindowAttributes(evaspixmapsink->xcontext->disp, root_window, &root_attr);
+
+       evaspixmapsink->scr_w = root_attr.width;
+       evaspixmapsink->scr_h = root_attr.height;
+
+       if (!evaspixmapsink->have_render_rect) {
+               evaspixmapsink->render_rect.x = evaspixmapsink->render_rect.y = 0;
+               evaspixmapsink->render_rect.w = cur_pixmap_width;
+               evaspixmapsink->render_rect.h = cur_pixmap_height;
+       }
+
+       GST_LOG_OBJECT (evaspixmapsink,"screen size %dx%d, current pixmap geometry %d,%d,%dx%d, render_rect %d,%d,%dx%d",
+                       evaspixmapsink->scr_w, evaspixmapsink->scr_h,
+                       evaspixmapsink->xpixmap[idx]->x, evaspixmapsink->xpixmap[idx]->y,
+                       evaspixmapsink->xpixmap[idx]->width, evaspixmapsink->xpixmap[idx]->height,
+                       evaspixmapsink->render_rect.x, evaspixmapsink->render_rect.y,
+                       evaspixmapsink->render_rect.w, evaspixmapsink->render_rect.h);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+}
+
+static void
+gst_evaspixmapsink_xpixmap_clear (GstEvasPixmapSink *evaspixmapsink, GstXPixmap *xpixmap)
+{
+       g_return_if_fail (xpixmap != NULL);
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+       if (!xpixmap->pixmap) {
+               GST_WARNING_OBJECT (evaspixmapsink,"pixmap was not created..");
+               return;
+       }
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+       if (!evaspixmapsink->xcontext) {
+               GST_WARNING_OBJECT (evaspixmapsink,"xcontext is null..");
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               return;
+       }
+
+       if (evaspixmapsink->stop_video) {
+               XvStopVideo (evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, xpixmap->pixmap);
+       }
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+       g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+       evaspixmapsink->last_updated_idx = -1;
+       xpixmap->ref = 0;
+       xpixmap->damaged_time = 0;
+       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+}
+
+/* This function commits our internal colorbalance settings to our grabbed Xv
+   port. If the xcontext is not initialized yet it simply returns */
+static void
+gst_evaspixmapsink_update_colorbalance (GstEvasPixmapSink *evaspixmapsink)
+{
+  GList *channels = NULL;
+
+  g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+  /* If we haven't initialized the X context we can't update anything */
+  if (evaspixmapsink->xcontext == NULL)
+    return;
+
+  /* Don't set the attributes if they haven't been changed, to avoid
+   * rounding errors changing the values */
+  if (!evaspixmapsink->cb_changed)
+    return;
+
+  /* For each channel of the colorbalance we calculate the correct value
+     doing range conversion and then set the Xv port attribute to match our
+     values. */
+  channels = evaspixmapsink->xcontext->channels_list;
+
+  while (channels) {
+    if (channels->data && GST_IS_COLOR_BALANCE_CHANNEL (channels->data)) {
+      GstColorBalanceChannel *channel = NULL;
+      Atom prop_atom;
+      gint value = 0;
+      gdouble convert_coef;
+
+      channel = GST_COLOR_BALANCE_CHANNEL (channels->data);
+      g_object_ref (channel);
+
+      /* Our range conversion coef */
+      convert_coef = (channel->max_value - channel->min_value) / 2000.0;
+
+      if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) {
+        value = evaspixmapsink->hue;
+      } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) {
+        value = evaspixmapsink->saturation;
+      } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) {
+        value = evaspixmapsink->contrast;
+      } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) {
+        value = evaspixmapsink->brightness;
+      } else {
+        g_warning ("got an unknown channel %s", channel->label);
+        g_object_unref (channel);
+        return;
+      }
+
+      /* Committing to Xv port */
+      g_mutex_lock (evaspixmapsink->x_lock);
+      prop_atom =
+          XInternAtom (evaspixmapsink->xcontext->disp, channel->label, True);
+      if (prop_atom != None) {
+        int xv_value;
+        xv_value =
+            floor (0.5 + (value + 1000) * convert_coef + channel->min_value);
+        XvSetPortAttribute (evaspixmapsink->xcontext->disp,
+            evaspixmapsink->xcontext->xv_port_id, prop_atom, xv_value);
+      }
+      g_mutex_unlock (evaspixmapsink->x_lock);
+
+      g_object_unref (channel);
+    }
+    channels = g_list_next (channels);
+  }
+}
+
+static void
+gst_lookup_xv_port_from_adaptor (GstXContext *xcontext, XvAdaptorInfo *adaptors, int adaptor_no)
+{
+  gint j;
+  gint res;
+
+  /* Do we support XvImageMask ? */
+  if (!(adaptors[adaptor_no].type & XvImageMask)) {
+    GST_DEBUG ("XV Adaptor %s has no support for XvImageMask", adaptors[adaptor_no].name);
+    return;
+  }
+
+  /* We found such an adaptor, looking for an available port */
+  for (j = 0; j < adaptors[adaptor_no].num_ports && !xcontext->xv_port_id; j++) {
+    /* We try to grab the port */
+    res = XvGrabPort (xcontext->disp, adaptors[adaptor_no].base_id + j, 0);
+    if (Success == res) {
+      xcontext->xv_port_id = adaptors[adaptor_no].base_id + j;
+      GST_DEBUG ("XV Adaptor %s with %ld ports", adaptors[adaptor_no].name, adaptors[adaptor_no].num_ports);
+    } else {
+      GST_DEBUG ("GrabPort %d for XV Adaptor %s failed: %d", j, adaptors[adaptor_no].name, res);
+    }
+  }
+}
+
+/* This function generates a caps with all supported format by the first
+   Xv grabable port we find. We store each one of the supported formats in a
+   format list and append the format to a newly created caps that we return
+   If this function does not return NULL because of an error, it also grabs
+   the port via XvGrabPort */
+static GstCaps*
+gst_evaspixmapsink_get_xv_support (GstEvasPixmapSink *evaspixmapsink, GstXContext *xcontext)
+{
+  gint i;
+  XvAdaptorInfo *adaptors;
+  gint nb_formats;
+  XvImageFormatValues *formats = NULL;
+  guint nb_encodings;
+  XvEncodingInfo *encodings = NULL;
+  gulong max_w = G_MAXINT, max_h = G_MAXINT;
+  GstCaps *caps = NULL;
+  GstCaps *rgb_caps = NULL;
+
+  g_return_val_if_fail (xcontext != NULL, NULL);
+
+  /* First let's check that XVideo extension is available */
+  if (!XQueryExtension (xcontext->disp, "XVideo", &i, &i, &i)) {
+    GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, SETTINGS,
+        ("Could not initialise Xv output"),
+        ("XVideo extension is not available"));
+    return NULL;
+  }
+
+  /* Then we get adaptors list */
+  if (Success != XvQueryAdaptors (xcontext->disp, xcontext->root,
+          &xcontext->nb_adaptors, &adaptors)) {
+    GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, SETTINGS,
+        ("Could not initialise Xv output"),
+        ("Failed getting XV adaptors list"));
+    return NULL;
+  }
+
+  xcontext->xv_port_id = 0;
+
+  GST_DEBUG_OBJECT (evaspixmapsink,"Found %u XV adaptor(s)", xcontext->nb_adaptors);
+
+  xcontext->adaptors =
+      (gchar **) g_malloc0 (xcontext->nb_adaptors * sizeof (gchar *));
+
+  /* Now fill up our adaptor name array */
+  for (i = 0; i < xcontext->nb_adaptors; i++) {
+    xcontext->adaptors[i] = g_strdup (adaptors[i].name);
+  }
+
+  if (evaspixmapsink->adaptor_no < xcontext->nb_adaptors) {
+    /* Find xv port from user defined adaptor */
+    gst_lookup_xv_port_from_adaptor (xcontext, adaptors, evaspixmapsink->adaptor_no);
+  }
+
+  if (!xcontext->xv_port_id) {
+    /* Now search for an adaptor that supports XvImageMask */
+    for (i = 0; i < xcontext->nb_adaptors && !xcontext->xv_port_id; i++) {
+      gst_lookup_xv_port_from_adaptor (xcontext, adaptors, i);
+      evaspixmapsink->adaptor_no = i;
+    }
+  }
+
+  XvFreeAdaptorInfo (adaptors);
+
+  if (!xcontext->xv_port_id) {
+    evaspixmapsink->adaptor_no = -1;
+    GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, BUSY,
+        ("Could not initialise Xv output"), ("No port available"));
+    return NULL;
+  }
+
+  /* Set XV_AUTOPAINT_COLORKEY and XV_DOUBLE_BUFFER and XV_COLORKEY */
+  {
+    int count, todo = 3;
+    XvAttribute *const attr = XvQueryPortAttributes (xcontext->disp,
+        xcontext->xv_port_id, &count);
+    static const char autopaint[] = "XV_AUTOPAINT_COLORKEY";
+    static const char dbl_buffer[] = "XV_DOUBLE_BUFFER";
+    static const char colorkey[] = "XV_COLORKEY";
+
+    GST_DEBUG_OBJECT (evaspixmapsink,"Checking %d Xv port attributes", count);
+
+    evaspixmapsink->have_autopaint_colorkey = FALSE;
+    evaspixmapsink->have_double_buffer = FALSE;
+    evaspixmapsink->have_colorkey = FALSE;
+
+    for (i = 0; ((i < count) && todo); i++)
+      if (!strcmp (attr[i].name, autopaint)) {
+        const Atom atom = XInternAtom (xcontext->disp, autopaint, False);
+
+        /* turn on autopaint colorkey */
+        XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
+            (evaspixmapsink->autopaint_colorkey ? 1 : 0));
+        todo--;
+        evaspixmapsink->have_autopaint_colorkey = TRUE;
+      } else if (!strcmp (attr[i].name, dbl_buffer)) {
+        const Atom atom = XInternAtom (xcontext->disp, dbl_buffer, False);
+
+        XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
+            (evaspixmapsink->double_buffer ? 1 : 0));
+        todo--;
+        evaspixmapsink->have_double_buffer = TRUE;
+      } else if (!strcmp (attr[i].name, colorkey)) {
+        /* Set the colorkey, default is something that is dark but hopefully
+         * won't randomly appear on the screen elsewhere (ie not black or greys)
+         * can be overridden by setting "colorkey" property
+         */
+        const Atom atom = XInternAtom (xcontext->disp, colorkey, False);
+        guint32 ckey = 0;
+        gboolean set_attr = TRUE;
+        guint cr, cg, cb;
+
+        /* set a colorkey in the right format RGB565/RGB888
+         * We only handle these 2 cases, because they're the only types of
+         * devices we've encountered. If we don't recognise it, leave it alone
+         */
+        cr = (evaspixmapsink->colorkey >> 16);
+        cg = (evaspixmapsink->colorkey >> 8) & 0xFF;
+        cb = (evaspixmapsink->colorkey) & 0xFF;
+        switch (xcontext->depth) {
+          case 16:             /* RGB 565 */
+            cr >>= 3;
+            cg >>= 2;
+            cb >>= 3;
+            ckey = (cr << 11) | (cg << 5) | cb;
+            break;
+          case 24:
+          case 32:             /* RGB 888 / ARGB 8888 */
+            ckey = (cr << 16) | (cg << 8) | cb;
+            break;
+          default:
+            GST_DEBUG_OBJECT (evaspixmapsink,"Unknown bit depth %d for Xv Colorkey - not adjusting", xcontext->depth);
+            set_attr = FALSE;
+            break;
+        }
+
+        if (set_attr) {
+          ckey = CLAMP (ckey, (guint32) attr[i].min_value,
+              (guint32) attr[i].max_value);
+          GST_LOG_OBJECT (evaspixmapsink,"Setting color key for display depth %d to 0x%x", xcontext->depth, ckey);
+
+          XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
+              (gint) ckey);
+        }
+        todo--;
+        evaspixmapsink->have_colorkey = TRUE;
+      }
+
+    XFree (attr);
+  }
+
+  /* Get the list of encodings supported by the adapter and look for the
+   * XV_IMAGE encoding so we can determine the maximum width and height
+   * supported */
+  XvQueryEncodings (xcontext->disp, xcontext->xv_port_id, &nb_encodings,
+      &encodings);
+
+  for (i = 0; i < nb_encodings; i++) {
+    GST_LOG_OBJECT (evaspixmapsink,
+        "Encoding %d, name %s, max wxh %lux%lu rate %d/%d",
+        i, encodings[i].name, encodings[i].width, encodings[i].height,
+        encodings[i].rate.numerator, encodings[i].rate.denominator);
+    if (strcmp (encodings[i].name, "XV_IMAGE") == 0) {
+      max_w = encodings[i].width;
+      max_h = encodings[i].height;
+      evaspixmapsink->scr_w = max_w;
+      evaspixmapsink->scr_h = max_h;
+    }
+  }
+
+  XvFreeEncodingInfo (encodings);
+
+  /* We get all image formats supported by our port */
+  formats = XvListImageFormats (xcontext->disp,
+      xcontext->xv_port_id, &nb_formats);
+  caps = gst_caps_new_empty ();
+  for (i = 0; i < nb_formats; i++) {
+    GstCaps *format_caps = NULL;
+    gboolean is_rgb_format = FALSE;
+
+    /* We set the image format of the xcontext to an existing one. This
+       is just some valid image format for making our xshm calls check before
+       caps negotiation really happens. */
+    xcontext->im_format = formats[i].id;
+
+    switch (formats[i].type) {
+      case XvRGB:
+      {
+        XvImageFormatValues *fmt = &(formats[i]);
+        gint endianness = G_BIG_ENDIAN;
+
+        if (fmt->byte_order == LSBFirst) {
+          /* our caps system handles 24/32bpp RGB as big-endian. */
+          if (fmt->bits_per_pixel == 24 || fmt->bits_per_pixel == 32) {
+            fmt->red_mask = GUINT32_TO_BE (fmt->red_mask);
+            fmt->green_mask = GUINT32_TO_BE (fmt->green_mask);
+            fmt->blue_mask = GUINT32_TO_BE (fmt->blue_mask);
+
+            if (fmt->bits_per_pixel == 24) {
+              fmt->red_mask >>= 8;
+              fmt->green_mask >>= 8;
+              fmt->blue_mask >>= 8;
+            }
+          } else
+            endianness = G_LITTLE_ENDIAN;
+        }
+
+        format_caps = gst_caps_new_simple ("video/x-raw-rgb",
+            "format", GST_TYPE_FOURCC, formats[i].id,
+            "endianness", G_TYPE_INT, endianness,
+            "depth", G_TYPE_INT, fmt->depth,
+            "bpp", G_TYPE_INT, fmt->bits_per_pixel,
+            "red_mask", G_TYPE_INT, fmt->red_mask,
+            "green_mask", G_TYPE_INT, fmt->green_mask,
+            "blue_mask", G_TYPE_INT, fmt->blue_mask,
+            "width", GST_TYPE_INT_RANGE, 1, max_w,
+            "height", GST_TYPE_INT_RANGE, 1, max_h,
+            "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
+
+        is_rgb_format = TRUE;
+        break;
+      }
+      case XvYUV:
+        format_caps = gst_caps_new_simple ("video/x-raw-yuv",
+            "format", GST_TYPE_FOURCC, formats[i].id,
+            "width", GST_TYPE_INT_RANGE, 1, max_w,
+            "height", GST_TYPE_INT_RANGE, 1, max_h,
+            "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
+        break;
+      default:
+        g_assert_not_reached ();
+        break;
+    }
+
+    if (format_caps) {
+      GstEvasPixmapFormat *format = NULL;
+
+      format = g_new0 (GstEvasPixmapFormat, 1);
+      if (format) {
+        format->format = formats[i].id;
+        format->caps = gst_caps_copy (format_caps);
+        xcontext->formats_list = g_list_append (xcontext->formats_list, format);
+      }
+
+      if (is_rgb_format) {
+        if (rgb_caps == NULL)
+          rgb_caps = format_caps;
+        else
+          gst_caps_append (rgb_caps, format_caps);
+      } else
+        gst_caps_append (caps, format_caps);
+    }
+  }
+
+  /* Collected all caps into either the caps or rgb_caps structures.
+   * Append rgb_caps on the end of YUV, so that YUV is always preferred */
+  if (rgb_caps)
+    gst_caps_append (caps, rgb_caps);
+
+  if (formats)
+    XFree (formats);
+
+  GST_DEBUG_OBJECT (evaspixmapsink,"Generated the following caps: %" GST_PTR_FORMAT, caps);
+
+  if (gst_caps_is_empty (caps)) {
+    gst_caps_unref (caps);
+    XvUngrabPort (xcontext->disp, xcontext->xv_port_id, 0);
+    GST_ELEMENT_ERROR (evaspixmapsink, STREAM, WRONG_TYPE, (NULL),
+        ("No supported format found"));
+    return NULL;
+  }
+
+  return caps;
+}
+
+static gpointer
+gst_evaspixmapsink_event_thread (GstEvasPixmapSink * evaspixmapsink)
+{
+       g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), NULL);
+       int damage_base = 0;
+       int damage_err_base = 0;
+       int damage_case = 0;
+       XEvent e;
+       int i = 0;
+       Display *disp = NULL;
+
+       GST_OBJECT_LOCK (evaspixmapsink);
+
+       if (evaspixmapsink->xcontext && evaspixmapsink->xcontext->disp) {
+               disp = evaspixmapsink->xcontext->disp;
+       } else {
+               GST_ERROR_OBJECT (evaspixmapsink,"evaspixmapsink->xcontext(->disp) is not ready");
+               return NULL;
+       }
+
+       if (!XDamageQueryExtension(evaspixmapsink->xcontext->disp, &damage_base, &damage_err_base)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"XDamageQueryExtension() failed");
+               return NULL;
+       }
+       damage_case = (int)damage_base + XDamageNotify;
+
+       while (evaspixmapsink->running) {
+               GST_OBJECT_UNLOCK (evaspixmapsink);
+
+               g_mutex_lock (evaspixmapsink->x_lock);
+               while (XPending (disp)) {
+                       XNextEvent (disp, &e);
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       if (e.type == damage_case ) {
+                               XDamageNotifyEvent *damage_ev = (XDamageNotifyEvent *)&e;
+                               for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                                       GstXPixmap *xpixmap = evaspixmapsink->xpixmap[i];
+                                       if (xpixmap && damage_ev->drawable == xpixmap->pixmap) {
+                                               g_mutex_lock(evaspixmapsink->pixmap_ref_lock);
+                                               if (xpixmap->ref) {
+                                                       /* set it only if damage event comes from _buffer_put() */
+                                                       xpixmap->damaged_time = (gint)get_millis_time();
+                                               }
+                                               g_mutex_unlock(evaspixmapsink->pixmap_ref_lock);
+                                               GST_DEBUG_OBJECT (evaspixmapsink,"event_handler : got a damage event for pixmap(%d), refcount(%d), damaged_time(%d)",
+                                                                               xpixmap->pixmap, xpixmap->ref, xpixmap->damaged_time);
+                                               if (evaspixmapsink->epipe_request_count > EPIPE_REQUEST_LIMIT) {
+                                                       GST_WARNING_OBJECT (evaspixmapsink,"event_handler : epipe_request_count(%d), skip ecore_pipe_write()", evaspixmapsink->epipe_request_count);
+                                               } else {
+                                                       __ta__("evaspixmapsink ecore_pipe_write", ecore_pipe_write(evaspixmapsink->epipe, evaspixmapsink, sizeof(GstEvasPixmapSink)););
+                                                       evaspixmapsink->epipe_request_count++;
+                                                       GST_DEBUG_OBJECT (evaspixmapsink,"event_handler : after call ecore_pipe_write() for pixmap(%d)", xpixmap->pixmap);
+                                               }
+                                               g_mutex_lock (evaspixmapsink->x_lock);
+                                               XDamageSubtract (evaspixmapsink->xcontext->disp, evaspixmapsink->damage[i], None, None );
+                                               g_mutex_unlock (evaspixmapsink->x_lock);
+
+                                               if (evaspixmapsink->buf_shared_type == BUF_SHARE_METHOD_FD) {
+                                                       if (GST_STATE(evaspixmapsink) == GST_STATE_PLAYING) {
+                                                               drm_fini_close_gem_handle(evaspixmapsink, xpixmap->pixmap);
+                                                       }
+                                               }
+                                               break;
+                                       }
+                               }
+                               if (i == evaspixmapsink->num_of_pixmaps) {
+                                       GST_WARNING_OBJECT (evaspixmapsink,"event_handler : could not find corresponding pixmap with this damage event(%d)", damage_ev->drawable);
+                               }
+                       } else {
+                               GST_LOG_OBJECT (evaspixmapsink,"event_handler : unidentified event(%d)", e.type);
+                               g_mutex_lock (evaspixmapsink->x_lock);
+                               continue;
+                       }
+                       g_mutex_lock (evaspixmapsink->x_lock);
+               }
+               //XSync (disp, FALSE);
+               g_mutex_unlock (evaspixmapsink->x_lock);
+
+               g_usleep (G_USEC_PER_SEC / 40);
+               GST_OBJECT_LOCK (evaspixmapsink);
+       }
+       GST_OBJECT_UNLOCK (evaspixmapsink);
+       return NULL;
+}
+
+static void
+gst_evaspixmapsink_manage_event_thread (GstEvasPixmapSink *evaspixmapsink)
+{
+       /* don't start the thread too early */
+       if (evaspixmapsink->xcontext == NULL) {
+               GST_ERROR_OBJECT (evaspixmapsink,"xcontext is NULL..");
+               return;
+       }
+
+       GST_OBJECT_LOCK (evaspixmapsink);
+
+       if (!evaspixmapsink->event_thread) {
+               /* Setup our event listening thread */
+               GST_DEBUG_OBJECT (evaspixmapsink,"run xevent thread");
+               evaspixmapsink->running = TRUE;
+               evaspixmapsink->event_thread = g_thread_create ( (GThreadFunc) gst_evaspixmapsink_event_thread, evaspixmapsink, TRUE, NULL);
+       } else {
+               GST_WARNING_OBJECT (evaspixmapsink,"there already existed the event_thread.. keep going");
+               /* Do not finalize the thread in here, Only finalize the thread by calling gst_evaspixmapsink_reset() */
+       }
+
+       GST_OBJECT_UNLOCK (evaspixmapsink);
+}
+
+
+/* This function calculates the pixel aspect ratio based on the properties
+ * in the xcontext structure and stores it there. */
+static void
+gst_evaspixmapsink_calculate_pixel_aspect_ratio (GstXContext *xcontext)
+{
+  static const gint par[][2] = {
+    {1, 1},                     /* regular screen */
+    {16, 15},                   /* PAL TV */
+    {11, 10},                   /* 525 line Rec.601 video */
+    {54, 59},                   /* 625 line Rec.601 video */
+    {64, 45},                   /* 1280x1024 on 16:9 display */
+    {5, 3},                     /* 1280x1024 on 4:3 display */
+    {4, 3}                      /*  800x600 on 16:9 display */
+  };
+  gint i;
+  gint index;
+  gdouble ratio;
+  gdouble delta;
+
+#define DELTA(idx) (ABS (ratio - ((gdouble) par[idx][0] / par[idx][1])))
+
+  /* first calculate the "real" ratio based on the X values;
+   * which is the "physical" w/h divided by the w/h in pixels of the display */
+  ratio = (gdouble) (xcontext->widthmm * xcontext->height)
+      / (xcontext->heightmm * xcontext->width);
+
+  /* DirectFB's X in 720x576 reports the physical dimensions wrong, so
+   * override here */
+  if (xcontext->width == 720 && xcontext->height == 576) {
+    ratio = 4.0 * 576 / (3.0 * 720);
+  }
+  GST_DEBUG ("calculated pixel aspect ratio: %f", ratio);
+  /* now find the one from par[][2] with the lowest delta to the real one */
+  delta = DELTA (0);
+  index = 0;
+
+  for (i = 1; i < sizeof (par) / (sizeof (gint) * 2); ++i) {
+    gdouble this_delta = DELTA (i);
+
+    if (this_delta < delta) {
+      index = i;
+      delta = this_delta;
+    }
+  }
+
+  GST_DEBUG ("Decided on index %d (%d/%d)", index,
+      par[index][0], par[index][1]);
+
+  g_free (xcontext->par);
+  xcontext->par = g_new0 (GValue, 1);
+  g_value_init (xcontext->par, GST_TYPE_FRACTION);
+  gst_value_set_fraction (xcontext->par, par[index][0], par[index][1]);
+  GST_DEBUG ("set xcontext PAR to %d/%d",
+      gst_value_get_fraction_numerator (xcontext->par),
+      gst_value_get_fraction_denominator (xcontext->par));
+}
+
+/* This function gets the X Display and global info about it. Everything is
+   stored in our object and will be cleaned when the object is disposed. Note
+   here that caps for supported format are generated without any window or
+   image creation */
+static GstXContext*
+gst_evaspixmapsink_xcontext_get (GstEvasPixmapSink *evaspixmapsink)
+{
+       GstXContext *xcontext = NULL;
+       XPixmapFormatValues *px_formats = NULL;
+       gint nb_formats = 0, i, j, N_attr;
+       XvAttribute *xv_attr;
+       Atom prop_atom;
+       const char *channels[4] = { "XV_HUE", "XV_SATURATION", "XV_BRIGHTNESS", "XV_CONTRAST"};
+
+       g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), NULL);
+
+       xcontext = g_new0 (GstXContext, 1);
+       xcontext->im_format = 0;
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+       xcontext->disp = XOpenDisplay (evaspixmapsink->display_name);
+
+       if (!xcontext->disp) {
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               g_free (xcontext);
+               GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE, ("Could not initialise Xv output"), ("Could not open display"));
+               return NULL;
+       }
+
+       xcontext->screen = DefaultScreenOfDisplay (xcontext->disp);
+       xcontext->screen_num = DefaultScreen (xcontext->disp);
+       xcontext->visual = DefaultVisual (xcontext->disp, xcontext->screen_num);
+       xcontext->root = DefaultRootWindow (xcontext->disp);
+       xcontext->white = XWhitePixel (xcontext->disp, xcontext->screen_num);
+       xcontext->black = XBlackPixel (xcontext->disp, xcontext->screen_num);
+       xcontext->depth = DefaultDepthOfScreen (xcontext->screen);
+
+       xcontext->width = DisplayWidth (xcontext->disp, xcontext->screen_num);
+       xcontext->height = DisplayHeight (xcontext->disp, xcontext->screen_num);
+       xcontext->widthmm = DisplayWidthMM (xcontext->disp, xcontext->screen_num);
+       xcontext->heightmm = DisplayHeightMM (xcontext->disp, xcontext->screen_num);
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"X reports %dx%d pixels and %d mm x %d mm", xcontext->width, xcontext->height, xcontext->widthmm, xcontext->heightmm);
+
+       gst_evaspixmapsink_calculate_pixel_aspect_ratio (xcontext);
+       /* We get supported pixmap formats at supported depth */
+       px_formats = XListPixmapFormats (xcontext->disp, &nb_formats);
+
+       if (!px_formats) {
+               XCloseDisplay (xcontext->disp);
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               g_free (xcontext->par);
+               g_free (xcontext);
+               GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, SETTINGS,
+               ("Could not initialise Xv output"), ("Could not get pixel formats"));
+               return NULL;
+       }
+
+       /* We get bpp value corresponding to our running depth */
+       for (i = 0; i < nb_formats; i++) {
+               if (px_formats[i].depth == xcontext->depth)
+               xcontext->bpp = px_formats[i].bits_per_pixel;
+       }
+
+       XFree (px_formats);
+
+       xcontext->endianness = (ImageByteOrder (xcontext->disp) == LSBFirst) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
+
+       /* our caps system handles 24/32bpp RGB as big-endian. */
+       if ((xcontext->bpp == 24 || xcontext->bpp == 32) && xcontext->endianness == G_LITTLE_ENDIAN) {
+               xcontext->endianness = G_BIG_ENDIAN;
+               xcontext->visual->red_mask = GUINT32_TO_BE (xcontext->visual->red_mask);
+               xcontext->visual->green_mask = GUINT32_TO_BE (xcontext->visual->green_mask);
+               xcontext->visual->blue_mask = GUINT32_TO_BE (xcontext->visual->blue_mask);
+               if (xcontext->bpp == 24) {
+                       xcontext->visual->red_mask >>= 8;
+                       xcontext->visual->green_mask >>= 8;
+                       xcontext->visual->blue_mask >>= 8;
+               }
+       }
+
+       xcontext->caps = gst_evaspixmapsink_get_xv_support (evaspixmapsink, xcontext);
+
+       if (!xcontext->caps) {
+               XCloseDisplay (xcontext->disp);
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               g_free (xcontext->par);
+               g_free (xcontext);
+               /* GST_ELEMENT_ERROR is thrown by gst_evaspixmapsink_get_xv_support */
+               return NULL;
+       }
+#ifdef HAVE_XSHM
+       /* Search for XShm extension support */
+       if (XShmQueryExtension (xcontext->disp) && gst_evaspixmapsink_check_xshm_calls (xcontext)) {
+               xcontext->use_xshm = TRUE;
+               GST_DEBUG_OBJECT (evaspixmapsink,"evaspixmapsink is using XShm extension");
+       } else
+#endif /* HAVE_XSHM */
+       {
+               xcontext->use_xshm = FALSE;
+               GST_DEBUG_OBJECT (evaspixmapsink,"evaspixmapsink is not using XShm extension");
+       }
+
+       xv_attr = XvQueryPortAttributes (xcontext->disp, xcontext->xv_port_id, &N_attr);
+
+       /* Generate the channels list */
+       for (i = 0; i < (sizeof (channels) / sizeof (char *)); i++) {
+               XvAttribute *matching_attr = NULL;
+
+               /* Retrieve the property atom if it exists. If it doesn't exist,
+               * the attribute itself must not either, so we can skip */
+               prop_atom = XInternAtom (xcontext->disp, channels[i], True);
+               if (prop_atom == None) {
+                       continue;
+               }
+
+               if (xv_attr != NULL) {
+                       for (j = 0; j < N_attr && matching_attr == NULL; ++j) {
+                               if (!g_ascii_strcasecmp (channels[i], xv_attr[j].name)) {
+                                       matching_attr = xv_attr + j;
+                               }
+                       }
+               }
+
+               if (matching_attr) {
+                       GstColorBalanceChannel *channel;
+                       channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
+                       channel->label = g_strdup (channels[i]);
+                       channel->min_value = matching_attr->min_value;
+                       channel->max_value = matching_attr->max_value;
+
+                       xcontext->channels_list = g_list_append (xcontext->channels_list, channel);
+
+                       /* If the colorbalance settings have not been touched we get Xv values
+                               as defaults and update our internal variables */
+                       if (!evaspixmapsink->cb_changed) {
+                               gint val;
+                               XvGetPortAttribute (xcontext->disp, xcontext->xv_port_id, prop_atom, &val);
+                               /* Normalize val to [-1000, 1000] */
+                               val = floor (0.5 + -1000 + 2000 * (val - channel->min_value) /  (double) (channel->max_value - channel->min_value));
+
+                               if (!g_ascii_strcasecmp (channels[i], "XV_HUE")) {
+                                       evaspixmapsink->hue = val;
+                               } else if (!g_ascii_strcasecmp (channels[i], "XV_SATURATION")) {
+                                       evaspixmapsink->saturation = val;
+                               } else if (!g_ascii_strcasecmp (channels[i], "XV_BRIGHTNESS")) {
+                                       evaspixmapsink->brightness = val;
+                               } else if (!g_ascii_strcasecmp (channels[i], "XV_CONTRAST")) {
+                                       evaspixmapsink->contrast = val;
+                               }
+                       }
+               }
+       }
+
+       if (xv_attr) {
+               XFree (xv_attr);
+       }
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+       return xcontext;
+}
+
+/* This function cleans the X context. Closing the Display, releasing the XV
+   port and unrefing the caps for supported formats. */
+static void
+gst_evaspixmapsink_xcontext_clear (GstEvasPixmapSink *evaspixmapsink)
+{
+  GList *formats_list, *channels_list;
+  GstXContext *xcontext;
+  gint i = 0;
+
+  g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+  GST_OBJECT_LOCK (evaspixmapsink);
+  if (evaspixmapsink->xcontext == NULL) {
+    GST_OBJECT_UNLOCK (evaspixmapsink);
+    return;
+  }
+
+  /* Take the XContext from the sink and clean it up */
+  xcontext = evaspixmapsink->xcontext;
+  evaspixmapsink->xcontext = NULL;
+
+  GST_OBJECT_UNLOCK (evaspixmapsink);
+
+  formats_list = xcontext->formats_list;
+
+  while (formats_list) {
+    GstEvasPixmapFormat *format = formats_list->data;
+
+    gst_caps_unref (format->caps);
+    g_free (format);
+    formats_list = g_list_next (formats_list);
+  }
+
+  if (xcontext->formats_list)
+    g_list_free (xcontext->formats_list);
+
+  channels_list = xcontext->channels_list;
+
+  while (channels_list) {
+    GstColorBalanceChannel *channel = channels_list->data;
+
+    g_object_unref (channel);
+    channels_list = g_list_next (channels_list);
+  }
+
+  if (xcontext->channels_list)
+    g_list_free (xcontext->channels_list);
+
+  gst_caps_unref (xcontext->caps);
+
+  for (i = 0; i < xcontext->nb_adaptors; i++) {
+    g_free (xcontext->adaptors[i]);
+  }
+
+  g_free (xcontext->adaptors);
+
+  g_free (xcontext->par);
+
+  g_mutex_lock (evaspixmapsink->x_lock);
+
+  GST_DEBUG_OBJECT (evaspixmapsink,"Closing display and freeing X Context");
+
+  XvUngrabPort (xcontext->disp, xcontext->xv_port_id, 0);
+
+  XCloseDisplay (xcontext->disp);
+
+  g_mutex_unlock (evaspixmapsink->x_lock);
+
+  g_free (xcontext);
+}
+
+/* Element stuff */
+
+/* This function tries to get a format matching with a given caps in the
+   supported list of formats we generated in gst_evaspixmapsink_get_xv_support */
+static gint
+gst_evaspixmapsink_get_format_from_caps (GstEvasPixmapSink *evaspixmapsink, GstCaps *caps)
+{
+  GList *list = NULL;
+
+  g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), 0);
+
+  list = evaspixmapsink->xcontext->formats_list;
+
+  while (list) {
+    GstEvasPixmapFormat *format = list->data;
+
+    if (format) {
+      if (gst_caps_can_intersect (caps, format->caps)) {
+        return format->format;
+      }
+    }
+    list = g_list_next (list);
+  }
+
+  return -1;
+}
+
+static GstCaps *
+gst_evaspixmapsink_getcaps (GstBaseSink *bsink)
+{
+  GstEvasPixmapSink *evaspixmapsink;
+
+  evaspixmapsink = GST_EVASPIXMAPSINK (bsink);
+
+  if (evaspixmapsink->xcontext)
+    return gst_caps_ref (evaspixmapsink->xcontext->caps);
+
+  return
+      gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_SINK_PAD
+          (evaspixmapsink)));
+}
+
+static gboolean
+gst_evaspixmapsink_setcaps (GstBaseSink *bsink, GstCaps *caps)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+       GstStructure *structure;
+       guint32 im_format = 0;
+       gboolean ret;
+       gint video_width, video_height;
+       gint disp_x, disp_y;
+       gint disp_width, disp_height;
+       gint video_par_n, video_par_d;        /* video's PAR */
+       gint display_par_n, display_par_d;    /* display's PAR */
+       const GValue *caps_par;
+       const GValue *caps_disp_reg;
+       const GValue *fps;
+       guint num, den;
+       gboolean enable_last_buffer;
+
+       evaspixmapsink = GST_EVASPIXMAPSINK (bsink);
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"In setcaps. Possible caps %" GST_PTR_FORMAT ", setting caps %" GST_PTR_FORMAT, evaspixmapsink->xcontext->caps, caps);
+
+       if (!gst_caps_can_intersect (evaspixmapsink->xcontext->caps, caps)) {
+               goto incompatible_caps;
+       }
+
+       structure = gst_caps_get_structure (caps, 0);
+       ret = gst_structure_get_int (structure, "width", &video_width);
+       ret &= gst_structure_get_int (structure, "height", &video_height);
+       fps = gst_structure_get_value (structure, "framerate");
+       ret &= (fps != NULL);
+
+       if (!ret) {
+               goto incomplete_caps;
+       }
+
+       evaspixmapsink->aligned_width = video_width;
+       evaspixmapsink->aligned_height = video_height;
+
+       /* get enable-last-buffer */
+       g_object_get(G_OBJECT(evaspixmapsink), "enable-last-buffer", &enable_last_buffer, NULL);
+       GST_INFO_OBJECT (evaspixmapsink,"current enable-last-buffer : %d", enable_last_buffer);
+       /* flush if enable-last-buffer is TRUE */
+       if (enable_last_buffer) {
+               GST_INFO_OBJECT (evaspixmapsink,"flush last-buffer");
+               g_object_set(G_OBJECT(evaspixmapsink), "enable-last-buffer", FALSE, NULL);
+               g_object_set(G_OBJECT(evaspixmapsink), "enable-last-buffer", TRUE, NULL);
+       }
+
+       evaspixmapsink->fps_n = gst_value_get_fraction_numerator (fps);
+       evaspixmapsink->fps_d = gst_value_get_fraction_denominator (fps);
+
+       evaspixmapsink->video_width = video_width;
+       evaspixmapsink->video_height = video_height;
+
+       im_format = gst_evaspixmapsink_get_format_from_caps (evaspixmapsink, caps);
+       if (im_format == -1) {
+               goto invalid_format;
+       }
+
+       /* get aspect ratio from caps if it's present, and
+       * convert video width and height to a display width and height
+       * using wd / hd = wv / hv * PARv / PARd */
+
+       /* get video's PAR */
+       caps_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
+       if (caps_par) {
+               video_par_n = gst_value_get_fraction_numerator (caps_par);
+               video_par_d = gst_value_get_fraction_denominator (caps_par);
+       } else {
+               video_par_n = 1;
+               video_par_d = 1;
+       }
+       /* get display's PAR */
+       if (evaspixmapsink->par) {
+               display_par_n = gst_value_get_fraction_numerator (evaspixmapsink->par);
+               display_par_d = gst_value_get_fraction_denominator (evaspixmapsink->par);
+       } else {
+               display_par_n = 1;
+               display_par_d = 1;
+       }
+
+       /* get the display region */
+       caps_disp_reg = gst_structure_get_value (structure, "display-region");
+       if (caps_disp_reg) {
+               disp_x = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 0));
+               disp_y = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 1));
+               disp_width = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 2));
+               disp_height = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 3));
+       } else {
+               disp_x = disp_y = 0;
+               disp_width = video_width;
+               disp_height = video_height;
+       }
+
+       if (!gst_video_calculate_display_ratio (&num, &den, video_width, video_height, video_par_n, video_par_d, display_par_n, display_par_d)) {
+               goto no_disp_ratio;
+       }
+
+       evaspixmapsink->disp_x = disp_x;
+       evaspixmapsink->disp_y = disp_y;
+       evaspixmapsink->disp_width = disp_width;
+       evaspixmapsink->disp_height = disp_height;
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"video width/height: %dx%d, calculated display ratio: %d/%d",  video_width, video_height, num, den);
+
+       /* now find a width x height that respects this display ratio.
+       * prefer those that have one of w/h the same as the incoming video
+       * using wd / hd = num / den */
+
+       /* start with same height, because of interlaced video */
+       /* check hd / den is an integer scale factor, and scale wd with the PAR */
+       if (video_height % den == 0) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"keeping video height");
+               GST_VIDEO_SINK_WIDTH (evaspixmapsink) = (guint) gst_util_uint64_scale_int (video_height, num, den);
+               GST_VIDEO_SINK_HEIGHT (evaspixmapsink) = video_height;
+       } else if (video_width % num == 0) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"keeping video width");
+               GST_VIDEO_SINK_WIDTH (evaspixmapsink) = video_width;
+               GST_VIDEO_SINK_HEIGHT (evaspixmapsink) = (guint) gst_util_uint64_scale_int (video_width, den, num);
+       } else {
+               GST_DEBUG_OBJECT (evaspixmapsink,"approximating while keeping video height");
+               GST_VIDEO_SINK_WIDTH (evaspixmapsink) = (guint) gst_util_uint64_scale_int (video_height, num, den);
+               GST_VIDEO_SINK_HEIGHT (evaspixmapsink) = video_height;
+       }
+       GST_DEBUG_OBJECT (evaspixmapsink,"scaling to %dx%d", GST_VIDEO_SINK_WIDTH (evaspixmapsink), GST_VIDEO_SINK_HEIGHT (evaspixmapsink));
+
+       /* Creating our window and our image with the display size in pixels */
+       if (GST_VIDEO_SINK_WIDTH (evaspixmapsink) <= 0 || GST_VIDEO_SINK_HEIGHT (evaspixmapsink) <= 0) {
+               goto no_display_size;
+       }
+
+       g_mutex_lock (evaspixmapsink->flow_lock);
+
+       /* We renew our evaspixmap buffer only if size or format changed;
+       * the evaspixmap buffer is the same size as the video pixel size */
+       if ((evaspixmapsink->evas_pixmap_buf) && ((im_format != evaspixmapsink->evas_pixmap_buf->im_format)
+               || (video_width != evaspixmapsink->evas_pixmap_buf->width) || (video_height != evaspixmapsink->evas_pixmap_buf->height))) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"old format %" GST_FOURCC_FORMAT ", new format %" GST_FOURCC_FORMAT,
+                               GST_FOURCC_ARGS (evaspixmapsink->evas_pixmap_buf->im_format), GST_FOURCC_ARGS (im_format));
+               GST_DEBUG_OBJECT (evaspixmapsink,"renewing evaspixmap buffer");
+               gst_buffer_unref (GST_BUFFER (evaspixmapsink->evas_pixmap_buf));
+               evaspixmapsink->evas_pixmap_buf = NULL;
+       }
+
+       g_mutex_unlock (evaspixmapsink->flow_lock);
+
+       if (evaspixmapsink->eo) {
+               if (!gst_evaspixmapsink_xpixmap_link (evaspixmapsink)) {
+                       GST_ERROR_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                       return FALSE;
+               } else {
+                       gst_evaspixmapsink_manage_event_thread (evaspixmapsink);
+               }
+       } else {
+               GST_ERROR_OBJECT (evaspixmapsink,"setcaps success, but there is no evas image object..");
+               return FALSE;
+       }
+
+       return TRUE;
+
+       /* ERRORS */
+       incompatible_caps:
+       {
+               GST_ERROR_OBJECT (evaspixmapsink,"caps incompatible");
+               return FALSE;
+       }
+       incomplete_caps:
+       {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Failed to retrieve either width, ""height or framerate from intersected caps");
+               return FALSE;
+       }
+       invalid_format:
+       {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Could not locate image format from caps %" GST_PTR_FORMAT, caps);
+               return FALSE;
+       }
+       no_disp_ratio:
+       {
+               GST_ELEMENT_ERROR (evaspixmapsink, CORE, NEGOTIATION, (NULL), ("Error calculating the output display ratio of the video."));
+               return FALSE;
+       }
+       no_display_size:
+       {
+               GST_ELEMENT_ERROR (evaspixmapsink, CORE, NEGOTIATION, (NULL), ("Error calculating the output display ratio of the video."));
+               return FALSE;
+       }
+}
+
+static GstStateChangeReturn
+gst_evaspixmapsink_change_state (GstElement *element, GstStateChange transition)
+{
+       GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+       GstEvasPixmapSink *evaspixmapsink;
+
+       evaspixmapsink = GST_EVASPIXMAPSINK (element);
+
+       switch (transition) {
+       case GST_STATE_CHANGE_NULL_TO_READY:
+               g_mutex_lock (evaspixmapsink->flow_lock);
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_NULL_TO_READY");
+
+               /* open drm to use gem */
+               if (drm_init(evaspixmapsink)) {
+                       GST_ERROR_OBJECT (evaspixmapsink,"drm_init() failure");
+                       g_mutex_unlock (evaspixmapsink->flow_lock);
+                       return GST_STATE_CHANGE_FAILURE;
+               }
+
+               /* check if there exist evas image object, need to write code related to making internal evas image object */
+               if (!is_evas_image_object (evaspixmapsink->eo)) {
+                       GST_ERROR_OBJECT (evaspixmapsink,"There is no evas image object..");
+                       g_mutex_unlock (evaspixmapsink->flow_lock);
+                       return GST_STATE_CHANGE_FAILURE;
+               }
+
+               /* Set xcontext and display */
+               if (!evaspixmapsink->xcontext) {
+                       evaspixmapsink->xcontext = gst_evaspixmapsink_xcontext_get (evaspixmapsink);
+                       if (!evaspixmapsink->xcontext) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"could not get xcontext..");
+                               g_mutex_unlock (evaspixmapsink->flow_lock);
+                               return GST_STATE_CHANGE_FAILURE;
+                       }
+               }
+
+               /* update object's par with calculated one if not set yet */
+               if (!evaspixmapsink->par) {
+                       evaspixmapsink->par = g_new0 (GValue, 1);
+                       gst_value_init_and_copy (evaspixmapsink->par, evaspixmapsink->xcontext->par);
+                       GST_DEBUG_OBJECT (evaspixmapsink,"set calculated PAR on object's PAR");
+               }
+
+               /* call XSynchronize with the current value of synchronous */
+               GST_DEBUG_OBJECT (evaspixmapsink,"XSynchronize called with %s", evaspixmapsink->synchronous ? "TRUE" : "FALSE");
+               XSynchronize (evaspixmapsink->xcontext->disp, evaspixmapsink->synchronous);
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+
+               g_mutex_unlock (evaspixmapsink->flow_lock);
+               break;
+
+       case GST_STATE_CHANGE_READY_TO_PAUSED:
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_READY_TO_PAUSED");
+               break;
+
+       case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_PAUSED_TO_PLAYING");
+               break;
+
+       default:
+               break;
+       }
+
+       ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+       switch (transition) {
+       case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_PLAYING_TO_PAUSED");
+               break;
+
+       case GST_STATE_CHANGE_PAUSED_TO_READY:
+       {
+               int i = 0;
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_PAUSED_TO_READY");
+               evaspixmapsink->fps_n = 0;
+               evaspixmapsink->fps_d = 1;
+               GST_VIDEO_SINK_WIDTH (evaspixmapsink) = 0;
+               GST_VIDEO_SINK_HEIGHT (evaspixmapsink) = 0;
+               drm_fini_close_gem_handle(evaspixmapsink, 0);
+       }
+               break;
+
+       case GST_STATE_CHANGE_READY_TO_NULL:
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_READY_TO_NULL");
+               gst_evaspixmapsink_reset(evaspixmapsink);
+               /* close drm */
+               drm_fini(evaspixmapsink);
+               break;
+
+       default:
+               break;
+       }
+       return ret;
+}
+
+static void
+gst_evaspixmapsink_get_times (GstBaseSink *bsink, GstBuffer *buf, GstClockTime *start, GstClockTime *end)
+{
+  GstEvasPixmapSink *evaspixmapsink;
+
+  evaspixmapsink = GST_EVASPIXMAPSINK (bsink);
+
+  if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
+    *start = GST_BUFFER_TIMESTAMP (buf);
+    if (GST_BUFFER_DURATION_IS_VALID (buf)) {
+      *end = *start + GST_BUFFER_DURATION (buf);
+    } else {
+      if (evaspixmapsink->fps_n > 0) {
+        *end = *start +
+            gst_util_uint64_scale_int (GST_SECOND, evaspixmapsink->fps_d,
+            evaspixmapsink->fps_n);
+      }
+    }
+  }
+}
+
+static GstFlowReturn
+gst_evaspixmapsink_show_frame (GstVideoSink *vsink, GstBuffer *buf)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+       XV_DATA_PTR img_data = NULL;
+       SCMN_IMGB *scmn_imgb = NULL;
+       gint format = 0;
+
+       MMTA_ACUM_ITEM_BEGIN("evaspixmapsink gst_evaspixmapsink_show_frame()", FALSE);
+
+       evaspixmapsink = GST_EVASPIXMAPSINK (vsink);
+
+       if( evaspixmapsink->stop_video ) {
+               GST_INFO_OBJECT (evaspixmapsink, "Stop video is TRUE. so skip show frame..." );
+               return GST_FLOW_OK;
+       }
+
+       if (!evaspixmapsink->evas_pixmap_buf) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"creating our evaspixmap buffer");
+               format = gst_evaspixmapsink_get_format_from_caps(evaspixmapsink, GST_BUFFER_CAPS(buf));
+               switch (format) {
+               case GST_MAKE_FOURCC('S', 'T', '1', '2'):
+               case GST_MAKE_FOURCC('S', 'N', '1', '2'):
+               case GST_MAKE_FOURCC('S', '4', '2', '0'):
+               case GST_MAKE_FOURCC('S', 'U', 'Y', '2'):
+               case GST_MAKE_FOURCC('S', 'U', 'Y', 'V'):
+               case GST_MAKE_FOURCC('S', 'Y', 'V', 'Y'):
+               case GST_MAKE_FOURCC('I', 'T', 'L', 'V'):
+               case GST_MAKE_FOURCC('S', 'R', '3', '2'):
+                       scmn_imgb = (SCMN_IMGB *)GST_BUFFER_MALLOCDATA(buf);
+                       if(scmn_imgb == NULL) {
+                               GST_DEBUG_OBJECT (evaspixmapsink, "scmn_imgb is NULL. Skip buffer put..." );
+                               return GST_FLOW_OK;
+                       }
+                        /* skip buffer if aligned size is smaller than size of caps */
+                       if (scmn_imgb->s[0] < evaspixmapsink->video_width || scmn_imgb->e[0] < evaspixmapsink->video_height) {
+                               GST_WARNING_OBJECT (evaspixmapsink,"invalid size[caps:%dx%d,aligned:%dx%d]. Skip this buffer...",
+                                               evaspixmapsink->video_width, evaspixmapsink->video_height, scmn_imgb->s[0], scmn_imgb->e[0]);
+                               return GST_FLOW_OK;
+                       }
+                       evaspixmapsink->aligned_width = scmn_imgb->s[0];
+                       evaspixmapsink->aligned_height = scmn_imgb->e[0];
+                       GST_DEBUG_OBJECT (evaspixmapsink,"video width,height[%dx%d]",evaspixmapsink->video_width, evaspixmapsink->video_height);
+                       GST_INFO_OBJECT (evaspixmapsink,"Use aligned width,height[%dx%d]",evaspixmapsink->aligned_width, evaspixmapsink->aligned_height);
+                       break;
+               default:
+                       GST_INFO_OBJECT (evaspixmapsink,"Use original width,height of caps");
+                       break;
+               }
+               evaspixmapsink->evas_pixmap_buf = gst_evaspixmap_buffer_new (evaspixmapsink, GST_BUFFER_CAPS (buf));
+               if (!evaspixmapsink->evas_pixmap_buf) {
+                       /* The create method should have posted an informative error */
+                       goto no_image;
+               }
+               if (evaspixmapsink->evas_pixmap_buf->size < GST_BUFFER_SIZE (buf)) {
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE, ("Failed to create output image buffer of %dx%d pixels",    evaspixmapsink->evas_pixmap_buf->width, evaspixmapsink->evas_pixmap_buf->height),("XServer allocated buffer size did not match input buffer"));
+                       gst_evaspixmap_buffer_destroy (evaspixmapsink->evas_pixmap_buf);
+                       evaspixmapsink->evas_pixmap_buf = NULL;
+                       goto no_image;
+               }
+       }
+
+       switch (evaspixmapsink->evas_pixmap_buf->im_format) {
+       /* Cases for specified formats of Samsung extension */
+       case GST_MAKE_FOURCC('S', 'T', '1', '2'):
+       case GST_MAKE_FOURCC('S', 'N', '1', '2'):
+       case GST_MAKE_FOURCC('S', '4', '2', '0'):
+       case GST_MAKE_FOURCC('S', 'U', 'Y', '2'):
+       case GST_MAKE_FOURCC('S', 'U', 'Y', 'V'):
+       case GST_MAKE_FOURCC('S', 'Y', 'V', 'Y'):
+       case GST_MAKE_FOURCC('I', 'T', 'L', 'V'):
+       case GST_MAKE_FOURCC('S', 'R', '3', '2'):
+       {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Samsung extension display format activated. fourcc:%d", evaspixmapsink->evas_pixmap_buf->im_format);
+
+               if (evaspixmapsink->evas_pixmap_buf->xvimage->data) {
+                       img_data = (XV_DATA_PTR) evaspixmapsink->evas_pixmap_buf->xvimage->data;
+                       XV_INIT_DATA(img_data);
+                       scmn_imgb = (SCMN_IMGB *)GST_BUFFER_MALLOCDATA(buf);
+                       if (scmn_imgb == NULL) {
+                               GST_DEBUG_OBJECT (evaspixmapsink, "scmn_imgb is NULL. Skip buffer put..." );
+                               return GST_FLOW_OK;
+                       }
+
+                       if (scmn_imgb->buf_share_method == BUF_SHARE_METHOD_PADDR) {
+                               img_data->YBuf = (unsigned int)scmn_imgb->p[0];
+                               img_data->CbBuf = (unsigned int)scmn_imgb->p[1];
+                               img_data->CrBuf = (unsigned int)scmn_imgb->p[2];
+                               img_data->BufType = XV_BUF_TYPE_LEGACY;
+
+                       } else if (scmn_imgb->buf_share_method == BUF_SHARE_METHOD_FD) {
+                               /* set gem information to gem_info structure of handle and convert dma-buf fd into drm gem name  */
+                               img_data->YBuf = drm_init_convert_dmabuf_gemname(evaspixmapsink, (int)scmn_imgb->dma_buf_fd[0]);
+                               img_data->CbBuf = drm_init_convert_dmabuf_gemname(evaspixmapsink, (int)scmn_imgb->dma_buf_fd[1]);
+                               img_data->CrBuf = drm_init_convert_dmabuf_gemname(evaspixmapsink, (int)scmn_imgb->dma_buf_fd[2]);
+                               img_data->BufType = XV_BUF_TYPE_DMABUF;
+                               if (evaspixmapsink->buf_shared_type != BUF_SHARE_METHOD_FD) {
+                                       evaspixmapsink->buf_shared_type = BUF_SHARE_METHOD_FD;
+                                       GST_WARNING_OBJECT (evaspixmapsink, "BUF SHARED TYPE : FD");
+                               }
+
+                       } else if (scmn_imgb->buf_share_method == BUF_SHARE_METHOD_TIZEN_BUFFER) {
+                               img_data->bo[0] = scmn_imgb->bo[0];
+                               img_data->bo[1] = scmn_imgb->bo[1];
+                               img_data->bo[2] = scmn_imgb->bo[2];
+                               GST_DEBUG("TBM bo %p %p %p", img_data->bo[0], img_data->bo[1], img_data->bo[2]);
+                               /* export bo */
+                               if (img_data->bo[0]) {
+                                       img_data->YBuf = tbm_init_convert_bo_gemname(evaspixmapsink, (tbm_bo)img_data->bo[0]);
+                               }
+                               if (img_data->bo[1]) {
+                                       img_data->CbBuf = tbm_init_convert_bo_gemname(evaspixmapsink, (tbm_bo)img_data->bo[1]);
+                               }
+                               if (img_data->bo[2]) {
+                                       img_data->CrBuf = tbm_init_convert_bo_gemname(evaspixmapsink, (tbm_bo)img_data->bo[2]);
+                               }
+                               if (evaspixmapsink->buf_shared_type != BUF_SHARE_METHOD_TIZEN_BUFFER) {
+                                       evaspixmapsink->buf_shared_type = BUF_SHARE_METHOD_TIZEN_BUFFER;
+                                       GST_WARNING_OBJECT (evaspixmapsink, "BUF SHARED TYPE : TIZEN BUFFER");
+                               }
+                       } else {
+                               GST_WARNING_OBJECT (evaspixmapsink, "Not supported, buf_share_method(%d)", scmn_imgb->buf_share_method);
+                               return GST_FLOW_OK;
+                       }
+                       if (!img_data->YBuf) {
+                               GST_WARNING_OBJECT (evaspixmapsink, "img_data->YBuf is NULL. skip buffer put..." );
+                               return GST_FLOW_OK;
+                       }
+                       GST_LOG_OBJECT(evaspixmapsink, "YBuf[%d], CbBuf[%d], CrBuf[%d]",
+                                       img_data->YBuf, img_data->CbBuf, img_data->CrBuf );
+               } else {
+                       GST_WARNING_OBJECT (evaspixmapsink, "xvimage->data is NULL. skip buffer put..." );
+                       return GST_FLOW_OK;
+               }
+               break;
+       }
+       default:
+       {
+               if (evaspixmapsink->buf_shared_type != BUF_SHARE_METHOD_NONE) {
+                       evaspixmapsink->buf_shared_type = BUF_SHARE_METHOD_NONE;
+               }
+               GST_DEBUG_OBJECT (evaspixmapsink,"Normal format activated. fourcc = %d", evaspixmapsink->evas_pixmap_buf->im_format);
+               __ta__("evaspixmapsink memcpy in _show_frame", memcpy (evaspixmapsink->evas_pixmap_buf->xvimage->data, GST_BUFFER_DATA (buf),
+               MIN (GST_BUFFER_SIZE (buf), evaspixmapsink->evas_pixmap_buf->size)););
+               break;
+       }
+       }
+       if (!gst_evaspixmap_buffer_put (evaspixmapsink, evaspixmapsink->evas_pixmap_buf)) {
+               MMTA_ACUM_ITEM_END("evaspixmapsink gst_evaspixmapsink_show_frame()", FALSE);
+               return GST_FLOW_OK;
+       }
+
+       MMTA_ACUM_ITEM_END("evaspixmapsink gst_evaspixmapsink_show_frame()", FALSE);
+
+       return GST_FLOW_OK;
+
+       /* ERRORS */
+       no_image:
+       {
+               /* No image available. That's very bad ! */
+               GST_WARNING_OBJECT (evaspixmapsink,"could not create image");
+               return GST_FLOW_ERROR;
+       }
+}
+
+static gboolean
+gst_evaspixmapsink_event (GstBaseSink *sink, GstEvent *event)
+{
+       GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (sink);
+
+       switch (GST_EVENT_TYPE (event)) {
+       case GST_EVENT_FLUSH_START:
+               GST_DEBUG_OBJECT (evaspixmapsink,"GST_EVENT_FLUSH_START");
+               break;
+       case GST_EVENT_FLUSH_STOP:
+               GST_DEBUG_OBJECT (evaspixmapsink,"GST_EVENT_FLUSH_STOP");
+               break;
+       default:
+               break;
+       }
+       if (GST_BASE_SINK_CLASS (parent_class)->event) {
+               return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
+       } else {
+               return TRUE;
+       }
+}
+
+/* Interfaces stuff */
+
+static gboolean
+gst_evaspixmapsink_interface_supported (GstImplementsInterface *iface, GType type)
+{
+  g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_COLOR_BALANCE || type == GST_TYPE_PROPERTY_PROBE);
+  return TRUE;
+}
+
+static void
+gst_evaspixmapsink_interface_init (GstImplementsInterfaceClass *klass)
+{
+  klass->supported = gst_evaspixmapsink_interface_supported;
+}
+
+static void
+gst_evaspixmapsink_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (navigation);
+  GstPad *peer;
+  int i = 0;
+
+  if ((peer = gst_pad_get_peer (GST_VIDEO_SINK_PAD (evaspixmapsink)))) {
+    GstEvent *event;
+    GstVideoRectangle result;
+    gdouble x, y, xscale = 1.0, yscale = 1.0;
+
+    event = gst_event_new_navigation (structure);
+
+    /* We take the flow_lock while we look at the window */
+    g_mutex_lock (evaspixmapsink->flow_lock);
+
+    for (i = 0; i < evaspixmapsink->num_of_pixmaps; i ++) {
+      if (!evaspixmapsink->xpixmap[i]) {
+        g_mutex_unlock (evaspixmapsink->flow_lock);
+        return;
+      }
+    }
+
+    memcpy (&result, &evaspixmapsink->render_rect, sizeof (GstVideoRectangle));
+
+    g_mutex_unlock (evaspixmapsink->flow_lock);
+
+    /* We calculate scaling using the original video frames geometry to include
+       pixel aspect ratio scaling. */
+    xscale = (gdouble) evaspixmapsink->video_width / result.w;
+    yscale = (gdouble) evaspixmapsink->video_height / result.h;
+
+    /* Converting pointer coordinates to the non scaled geometry */
+    if (gst_structure_get_double (structure, "pointer_x", &x)) {
+      x = MIN (x, result.x + result.w);
+      x = MAX (x - result.x, 0);
+      gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
+          (gdouble) x * xscale, NULL);
+    }
+    if (gst_structure_get_double (structure, "pointer_y", &y)) {
+      y = MIN (y, result.y + result.h);
+      y = MAX (y - result.y, 0);
+      gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
+          (gdouble) y * yscale, NULL);
+    }
+
+    gst_pad_send_event (peer, event);
+    gst_object_unref (peer);
+  }
+}
+
+static void
+gst_evaspixmapsink_navigation_init (GstNavigationInterface *iface)
+{
+  iface->send_event = gst_evaspixmapsink_navigation_send_event;
+}
+
+static const GList*
+gst_evaspixmapsink_colorbalance_list_channels (GstColorBalance *balance)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (balance);
+
+  g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), NULL);
+
+  if (evaspixmapsink->xcontext)
+    return evaspixmapsink->xcontext->channels_list;
+  else
+    return NULL;
+}
+
+static void
+gst_evaspixmapsink_colorbalance_set_value (GstColorBalance *balance, GstColorBalanceChannel *channel, gint value)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (balance);
+
+  g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+  g_return_if_fail (channel->label != NULL);
+
+  evaspixmapsink->cb_changed = TRUE;
+
+  /* Normalize val to [-1000, 1000] */
+  value = floor (0.5 + -1000 + 2000 * (value - channel->min_value) /
+      (double) (channel->max_value - channel->min_value));
+
+  if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) {
+    evaspixmapsink->hue = value;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) {
+    evaspixmapsink->saturation = value;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) {
+    evaspixmapsink->contrast = value;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) {
+    evaspixmapsink->brightness = value;
+  } else {
+    g_warning ("got an unknown channel %s", channel->label);
+    return;
+  }
+
+  gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+}
+
+static gint
+gst_evaspixmapsink_colorbalance_get_value (GstColorBalance *balance, GstColorBalanceChannel *channel)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (balance);
+  gint value = 0;
+
+  g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), 0);
+  g_return_val_if_fail (channel->label != NULL, 0);
+
+  if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) {
+    value = evaspixmapsink->hue;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) {
+    value = evaspixmapsink->saturation;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) {
+    value = evaspixmapsink->contrast;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) {
+    value = evaspixmapsink->brightness;
+  } else {
+    g_warning ("got an unknown channel %s", channel->label);
+  }
+
+  /* Normalize val to [channel->min_value, channel->max_value] */
+  value = channel->min_value + (channel->max_value - channel->min_value) * (value + 1000) / 2000;
+
+  return value;
+}
+
+static void
+gst_evaspixmapsink_colorbalance_init (GstColorBalanceClass *iface)
+{
+  GST_COLOR_BALANCE_TYPE (iface) = GST_COLOR_BALANCE_HARDWARE;
+  iface->list_channels = gst_evaspixmapsink_colorbalance_list_channels;
+  iface->set_value = gst_evaspixmapsink_colorbalance_set_value;
+  iface->get_value = gst_evaspixmapsink_colorbalance_get_value;
+}
+
+static const GList *
+gst_evaspixmapsink_probe_get_properties (GstPropertyProbe *probe)
+{
+       GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
+       static GList *list = NULL;
+
+       if (!list) {
+               list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
+               list = g_list_append (list, g_object_class_find_property (klass, "autopaint-colorkey"));
+               list = g_list_append (list, g_object_class_find_property (klass, "double-buffer"));
+               list = g_list_append (list, g_object_class_find_property (klass, "colorkey"));
+       }
+
+       return list;
+}
+
+static void
+gst_evaspixmapsink_probe_probe_property (GstPropertyProbe *probe, guint prop_id, const GParamSpec *pspec)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (probe);
+
+  switch (prop_id) {
+    case PROP_DEVICE:
+    case PROP_AUTOPAINT_COLORKEY:
+    case PROP_DOUBLE_BUFFER:
+    case PROP_COLORKEY:
+      GST_DEBUG_OBJECT (evaspixmapsink,"probing device list and get capabilities");
+      if (!evaspixmapsink->xcontext) {
+        GST_DEBUG_OBJECT (evaspixmapsink,"generating xcontext");
+        evaspixmapsink->xcontext = gst_evaspixmapsink_xcontext_get (evaspixmapsink);
+        if (!evaspixmapsink->xcontext) {
+          GST_ERROR_OBJECT (evaspixmapsink,"could not get xcontext..");
+        }
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+gst_evaspixmapsink_probe_needs_probe (GstPropertyProbe *probe, guint prop_id, const GParamSpec *pspec)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (probe);
+  gboolean ret = FALSE;
+
+  switch (prop_id) {
+    case PROP_DEVICE:
+    case PROP_AUTOPAINT_COLORKEY:
+    case PROP_DOUBLE_BUFFER:
+    case PROP_COLORKEY:
+      if (evaspixmapsink->xcontext != NULL) {
+        ret = FALSE;
+      } else {
+        ret = TRUE;
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
+      break;
+  }
+
+  return ret;
+}
+
+static GValueArray *
+gst_evaspixmapsink_probe_get_values (GstPropertyProbe *probe, guint prop_id, const GParamSpec *pspec)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (probe);
+  GValueArray *array = NULL;
+
+  if (G_UNLIKELY (!evaspixmapsink->xcontext)) {
+    GST_WARNING_OBJECT (evaspixmapsink,"we don't have any xcontext, can't "
+        "get values");
+    goto beach;
+  }
+
+  switch (prop_id) {
+    case PROP_DEVICE:
+    {
+      guint i;
+      GValue value = { 0 };
+
+      array = g_value_array_new (evaspixmapsink->xcontext->nb_adaptors);
+      g_value_init (&value, G_TYPE_STRING);
+
+      for (i = 0; i < evaspixmapsink->xcontext->nb_adaptors; i++) {
+        gchar *adaptor_id_s = g_strdup_printf ("%u", i);
+
+        g_value_set_string (&value, adaptor_id_s);
+        g_value_array_append (array, &value);
+        g_free (adaptor_id_s);
+      }
+      g_value_unset (&value);
+      break;
+    }
+    case PROP_AUTOPAINT_COLORKEY:
+      if (evaspixmapsink->have_autopaint_colorkey) {
+        GValue value = { 0 };
+
+        array = g_value_array_new (2);
+        g_value_init (&value, G_TYPE_BOOLEAN);
+        g_value_set_boolean (&value, FALSE);
+        g_value_array_append (array, &value);
+        g_value_set_boolean (&value, TRUE);
+        g_value_array_append (array, &value);
+        g_value_unset (&value);
+      }
+      break;
+    case PROP_DOUBLE_BUFFER:
+      if (evaspixmapsink->have_double_buffer) {
+        GValue value = { 0 };
+
+        array = g_value_array_new (2);
+        g_value_init (&value, G_TYPE_BOOLEAN);
+        g_value_set_boolean (&value, FALSE);
+        g_value_array_append (array, &value);
+        g_value_set_boolean (&value, TRUE);
+        g_value_array_append (array, &value);
+        g_value_unset (&value);
+      }
+      break;
+    case PROP_COLORKEY:
+      if (evaspixmapsink->have_colorkey) {
+        GValue value = { 0 };
+
+        array = g_value_array_new (1);
+        g_value_init (&value, GST_TYPE_INT_RANGE);
+        gst_value_set_int_range (&value, 0, 0xffffff);
+        g_value_array_append (array, &value);
+        g_value_unset (&value);
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
+      break;
+  }
+
+beach:
+  return array;
+}
+
+static void
+gst_evaspixmapsink_property_probe_interface_init (GstPropertyProbeInterface *iface)
+{
+       iface->get_properties = gst_evaspixmapsink_probe_get_properties;
+       iface->probe_property = gst_evaspixmapsink_probe_probe_property;
+       iface->needs_probe = gst_evaspixmapsink_probe_needs_probe;
+       iface->get_values = gst_evaspixmapsink_probe_get_values;
+}
+
+static gboolean
+gst_evaspixmapsink_xpixmap_link (GstEvasPixmapSink *evaspixmapsink)
+{
+       Display *dpy;
+       Pixmap *pixmap_id[NUM_OF_PIXMAP];
+       int evas_object_width = 0;
+       int evas_object_height = 0;
+       int pixmap_width = 0;
+       int pixmap_height = 0;
+       unsigned int xw = 0;
+       unsigned int xh = 0;
+       int i = 0;
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START]");
+
+       if (!evaspixmapsink) {
+               GST_ERROR_OBJECT (evaspixmapsink,"could not get evaspixmapsink..");
+               return FALSE;
+       }
+       g_mutex_lock (evaspixmapsink->flow_lock);
+
+       /* Set xcontext and display */
+       if (!evaspixmapsink->xcontext) {
+               GST_WARNING_OBJECT (evaspixmapsink,"there's no xcontext, try to get one..");
+               evaspixmapsink->xcontext = gst_evaspixmapsink_xcontext_get (evaspixmapsink);
+               if (!evaspixmapsink->xcontext) {
+                       GST_ERROR_OBJECT (evaspixmapsink,"could not get xcontext..");
+                       return FALSE;
+               }
+       }
+
+       /* Set evas image object size */
+       evas_object_geometry_get(evaspixmapsink->eo, NULL, NULL, &evas_object_width, &evas_object_height);
+
+       /* check if it is redundant request */
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               if (evaspixmapsink->xpixmap[i]) {
+                       if (!evaspixmapsink->use_origin_size && evaspixmapsink->xpixmap[i]->width && evaspixmapsink->xpixmap[i]->height) {
+                               if (evaspixmapsink->xpixmap[i]->width == evas_object_width && evaspixmapsink->xpixmap[i]->height == evas_object_height) {
+                                       GST_WARNING_OBJECT (evaspixmapsink,"pixmap was already created(w:%d, h:%d), skip it..",
+                                               evaspixmapsink->xpixmap[i]->width, evaspixmapsink->xpixmap[i]->height);
+                                       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                                               XSetForeground (evaspixmapsink->xcontext->disp, evaspixmapsink->xpixmap[i]->gc, evaspixmapsink->xcontext->black);
+                                               XFillRectangle (evaspixmapsink->xcontext->disp, evaspixmapsink->xpixmap[i]->pixmap, evaspixmapsink->xpixmap[i]->gc,
+                                                       0, 0, evaspixmapsink->xpixmap[i]->width, evaspixmapsink->xpixmap[i]->height);
+                                               GST_LOG_OBJECT (evaspixmapsink,"fill black to xpixmap[%d] with size(w:%d,h:%d)", evaspixmapsink->xpixmap[i]->pixmap,
+                                                               evaspixmapsink->xpixmap[i]->width, evaspixmapsink->xpixmap[i]->height);
+                                       }
+                                       goto SKIP_LINK;
+                               }
+                       }
+               }
+       }
+
+       dpy = evaspixmapsink->xcontext->disp;
+
+       if (evaspixmapsink->use_origin_size || !evas_object_width || !evas_object_height) {
+               pixmap_width = evaspixmapsink->video_width;
+               pixmap_height = evaspixmapsink->video_height;
+               GST_INFO_OBJECT (evaspixmapsink,"set size to media src size(%dx%d)", pixmap_width, pixmap_height);
+       }
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+       evaspixmapsink->sizediff_width = 0;
+       evaspixmapsink->sizediff_height = 0;
+       if (evaspixmapsink->use_origin_size || !evas_object_width || !evas_object_height) {
+               XvQueryBestSize(dpy, evaspixmapsink->xcontext->xv_port_id,0,0,0, pixmap_width, pixmap_height, &xw, &xh);
+               if (!evas_object_width || !evas_object_height) {
+                       evaspixmapsink->w = xw;
+                       evaspixmapsink->h = xh;
+               } else {
+                       evaspixmapsink->w = evas_object_width;
+                       evaspixmapsink->h = evas_object_height;
+               }
+               GST_DEBUG_OBJECT (evaspixmapsink,"XvQueryBestSize : xv_port_id(%d), w(%d),h(%d) => xw(%d),xh(%d)", evaspixmapsink->xcontext->xv_port_id, pixmap_width, pixmap_height, xw, xh);
+       } else {
+               XvQueryBestSize(dpy, evaspixmapsink->xcontext->xv_port_id,0,0,0, evas_object_width, evas_object_height, &xw, &xh);
+               GST_DEBUG_OBJECT (evaspixmapsink,"XvQueryBestSize : xv_port_id(%d), w(%d),h(%d) => xw(%d),xh(%d)", evaspixmapsink->xcontext->xv_port_id, evas_object_width, evas_object_height, xw, xh);
+               evaspixmapsink->w = xw;
+               evaspixmapsink->h = xh;
+               /* update difference of size information (between evas image object's and pixmap's) */
+               evaspixmapsink->sizediff_width = xw - evas_object_width;
+               evaspixmapsink->sizediff_height = xh - evas_object_height;
+       }
+
+       /* create xpixmap structure */
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               if (!evaspixmapsink->xpixmap[i]) {
+                       /* xpixmap can be created in this function only */
+                       evaspixmapsink->xpixmap[i] = g_new0 (GstXPixmap, 1);
+                       if(!evaspixmapsink->xpixmap[i]) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"xpixmap is not valid..");
+                               int j = 0;
+                               for (j = 0; j < i; j++) {
+                                       g_free(evaspixmapsink->xpixmap[j]);
+                               }
+                               goto GO_OUT_OF_FUNC;
+                       }
+               }
+       }
+
+       /* create pixmap */
+       if (!xw || !xh) {
+               GST_WARNING_OBJECT (evaspixmapsink,"skip creating pixmap..xw(%d),xh(%d)",xw,xh);
+               goto GO_OUT_OF_FUNC;
+       } else {
+               /* multiple pixmaps creation */
+               for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                       pixmap_id[i] = XCreatePixmap(dpy, DefaultRootWindow(dpy), xw, xh, DefaultDepth(dpy, DefaultScreen(dpy)));
+                       if ( (int)pixmap_id[i] == BadAlloc || (int)pixmap_id[i] == BadDrawable || (int)pixmap_id[i] == BadValue ) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"pixmap[%d] allocation error..", i);
+                               int j = 0;
+                               for (j = 0; j < i; j++) {
+                                       XFreePixmap(dpy, pixmap_id[j]);
+                               }
+                               goto GO_OUT_OF_FUNC;
+                       }
+                       GST_INFO_OBJECT (evaspixmapsink,"creation pixmap_id[%d]:%d success", i, pixmap_id[i]);
+                       GST_DEBUG_OBJECT (evaspixmapsink,"evas_object_width(%d),evas_object_height(%d),pixmap:%d,depth:%d",
+                                                               evas_object_width,evas_object_height,pixmap_id[i],DefaultDepth(dpy, DefaultScreen(dpy)));
+               }
+       }
+
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               if (evaspixmapsink->xpixmap[i]->pixmap && pixmap_id[i] != evaspixmapsink->xpixmap[i]->pixmap) {
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+                       /* If we reset another pixmap, do below */
+                       evaspixmapsink->xpixmap[i]->prev_pixmap = evaspixmapsink->xpixmap[i]->pixmap;
+                       evaspixmapsink->xpixmap[i]->prev_gc = evaspixmapsink->xpixmap[i]->gc;
+                       evaspixmapsink->xpixmap[i]->pixmap = 0;
+                       evaspixmapsink->xpixmap[i]->ref = 0;
+                       evaspixmapsink->xpixmap[i]->damaged_time = 0;
+                       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+                       g_mutex_lock (evaspixmapsink->x_lock);
+               }
+       }
+
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               /* Set pixmap id and create GC */
+               evaspixmapsink->xpixmap[i]->pixmap = pixmap_id[i];
+               evaspixmapsink->xpixmap[i]->gc = XCreateGC(dpy, evaspixmapsink->xpixmap[i]->pixmap, 0,0);
+               evaspixmapsink->xpixmap[i]->width = xw;
+               evaspixmapsink->xpixmap[i]->height = xh;
+
+               /* Create XDamage */
+               if (evaspixmapsink->damage[i]) {
+                       evaspixmapsink->prev_damage[i] = evaspixmapsink->damage[i];
+               }
+               evaspixmapsink->damage[i] = XDamageCreate (dpy, evaspixmapsink->xpixmap[i]->pixmap, XDamageReportRawRectangles);
+
+               GST_WARNING_OBJECT (evaspixmapsink,"xpixmap[%d]->(pixmap:%d,gc:%p), damage[%d]:%d",
+                                       i, evaspixmapsink->xpixmap[i]->pixmap, evaspixmapsink->xpixmap[i]->gc, i, evaspixmapsink->damage[i]);
+
+               /* Fill blackcolor for the new pixmap */
+               XSetForeground (evaspixmapsink->xcontext->disp, evaspixmapsink->xpixmap[i]->gc, evaspixmapsink->xcontext->black);
+               XFillRectangle (evaspixmapsink->xcontext->disp, pixmap_id[i], evaspixmapsink->xpixmap[i]->gc,
+                                       0, 0, evaspixmapsink->w, evaspixmapsink->h);
+               GST_LOG_OBJECT (evaspixmapsink,"fill black to xpixmap[%d] with size(w:%d,h:%d)", pixmap_id[i],
+                                       evaspixmapsink->w, evaspixmapsink->h);
+       }
+
+       XSync(dpy, FALSE);
+
+       /* Set flag for mapping evas object with xpixmap */
+       evaspixmapsink->do_link = TRUE;
+       if (evaspixmapsink->epipe_request_count > EPIPE_REQUEST_LIMIT) {
+               GST_WARNING_OBJECT (evaspixmapsink,"epipe_request_count(%d), skip ecore_pipe_write()", evaspixmapsink->epipe_request_count);
+       } else {
+               ecore_pipe_write(evaspixmapsink->epipe, evaspixmapsink, sizeof(GstEvasPixmapSink));
+               evaspixmapsink->epipe_request_count++;
+       }
+
+       gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+
+SKIP_LINK:
+       g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+       evaspixmapsink->last_updated_idx = -1;
+       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+
+       g_mutex_unlock (evaspixmapsink->flow_lock);
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+
+       return TRUE;
+
+GO_OUT_OF_FUNC:
+       g_mutex_unlock (evaspixmapsink->x_lock);
+       g_mutex_unlock (evaspixmapsink->flow_lock);
+       return FALSE;
+}
+
+static void
+gst_evaspixmapsink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (object));
+       evaspixmapsink = GST_EVASPIXMAPSINK (object);
+
+       switch (prop_id) {
+       case PROP_HUE:
+               evaspixmapsink->hue = g_value_get_int (value);
+               evaspixmapsink->cb_changed = TRUE;
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+               break;
+       case PROP_CONTRAST:
+               evaspixmapsink->contrast = g_value_get_int (value);
+               evaspixmapsink->cb_changed = TRUE;
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+               break;
+       case PROP_BRIGHTNESS:
+               evaspixmapsink->brightness = g_value_get_int (value);
+               evaspixmapsink->cb_changed = TRUE;
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+               break;
+       case PROP_SATURATION:
+               evaspixmapsink->saturation = g_value_get_int (value);
+               evaspixmapsink->cb_changed = TRUE;
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+               break;
+       case PROP_DISPLAY:
+               evaspixmapsink->display_name = g_strdup (g_value_get_string (value));
+               break;
+       case PROP_SYNCHRONOUS:
+               evaspixmapsink->synchronous = g_value_get_boolean (value);
+               if (evaspixmapsink->xcontext) {
+                       XSynchronize (evaspixmapsink->xcontext->disp, evaspixmapsink->synchronous);
+                       GST_DEBUG_OBJECT (evaspixmapsink,"XSynchronize called with %s", evaspixmapsink->synchronous ? "TRUE" : "FALSE");
+               }
+               break;
+       case PROP_PIXEL_ASPECT_RATIO:
+               g_free (evaspixmapsink->par);
+               evaspixmapsink->par = g_new0 (GValue, 1);
+               g_value_init (evaspixmapsink->par, GST_TYPE_FRACTION);
+               if (!g_value_transform (value, evaspixmapsink->par)) {
+                       g_warning ("Could not transform string to aspect ratio");
+                       gst_value_set_fraction (evaspixmapsink->par, 1, 1);
+               }
+               GST_DEBUG_OBJECT (evaspixmapsink,"set PAR to %d/%d", gst_value_get_fraction_numerator (evaspixmapsink->par), gst_value_get_fraction_denominator (evaspixmapsink->par));
+               break;
+       case PROP_DEVICE:
+               evaspixmapsink->adaptor_no = atoi (g_value_get_string (value));
+               break;
+       case PROP_DOUBLE_BUFFER:
+               evaspixmapsink->double_buffer = g_value_get_boolean (value);
+               break;
+       case PROP_AUTOPAINT_COLORKEY:
+               evaspixmapsink->autopaint_colorkey = g_value_get_boolean (value);
+               break;
+       case PROP_COLORKEY:
+               evaspixmapsink->colorkey = g_value_get_int (value);
+               break;
+       case PROP_PIXMAP_WIDTH:
+       {
+               /* To do : code related to pixmap re-link */
+               GST_LOG_OBJECT (evaspixmapsink, "Not supported");
+               break;
+       }
+       case PROP_PIXMAP_HEIGHT:
+       {
+               /* To do : code related to pixmap re-link */
+               GST_LOG_OBJECT (evaspixmapsink, "Not supported");
+               break;
+       }
+       case PROP_DISPLAY_GEOMETRY_METHOD:
+       {
+               guint new_val = g_value_get_enum (value);
+               if (evaspixmapsink->display_geometry_method != new_val) {
+                       evaspixmapsink->display_geometry_method = new_val;
+                       GST_INFO_OBJECT (evaspixmapsink,"Overlay geometry method update, display_geometry_method(%d)",evaspixmapsink->display_geometry_method);
+                       if( evaspixmapsink->display_geometry_method != DISP_GEO_METHOD_FULL_SCREEN &&
+                                 evaspixmapsink->display_geometry_method != DISP_GEO_METHOD_CROPPED_FULL_SCREEN ) {
+                               if( evaspixmapsink->xcontext ) {
+                                       g_mutex_lock( evaspixmapsink->flow_lock );
+                                       int i = 0;
+                                       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                                               if (evaspixmapsink->xpixmap[i]) {
+                                                       gst_evaspixmapsink_xpixmap_clear (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+                                               }
+                                       }
+                                       g_mutex_unlock( evaspixmapsink->flow_lock );
+                               }
+                       }
+                       if (evaspixmapsink->xcontext) {
+                               gst_evaspixmap_buffer_put (evaspixmapsink, evaspixmapsink->evas_pixmap_buf);
+                       }
+               }
+               break;
+       }
+       case PROP_DST_ROI_X:
+               evaspixmapsink->dst_roi.x = g_value_get_int (value);
+               GST_INFO_OBJECT (evaspixmapsink, "ROI_X(%d)",evaspixmapsink->dst_roi.x );
+               break;
+       case PROP_DST_ROI_Y:
+               evaspixmapsink->dst_roi.y = g_value_get_int (value);
+               GST_INFO_OBJECT (evaspixmapsink, "ROI_Y(%d)",evaspixmapsink->dst_roi.y );
+               break;
+       case PROP_DST_ROI_W:
+               evaspixmapsink->dst_roi.w = g_value_get_int (value);
+               GST_INFO_OBJECT (evaspixmapsink, "ROI_W(%d)",evaspixmapsink->dst_roi.w );
+               break;
+       case PROP_DST_ROI_H:
+               evaspixmapsink->dst_roi.h = g_value_get_int (value);
+               GST_INFO_OBJECT (evaspixmapsink, "ROI_H(%d)",evaspixmapsink->dst_roi.h );
+               break;
+       case PROP_STOP_VIDEO:
+               evaspixmapsink->stop_video = g_value_get_int (value);
+               g_mutex_lock( evaspixmapsink->flow_lock );
+               if( evaspixmapsink->stop_video ) {
+                       GST_INFO_OBJECT (evaspixmapsink, "XPixmap CLEAR when set video-stop property" );
+                       int i = 0;
+                       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                               if (evaspixmapsink->xpixmap[i]) {
+                                       gst_evaspixmapsink_xpixmap_clear (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+                               }
+                       }
+               }
+               GST_INFO_OBJECT (evaspixmapsink, "video-stop property(%d)", evaspixmapsink->stop_video);
+
+               g_mutex_unlock( evaspixmapsink->flow_lock );
+               break;
+       case PROP_EVAS_OBJECT:
+       {
+               Evas_Object *eo = g_value_get_pointer (value);
+               if ( is_evas_image_object (eo)) {
+                       if (!evaspixmapsink->epipe) {
+                               evaspixmapsink->epipe = ecore_pipe_add (ecore_pipe_callback_handler, evaspixmapsink);
+                               if (!evaspixmapsink->epipe) {
+                                       GST_ERROR_OBJECT (evaspixmapsink,"Cannot set evas-object property: ecore_pipe_add() failed");
+                                       break;
+                               }
+                       }
+                       if (evaspixmapsink->eo == NULL) {
+                               evaspixmapsink->eo = eo;
+                               /* add evas object callbacks on a new evas image object */
+                               EVASPIXMAPSINK_SET_EVAS_OBJECT_EVENT_CALLBACK (eo, evaspixmapsink);
+                               if (GST_STATE(evaspixmapsink) < GST_STATE_PAUSED) {
+                                       GST_INFO_OBJECT (evaspixmapsink,"It's the first time the new evas image object(%x) is set, skip gst_evaspixmapsink_xpixmap_link()..", eo);
+                                       break;
+                               } else {
+                                       if (!gst_evaspixmapsink_xpixmap_link(evaspixmapsink)) {
+                                               GST_WARNING_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                                               evaspixmapsink->eo = NULL;
+                                               break;
+                                       }
+                               }
+                       }
+                       if (eo == evaspixmapsink->eo) {
+                               GST_LOG_OBJECT (evaspixmapsink,"new evas image object(%x) is same as the previous one(%x)", eo, evaspixmapsink->eo);
+                       } else {
+                               GST_INFO_OBJECT (evaspixmapsink,"new evas image object(%x), previous one(%x)", eo, evaspixmapsink->eo);
+                               /* delete evas object callbacks registrated on a former evas image object */
+                               EVASPIXMAPSINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK (evaspixmapsink->eo);
+                               evaspixmapsink->eo = eo;
+                               if (!gst_evaspixmapsink_xpixmap_link(evaspixmapsink)) {
+                                       GST_WARNING_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                                       evaspixmapsink->eo = NULL;
+                                       break;
+                               }
+                               /* add evas object callbacks on a new evas image object */
+                               EVASPIXMAPSINK_SET_EVAS_OBJECT_EVENT_CALLBACK (eo, evaspixmapsink);
+                       }
+                       GST_INFO_OBJECT (evaspixmapsink,"Evas image object(%x) is set", evaspixmapsink->eo);
+               } else {
+                       GST_ERROR_OBJECT (evaspixmapsink,"Cannot set evas-object property: value is not an evas image object");
+               }
+               break;
+       }
+       case PROP_FLIP:
+               evaspixmapsink->flip = g_value_get_enum(value);
+               break;
+       case PROP_ROTATE_ANGLE:
+               evaspixmapsink->rotate_angle = g_value_get_enum (value);
+               break;
+       case PROP_VISIBLE:
+       {
+               Eina_Bool r;
+               gboolean visible = g_value_get_boolean (value);
+               GST_INFO_OBJECT (evaspixmapsink,"evaspixmapsink->visible(%d), new value of visible(%d)", evaspixmapsink->visible, visible);
+               if (evaspixmapsink->visible != visible) {
+                       evaspixmapsink->visible = visible;
+                       if (evaspixmapsink->eo) {
+                               evaspixmapsink->update_visibility = UPDATE_TRUE;
+                               if (evaspixmapsink->epipe_request_count > EPIPE_REQUEST_LIMIT) {
+                                       GST_WARNING_OBJECT (evaspixmapsink,"skip ecore_pipe_write()", evaspixmapsink->epipe_request_count);
+                                       if (visible) {
+                                               evas_object_show(evaspixmapsink->eo);
+                                               GST_WARNING_OBJECT (evaspixmapsink, "object show (forcely)");
+                                       }
+                               } else {
+                                       r = ecore_pipe_write (evaspixmapsink->epipe, &evaspixmapsink->update_visibility, SIZE_FOR_UPDATE_VISIBILITY);
+                                       evaspixmapsink->epipe_request_count++;
+                               }
+                               if (r == EINA_FALSE)  {
+                                       GST_WARNING ("Failed to ecore_pipe_write() for updating visibility)\n");
+                               }
+                               if (!visible) {
+                                       int i = 0;
+                                       g_mutex_lock( evaspixmapsink->flow_lock );
+                                       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                                               if (evaspixmapsink->xpixmap[i]) {
+                                                       gst_evaspixmapsink_xpixmap_clear (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+                                               }
+                                       }
+                                       evas_object_hide(evaspixmapsink->eo);
+                                       GST_INFO_OBJECT (evaspixmapsink, "object hide (forcely)");
+                                       g_mutex_unlock( evaspixmapsink->flow_lock );
+                               } else {
+                                       gst_evaspixmap_buffer_put (evaspixmapsink, evaspixmapsink->evas_pixmap_buf);
+                               }
+                       } else {
+                               GST_WARNING_OBJECT (evaspixmapsink,"evas image object was not set");
+                       }
+               }
+               break;
+       }
+       case PROP_ORIGIN_SIZE:
+               evaspixmapsink->use_origin_size = g_value_get_boolean (value);
+               GST_INFO_OBJECT (evaspixmapsink,"set origin-size (%d)",evaspixmapsink->use_origin_size);
+               if (evaspixmapsink->previous_origin_size != evaspixmapsink->use_origin_size) {
+                       if (!gst_evaspixmapsink_xpixmap_link(evaspixmapsink)) {
+                               GST_WARNING_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                       }
+                       evaspixmapsink->previous_origin_size = evaspixmapsink->use_origin_size;
+               }
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gst_evaspixmapsink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (object));
+
+       evaspixmapsink = GST_EVASPIXMAPSINK (object);
+
+       switch (prop_id) {
+       case PROP_HUE:
+               g_value_set_int (value, evaspixmapsink->hue);
+               break;
+       case PROP_CONTRAST:
+               g_value_set_int (value, evaspixmapsink->contrast);
+               break;
+       case PROP_BRIGHTNESS:
+               g_value_set_int (value, evaspixmapsink->brightness);
+               break;
+       case PROP_SATURATION:
+               g_value_set_int (value, evaspixmapsink->saturation);
+               break;
+       case PROP_DISPLAY:
+               g_value_set_string (value, evaspixmapsink->display_name);
+               break;
+       case PROP_SYNCHRONOUS:
+               g_value_set_boolean (value, evaspixmapsink->synchronous);
+               break;
+       case PROP_PIXEL_ASPECT_RATIO:
+               if (evaspixmapsink->par) {
+                       if (!g_value_transform (evaspixmapsink->par, value)) {
+                               g_warning ("g_value_transform() failure");
+                       }
+               }
+               break;
+       case PROP_DEVICE:
+       {
+               char *adaptor_no_s = g_strdup_printf ("%u", evaspixmapsink->adaptor_no);
+               g_value_set_string (value, adaptor_no_s);
+               g_free (adaptor_no_s);
+               break;
+       }
+       case PROP_DEVICE_NAME:
+               if (evaspixmapsink->xcontext && evaspixmapsink->xcontext->adaptors) {
+                       g_value_set_string (value,
+                       evaspixmapsink->xcontext->adaptors[evaspixmapsink->adaptor_no]);
+               } else {
+                       g_value_set_string (value, NULL);
+               }
+               break;
+       case PROP_DOUBLE_BUFFER:
+               g_value_set_boolean (value, evaspixmapsink->double_buffer);
+               break;
+       case PROP_AUTOPAINT_COLORKEY:
+               g_value_set_boolean (value, evaspixmapsink->autopaint_colorkey);
+               break;
+       case PROP_COLORKEY:
+               g_value_set_int (value, evaspixmapsink->colorkey);
+               break;
+       case PROP_PIXMAP_WIDTH:
+       {
+               GST_LOG_OBJECT (evaspixmapsink, "Not supported");
+               break;
+       }
+       case PROP_PIXMAP_HEIGHT:
+       {
+               GST_LOG_OBJECT (evaspixmapsink, "Not supported");
+               break;
+       }
+       case PROP_DISPLAY_GEOMETRY_METHOD:
+               g_value_set_enum (value, evaspixmapsink->display_geometry_method);
+               break;
+       case PROP_DST_ROI_X:
+               g_value_set_int (value, evaspixmapsink->dst_roi.x);
+               break;
+       case PROP_DST_ROI_Y:
+               g_value_set_int (value, evaspixmapsink->dst_roi.y);
+               break;
+       case PROP_DST_ROI_W:
+               g_value_set_int (value, evaspixmapsink->dst_roi.w);
+               break;
+       case PROP_DST_ROI_H:
+               g_value_set_int (value, evaspixmapsink->dst_roi.h);
+               break;
+       case PROP_STOP_VIDEO:
+               g_value_set_int (value, evaspixmapsink->stop_video);
+               break;
+       case PROP_EVAS_OBJECT:
+               g_value_set_pointer (value, evaspixmapsink->eo);
+               break;
+       case PROP_FLIP:
+               g_value_set_enum(value, evaspixmapsink->flip);
+               break;
+       case PROP_ROTATE_ANGLE:
+               g_value_set_enum (value, evaspixmapsink->rotate_angle);
+               break;
+       case PROP_VISIBLE:
+               g_value_set_boolean (value, evaspixmapsink->visible);
+               break;
+       case PROP_ORIGIN_SIZE:
+               g_value_set_boolean (value, evaspixmapsink->use_origin_size);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+  }
+}
+
+static void
+gst_evaspixmapsink_reset (GstEvasPixmapSink *evaspixmapsink)
+{
+       GST_WARNING_OBJECT (evaspixmapsink,"[START]");
+
+       GThread *thread;
+       GST_OBJECT_LOCK (evaspixmapsink);
+       evaspixmapsink->running = FALSE;
+       int i = 0;
+
+       /* grab thread and mark it as NULL */
+       thread = evaspixmapsink->event_thread;
+       evaspixmapsink->event_thread = NULL;
+       GST_OBJECT_UNLOCK (evaspixmapsink);
+
+       /* Wait for our event thread to finish before we clean up our stuff. */
+       if (thread) {
+               g_thread_join (thread);
+       }
+
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               if(evaspixmapsink->damage[i]) {
+                       XDamageDestroy(evaspixmapsink->xcontext->disp, evaspixmapsink->damage[i]);
+                       evaspixmapsink->damage[i] = NULL;
+               }
+       }
+       EVASPIXMAPSINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK( evaspixmapsink->eo );
+
+       if (evaspixmapsink->evas_pixmap_buf) {
+               gst_buffer_unref (GST_BUFFER_CAST (evaspixmapsink->evas_pixmap_buf));
+               evaspixmapsink->evas_pixmap_buf = NULL;
+       }
+
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               gst_evaspixmapsink_xpixmap_clear (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+               gst_evaspixmapsink_xpixmap_destroy (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+               evaspixmapsink->xpixmap[i] = NULL;
+       }
+       if (evaspixmapsink->eo) {
+               evas_object_image_native_surface_set(evaspixmapsink->eo, NULL);
+               evaspixmapsink->eo = NULL;
+       }
+
+       evaspixmapsink->render_rect.x = evaspixmapsink->render_rect.y =
+       evaspixmapsink->render_rect.w = evaspixmapsink->render_rect.h = 0;
+       evaspixmapsink->have_render_rect = FALSE;
+
+       evaspixmapsink->epipe_request_count = 0;
+
+       gst_evaspixmapsink_xcontext_clear (evaspixmapsink);
+
+       GST_WARNING_OBJECT (evaspixmapsink,"[END]");
+}
+
+/* Finalize is called only once, dispose can be called multiple times.
+ * We use mutexes and don't reset stuff to NULL here so let's register
+ * as a finalize. */
+static void
+gst_evaspixmapsink_finalize (GObject *object)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+       evaspixmapsink = GST_EVASPIXMAPSINK (object);
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START]");
+
+       if (evaspixmapsink->display_name) {
+               g_free (evaspixmapsink->display_name);
+               evaspixmapsink->display_name = NULL;
+       }
+       if (evaspixmapsink->par) {
+               g_free (evaspixmapsink->par);
+               evaspixmapsink->par = NULL;
+       }
+       if (evaspixmapsink->x_lock) {
+               g_mutex_free (evaspixmapsink->x_lock);
+               evaspixmapsink->x_lock = NULL;
+       }
+       if (evaspixmapsink->flow_lock) {
+               g_mutex_free (evaspixmapsink->flow_lock);
+               evaspixmapsink->flow_lock = NULL;
+       }
+       if (evaspixmapsink->pixmap_ref_lock) {
+               g_mutex_free (evaspixmapsink->pixmap_ref_lock);
+               evaspixmapsink->pixmap_ref_lock = NULL;
+       }
+       if (evaspixmapsink->epipe) {
+               ecore_pipe_del (evaspixmapsink->epipe);
+               evaspixmapsink->epipe = NULL;
+       }
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+
+       G_OBJECT_CLASS (parent_class)->finalize (object);
+
+       MMTA_ACUM_ITEM_SHOW_RESULT_TO(MMTA_SHOW_FILE);
+       MMTA_RELEASE();
+}
+
+static void
+gst_evaspixmapsink_init (GstEvasPixmapSink *evaspixmapsink)
+{
+       int i = 0;
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START]");
+
+       evaspixmapsink->display_name = NULL;
+       evaspixmapsink->adaptor_no = 0;
+       evaspixmapsink->xcontext = NULL;
+
+       for (i = 0; i < NUM_OF_PIXMAP; i++) {
+               evaspixmapsink->xpixmap[i] = NULL;
+               evaspixmapsink->damage[i] = 0;
+       }
+
+       evaspixmapsink->evas_pixmap_buf = NULL;
+
+       evaspixmapsink->hue = evaspixmapsink->saturation = 0;
+       evaspixmapsink->contrast = evaspixmapsink->brightness = 0;
+       evaspixmapsink->cb_changed = FALSE;
+
+       evaspixmapsink->fps_n = 0;
+       evaspixmapsink->fps_d = 0;
+       evaspixmapsink->video_width = 0;
+       evaspixmapsink->video_height = 0;
+
+       evaspixmapsink->x_lock = g_mutex_new ();
+       evaspixmapsink->flow_lock = g_mutex_new ();
+       evaspixmapsink->pixmap_ref_lock = g_mutex_new();
+
+       evaspixmapsink->synchronous = FALSE;
+       evaspixmapsink->double_buffer = TRUE;
+       evaspixmapsink->par = NULL;
+       evaspixmapsink->autopaint_colorkey = TRUE;
+       evaspixmapsink->running = FALSE;
+
+       /* on 16bit displays this becomes r,g,b = 1,2,3
+       * on 24bit displays this becomes r,g,b = 8,8,16
+       * as a port atom value
+       */
+       evaspixmapsink->colorkey = (8 << 16) | (8 << 8) | 16;
+
+       evaspixmapsink->display_geometry_method = DEF_DISPLAY_GEOMETRY_METHOD;
+       evaspixmapsink->dst_roi.x = 0;
+       evaspixmapsink->dst_roi.y = 0;
+       evaspixmapsink->dst_roi.w = 0;
+       evaspixmapsink->dst_roi.h = 0;
+       evaspixmapsink->scr_w = 0;
+       evaspixmapsink->scr_h = 0;
+       evaspixmapsink->aligned_width = 0;
+       evaspixmapsink->aligned_height = 0;
+       evaspixmapsink->stop_video = FALSE;
+       evaspixmapsink->eo = NULL;
+       evaspixmapsink->epipe = NULL;
+       evaspixmapsink->epipe_request_count = 0;
+       evaspixmapsink->do_link = FALSE;
+       evaspixmapsink->flip = DEF_DISPLAY_FLIP;
+       evaspixmapsink->rotate_angle = DEGREE_0;
+       evaspixmapsink->visible = TRUE;
+       evaspixmapsink->update_visibility = UPDATE_FALSE;
+       evaspixmapsink->use_origin_size = FALSE;
+       evaspixmapsink->previous_origin_size = FALSE;
+
+       evaspixmapsink->num_of_pixmaps = NUM_OF_PIXMAP;
+
+       evaspixmapsink->buf_shared_type = BUF_SHARE_METHOD_NONE;
+
+       MMTA_INIT();
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+ }
+
+static void
+gst_evaspixmapsink_base_init (gpointer g_class)
+{
+  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details_simple (element_class,
+      "EvasPixmapSink", "Sink/Video",
+      "evas image object videosink based on Xv extension", "Sangchul Lee <sc11.lee@samsung.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_evaspixmapsink_sink_template_factory));
+}
+
+static void
+gst_evaspixmapsink_class_init (GstEvasPixmapSinkClass *klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+  GstBaseSinkClass *gstbasesink_class;
+  GstVideoSinkClass *videosink_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+  gstbasesink_class = (GstBaseSinkClass *) klass;
+  videosink_class = (GstVideoSinkClass *) klass;
+
+  parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class->set_property = gst_evaspixmapsink_set_property;
+  gobject_class->get_property = gst_evaspixmapsink_get_property;
+
+  g_object_class_install_property (gobject_class, PROP_CONTRAST,
+      g_param_spec_int ("contrast", "Contrast", "The contrast of the video",
+          -1000, 1000, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BRIGHTNESS,
+      g_param_spec_int ("brightness", "Brightness",
+          "The brightness of the video", -1000, 1000, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_HUE,
+      g_param_spec_int ("hue", "Hue", "The hue of the video", -1000, 1000, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_SATURATION,
+      g_param_spec_int ("saturation", "Saturation",
+          "The saturation of the video", -1000, 1000, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_DISPLAY,
+      g_param_spec_string ("display", "Display", "X Display name", NULL,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_SYNCHRONOUS,
+      g_param_spec_boolean ("synchronous", "Synchronous",
+          "When enabled, runs "
+          "the X display in synchronous mode. (used only for debugging)", FALSE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_PIXEL_ASPECT_RATIO,
+      g_param_spec_string ("pixel-aspect-ratio", "Pixel Aspect Ratio",
+          "The pixel aspect ratio of the device", "1/1",
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_DEVICE,
+      g_param_spec_string ("device", "Adaptor number",
+          "The number of the video adaptor", "0",
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
+      g_param_spec_string ("device-name", "Adaptor name",
+          "The name of the video adaptor", NULL,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:double-buffer
+   *
+   * Whether to double-buffer the output.
+   *
+   * Since: 0.10.14
+   */
+  g_object_class_install_property (gobject_class, PROP_DOUBLE_BUFFER,
+      g_param_spec_boolean ("double-buffer", "Double-buffer",
+          "Whether to double-buffer the output", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstEvasPixmapSink:autopaint-colorkey
+   *
+   * Whether to autofill overlay with colorkey
+   *
+   * Since: 0.10.21
+   */
+  g_object_class_install_property (gobject_class, PROP_AUTOPAINT_COLORKEY,
+      g_param_spec_boolean ("autopaint-colorkey", "Autofill with colorkey",
+          "Whether to autofill overlay with colorkey", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstEvasPixmapSink:colorkey
+   *
+   * Color to use for the overlay mask.
+   *
+   * Since: 0.10.21
+   */
+  g_object_class_install_property (gobject_class, PROP_COLORKEY,
+      g_param_spec_int ("colorkey", "Colorkey",
+          "Color to use for the overlay mask", G_MININT, G_MAXINT, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:pixmap-width
+   *
+   * Actual width of the pixmap.
+   */
+  g_object_class_install_property (gobject_class, PROP_PIXMAP_WIDTH,
+      g_param_spec_uint64 ("pixmap-width", "pixmap-width", "Width of the pixmap", 0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:pixmap-height
+   *
+   * Actual height of the pixmap.
+   */
+  g_object_class_install_property (gobject_class, PROP_PIXMAP_HEIGHT,
+      g_param_spec_uint64 ("pixmap-height", "pixmap-height", "Height of the pixmap", 0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:display-geometry-method
+   *
+   * Display geometrical method setting
+   */
+  g_object_class_install_property(gobject_class, PROP_DISPLAY_GEOMETRY_METHOD,
+    g_param_spec_enum("display-geometry-method", "Display geometry method",
+      "Geometrical method for display",
+      GST_TYPE_EVASPIXMAPSINK_DISPLAY_GEOMETRY_METHOD, DEF_DISPLAY_GEOMETRY_METHOD,
+      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:dst-roi-x
+   *
+   * X value of Destination ROI
+   */
+  g_object_class_install_property (gobject_class, PROP_DST_ROI_X,
+      g_param_spec_int ("dst-roi-x", "Dst-ROI-X",
+          "X value of Destination ROI(only effective \"CUSTOM_ROI\")", 0, XV_SCREEN_SIZE_WIDTH, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:dst-roi-y
+   *
+   * Y value of Destination ROI
+   */
+  g_object_class_install_property (gobject_class, PROP_DST_ROI_Y,
+      g_param_spec_int ("dst-roi-y", "Dst-ROI-Y",
+          "Y value of Destination ROI(only effective \"CUSTOM_ROI\")", 0, XV_SCREEN_SIZE_HEIGHT, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:dst-roi-w
+   *
+   * W value of Destination ROI
+   */
+  g_object_class_install_property (gobject_class, PROP_DST_ROI_W,
+      g_param_spec_int ("dst-roi-w", "Dst-ROI-W",
+          "W value of Destination ROI(only effective \"CUSTOM_ROI\")", 0, XV_SCREEN_SIZE_WIDTH, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:dst-roi-h
+   *
+   * H value of Destination ROI
+   */
+  g_object_class_install_property (gobject_class, PROP_DST_ROI_H,
+      g_param_spec_int ("dst-roi-h", "Dst-ROI-H",
+          "H value of Destination ROI(only effective \"CUSTOM_ROI\")", 0, XV_SCREEN_SIZE_HEIGHT, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:stop-video
+   *
+   * Stop video for releasing video source buffer
+   */
+  g_object_class_install_property (gobject_class, PROP_STOP_VIDEO,
+      g_param_spec_int ("stop-video", "Stop-Video", "Stop video for releasing video source buffer", 0, 1, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:evas-object
+   *
+   * Evas image object for rendering
+   */
+  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));
+
+  /**
+   * GstEvasPixmapSink:display-flip
+   *
+   * Display flip setting
+   */
+  g_object_class_install_property(gobject_class, PROP_FLIP,
+    g_param_spec_enum("flip", "Display flip",
+      "Flip for display",
+      GST_TYPE_EVASPIXMAPSINK_FLIP, DEF_DISPLAY_FLIP,
+      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:rotate
+   *
+   * draw rotation angle setting
+   */
+  g_object_class_install_property(gobject_class, PROP_ROTATE_ANGLE,
+    g_param_spec_enum("rotate", "Rotate angle", "Rotate angle of display output",GST_TYPE_EVASPIXMAPSINK_ROTATE_ANGLE, DEGREE_0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:visible
+   *
+   * visible setting for a evas image object
+   */
+  g_object_class_install_property (gobject_class, PROP_VISIBLE,
+       g_param_spec_boolean ("visible", "Visible", "When setting it false, evas image object does not show", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+   /**
+   * GstEvasPixmapSink:origin-size
+   *
+   * Set pixmap size with media source's width and height
+   */
+  g_object_class_install_property (gobject_class, PROP_ORIGIN_SIZE,
+       g_param_spec_boolean ("origin-size", "Origin-Size", "When setting it true, pixmap will be created with media source's width and height", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gobject_class->finalize = gst_evaspixmapsink_finalize;
+
+  gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_change_state);
+  gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_getcaps);
+  gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_setcaps);
+  gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_get_times);
+  gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_event);
+  videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_show_frame);
+}
+
+/* Object typing & Creation */
+GType
+gst_evaspixmapsink_get_type (void)
+{
+  static GType evaspixmapsink_type = 0;
+
+  if (!evaspixmapsink_type) {
+    static const GTypeInfo evaspixmapsink_info = {
+      sizeof (GstEvasPixmapSinkClass),
+      gst_evaspixmapsink_base_init,
+      NULL,
+      (GClassInitFunc) gst_evaspixmapsink_class_init,
+      NULL,
+      NULL,
+      sizeof (GstEvasPixmapSink),
+      0,
+      (GInstanceInitFunc) gst_evaspixmapsink_init,
+    };
+    static const GInterfaceInfo iface_info = {
+      (GInterfaceInitFunc) gst_evaspixmapsink_interface_init,
+      NULL,
+      NULL,
+    };
+    static const GInterfaceInfo navigation_info = {
+      (GInterfaceInitFunc) gst_evaspixmapsink_navigation_init,
+      NULL,
+      NULL,
+    };
+    static const GInterfaceInfo colorbalance_info = {
+      (GInterfaceInitFunc) gst_evaspixmapsink_colorbalance_init,
+      NULL,
+      NULL,
+    };
+    static const GInterfaceInfo propertyprobe_info = {
+      (GInterfaceInitFunc) gst_evaspixmapsink_property_probe_interface_init,
+      NULL,
+      NULL,
+    };
+    evaspixmapsink_type = g_type_register_static (GST_TYPE_VIDEO_SINK, "GstEvasPixmapSink", &evaspixmapsink_info, 0);
+
+    g_type_add_interface_static (evaspixmapsink_type, GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
+    g_type_add_interface_static (evaspixmapsink_type, GST_TYPE_NAVIGATION, &navigation_info);
+    g_type_add_interface_static (evaspixmapsink_type, GST_TYPE_COLOR_BALANCE, &colorbalance_info);
+    g_type_add_interface_static (evaspixmapsink_type, GST_TYPE_PROPERTY_PROBE, &propertyprobe_info);
+
+    /* register type and create class in a more safe place instead of at
+     * runtime since the type registration and class creation is not
+     * threadsafe. */
+    g_type_class_ref (gst_evaspixmap_buffer_get_type ());
+  }
+
+  return evaspixmapsink_type;
+}
+
+static gboolean
+plugin_init (GstPlugin *plugin)
+{
+       if (!gst_element_register (plugin, "evaspixmapsink", GST_RANK_NONE, GST_TYPE_EVASPIXMAPSINK)) {
+               return FALSE;
+       }
+       GST_DEBUG_CATEGORY_INIT (gst_debug_evaspixmapsink, "evaspixmapsink", 0, "evaspixmapsink element");
+       GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
+
+       return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
+       "evaspixmapsink","Evas image object render plugin using Xv extension", plugin_init,
+       VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/mobile/evaspixmapsink/evaspixmapsink.h b/mobile/evaspixmapsink/evaspixmapsink.h
new file mode 100644 (file)
index 0000000..9bbacca
--- /dev/null
@@ -0,0 +1,404 @@
+/*
+ * EvasPixmapSink
+ *
+ * Copyright (c) 2000 - 2012 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_EVASPIXMAPSINK_H__
+#define __GST_EVASPIXMAPSINK_H__
+
+#include <gst/video/gstvideosink.h>
+#include <mm_ta.h>
+
+#ifdef HAVE_XSHM
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif /* HAVE_XSHM */
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#ifdef HAVE_XSHM
+#include <X11/extensions/XShm.h>
+#endif /* HAVE_XSHM */
+
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvlib.h>
+#include <X11/extensions/Xdamage.h>
+#include <X11/extensions/damagewire.h>
+#include <X11/Xatom.h>
+#include <stdio.h>
+
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_X.h>
+
+#include <tbm_bufmgr.h>
+
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+
+#define MAX_PLANE_NUM          3
+#define MAX_BUFFER_NUM         20
+#define MAX_GEM_BUFFER_NUM     (MAX_PLANE_NUM * MAX_BUFFER_NUM)
+typedef struct _gem_info_t {
+       int dmabuf_fd;
+       unsigned int gem_handle;
+       unsigned int gem_name;
+       tbm_bo bo;
+       Pixmap ref_pixmap;
+} gem_info_t;
+
+typedef enum {
+       BUF_SHARE_METHOD_NONE = -1,
+       BUF_SHARE_METHOD_PADDR = 0,
+       BUF_SHARE_METHOD_FD,
+       BUF_SHARE_METHOD_TIZEN_BUFFER
+} buf_share_method_t;
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_EVASPIXMAPSINK \
+  (gst_evaspixmapsink_get_type())
+#define GST_EVASPIXMAPSINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_EVASPIXMAPSINK, GstEvasPixmapSink))
+#define GST_EVASPIXMAPSINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_EVASPIXMAPSINK, GstEvasPixmapSinkClass))
+#define GST_IS_EVASPIXMAPSINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_EVASPIXMAPSINK))
+#define GST_IS_EVASPIXMAPSINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_EVASPIXMAPSINK))
+
+#define XV_SCREEN_SIZE_WIDTH  4096
+#define XV_SCREEN_SIZE_HEIGHT 4096
+
+#define MARGIN_OF_ERROR       0.005
+#define NUM_OF_PIXMAP         3
+
+typedef struct _GstXContext GstXContext;
+typedef struct _GstXPixmap GstXPixmap;
+typedef struct _GstEvasPixmapFormat GstEvasPixmapFormat;
+typedef struct _GstEvasPixmapBuffer GstEvasPixmapBuffer;
+typedef struct _GstEvasPixmapBufferClass GstEvasPixmapBufferClass;
+typedef struct _GstEvasPixmapSink GstEvasPixmapSink;
+typedef struct _GstEvasPixmapSinkClass GstEvasPixmapSinkClass;
+
+/*
+ * GstXContext:
+ * @disp: the X11 Display of this context
+ * @screen: the default Screen of Display @disp
+ * @screen_num: the Screen number of @screen
+ * @visual: the default Visual of Screen @screen
+ * @root: the root Window of Display @disp
+ * @white: the value of a white pixel on Screen @screen
+ * @black: the value of a black pixel on Screen @screen
+ * @depth: the color depth of Display @disp
+ * @bpp: the number of bits per pixel on Display @disp
+ * @endianness: the endianness of image bytes on Display @disp
+ * @width: the width in pixels of Display @disp
+ * @height: the height in pixels of Display @disp
+ * @widthmm: the width in millimeters of Display @disp
+ * @heightmm: the height in millimeters of Display @disp
+ * @par: the pixel aspect ratio calculated from @width, @widthmm and @height,
+ * @heightmm ratio
+ * @use_xshm: used to known wether of not XShm extension is usable or not even
+ * if the Extension is present
+ * @xv_port_id: the XVideo port ID
+ * @im_format: used to store at least a valid format for XShm calls checks
+ * @formats_list: list of supported image formats on @xv_port_id
+ * @channels_list: list of #GstColorBalanceChannels
+ * @caps: the #GstCaps that Display @disp can accept
+ *
+ * Structure used to store various informations collected/calculated for a
+ * Display.
+ */
+struct _GstXContext {
+       Display *disp;
+
+       Screen *screen;
+       gint screen_num;
+
+       Visual *visual;
+
+       Window root;
+
+       gulong white, black;
+
+       gint depth;
+       gint bpp;
+       gint endianness;
+
+       gint width, height;
+       gint widthmm, heightmm;
+       GValue *par;                  /* calculated pixel aspect ratio */
+
+       gboolean use_xshm;
+
+       XvPortID xv_port_id;
+       guint nb_adaptors;
+       gchar ** adaptors;
+       gint im_format;
+
+       GList *formats_list;
+       GList *channels_list;
+
+       GstCaps *caps;
+};
+
+/*
+ * GstXPixmap:
+ * @pixmap: the pixmap ID of this X11 pixmap
+ * @width: the width in pixels of Pixmap @pixmap
+ * @height: the height in pixels of Pixmap @pixmap
+ * @gc: the Graphical Context of Pixmap @pixmap
+ *
+ * Structure used to store informations about a Pixmap.
+ */
+struct _GstXPixmap {
+       Pixmap pixmap;
+       gint x, y;
+       gint width, height;
+       GC gc;
+       guint ref;
+       gint damaged_time;
+       Pixmap prev_pixmap;
+       GC prev_gc;
+};
+
+/**
+ * GstEvasPixmapFormat:
+ * @format: the image format
+ * @caps: generated #GstCaps for this image format
+ *
+ * Structure storing image format to #GstCaps association.
+ */
+struct _GstEvasPixmapFormat {
+       gint format;
+       GstCaps *caps;
+};
+
+/**
+ * GstEvasPixmapBuffer:
+ * @evaspixmapsink: a reference to our #GstEvasPixmapSink
+ * @xvimage: the XvImage of this buffer
+ * @width: the width in pixels of XvImage @xvimage
+ * @height: the height in pixels of XvImage @xvimage
+ * @im_format: the image format of XvImage @xvimage
+ * @size: the size in bytes of XvImage @xvimage
+ *
+ * Subclass of #GstBuffer containing additional information about an XvImage.
+ */
+struct _GstEvasPixmapBuffer {
+       GstBuffer buffer;
+
+       /* Reference to the evaspixmapsink we belong to */
+       GstEvasPixmapSink *evaspixmapsink;
+       XvImage *xvimage;
+
+#ifdef HAVE_XSHM
+       XShmSegmentInfo SHMInfo;
+#endif /* HAVE_XSHM */
+
+       gint width, height;
+       gint im_format;
+       size_t size;
+};
+
+/**
+ * GstEvasPixmapSink:
+ * @display_name: the name of the Display we want to render to
+ * @xcontext: our instance's #GstXContext
+ * @xpixmap: the #GstXPixmap we are rendering to
+ * @fps_n: the framerate fraction numerator
+ * @fps_d: the framerate fraction denominator
+ * @x_lock: used to protect X calls as we are not using the XLib in threaded
+ * mode
+ * @flow_lock: used to protect data flow routines from external calls such as
+ * methods from the #GstXOverlay interface
+ * @par: used to override calculated pixel aspect ratio from @xcontext
+ * @synchronous: used to store if XSynchronous should be used or not (for
+ * debugging purpose only)
+ * @keep_aspect: used to remember if reverse negotiation scaling should respect
+ * aspect ratio
+ * @brightness: used to store the user settings for color balance brightness
+ * @contrast: used to store the user settings for color balance contrast
+ * @hue: used to store the user settings for color balance hue
+ * @saturation: used to store the user settings for color balance saturation
+ * @cb_changed: used to store if the color balance settings where changed
+ * @video_width: the width of incoming video frames in pixels
+ * @video_height: the height of incoming video frames in pixels
+ *
+ * The #GstEvasPixmapSink data structure.
+ */
+struct _GstEvasPixmapSink {
+       /* Our element stuff */
+       GstVideoSink videosink;
+
+       char *display_name;
+       guint adaptor_no;
+
+       GstXContext *xcontext;
+       GstXPixmap *xpixmap[NUM_OF_PIXMAP];
+       GstEvasPixmapBuffer *evas_pixmap_buf;
+
+       GThread *event_thread;
+       gboolean running;
+
+       gint fps_n;
+       gint fps_d;
+
+       GMutex *x_lock;
+       GMutex *flow_lock;
+       GMutex *pixmap_ref_lock;
+
+       /* object-set pixel aspect ratio */
+       GValue *par;
+
+       gboolean synchronous;
+       gboolean double_buffer;
+
+       gint brightness;
+       gint contrast;
+       gint hue;
+       gint saturation;
+       gboolean cb_changed;
+
+       /* size of incoming video, used as the size for XvImage */
+       guint video_width, video_height;
+
+       /* display sizes, used for clipping the image */
+       gint disp_x, disp_y;
+       gint disp_width, disp_height;
+
+       /* port attributes */
+       gboolean autopaint_colorkey;
+       gint colorkey;
+
+       /* port features */
+       gboolean have_autopaint_colorkey;
+       gboolean have_colorkey;
+       gboolean have_double_buffer;
+
+       /* target video rectagle */
+       GstVideoRectangle render_rect;
+       gboolean have_render_rect;
+
+       /* display */
+       guint flip;
+       guint rotate_angle;
+       guint display_geometry_method;
+       GstVideoRectangle dst_roi;
+       guint scr_w, scr_h;
+       /* needed if fourcc is one if S series */
+       guint aligned_width;
+       guint aligned_height;
+
+       gboolean stop_video;
+       buf_share_method_t buf_shared_type;
+
+       /* ecore & evas object */
+       Ecore_Pipe *epipe;
+       Evas_Object *eo;
+       Evas_Coord w;
+       Evas_Coord h;
+       gboolean visible;
+       gint last_updated_idx;
+       gchar update_visibility;
+       guint epipe_request_count;
+
+       /* pixmap */
+       gboolean do_link;
+       gboolean use_origin_size;
+       gboolean previous_origin_size;
+       gint sizediff_width;
+       gint sizediff_height;
+       guint num_of_pixmaps;
+
+       /* damage event */
+       Damage damage[NUM_OF_PIXMAP];
+       Damage prev_damage[NUM_OF_PIXMAP];
+       int damage_case;
+
+       gint drm_fd;
+       gem_info_t gem_info[MAX_GEM_BUFFER_NUM];
+};
+
+/* max plane count *********************************************************/
+#define MPLANE_IMGB_MAX_COUNT         (4)
+
+/* image buffer definition ***************************************************
+
+    +------------------------------------------+ ---
+    |                                          |  ^
+    |     uaddr[], index[]                     |  |
+    |     +---------------------------+ ---    |  |
+    |     |                           |  ^     |  |
+    |     |<-------- width[] -------->|  |     |  |
+    |     |                           |  |     |  |
+    |     |                           |        |
+    |     |                           |height[]|elevation[]
+    |     |                           |        |
+    |     |                           |  |     |  |
+    |     |                           |  |     |  |
+    |     |                           |  v     |  |
+    |     +---------------------------+ ---    |  |
+    |                                          |  v
+    +------------------------------------------+ ---
+
+    |<----------------- stride[] ------------------>|
+*/
+typedef struct _GstMultiPlaneImageBuffer GstMultiPlaneImageBuffer;
+struct _GstMultiPlaneImageBuffer
+{
+    GstBuffer buffer;
+
+    /* width of each image plane */
+    gint      width[MPLANE_IMGB_MAX_COUNT];
+    /* height of each image plane */
+    gint      height[MPLANE_IMGB_MAX_COUNT];
+    /* stride of each image plane */
+    gint      stride[MPLANE_IMGB_MAX_COUNT];
+    /* elevation of each image plane */
+    gint      elevation[MPLANE_IMGB_MAX_COUNT];
+    /* user space address of each image plane */
+    gpointer uaddr[MPLANE_IMGB_MAX_COUNT];
+    /* Index of real address of each image plane, if needs */
+    gpointer index[MPLANE_IMGB_MAX_COUNT];
+    /* left postion, if needs */
+    gint      x;
+    /* top position, if needs */
+    gint      y;
+    /* to align memory */
+    gint      __dummy2;
+    /* arbitrary data */
+    gint      data[16];
+};
+
+struct _GstEvasPixmapSinkClass {
+  GstVideoSinkClass parent_class;
+};
+
+GType gst_evaspixmapsink_get_type(void);
+
+G_END_DECLS
+
+#endif /* __GST_EVASPIXMAPSINK_H__ */
diff --git a/mobile/evaspixmapsink/xv_types.h b/mobile/evaspixmapsink/xv_types.h
new file mode 100644 (file)
index 0000000..8266e34
--- /dev/null
@@ -0,0 +1,101 @@
+/**************************************************************************
+
+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_TYPE_H__
+#define __XV_TYPE_H__
+
+#define XV_DATA_HEADER 0xDEADCD01
+#define XV_DATA_VERSION        0x00010001
+
+/* Return Values */
+#define XV_OK 0
+#define XV_HEADER_ERROR -1
+#define XV_VERSION_MISMATCH -2
+
+/* Video Mode */
+#define DISPLAY_MODE_DEFAULT                                      0
+#define DISPLAY_MODE_PRI_VIDEO_ON_AND_SEC_VIDEO_FULL_SCREEN       1
+#define DISPLAY_MODE_PRI_VIDEO_OFF_AND_SEC_VIDEO_FULL_SCREEN      2
+
+/* Color space range */
+#define CSC_RANGE_NARROW        0
+#define CSC_RANGE_WIDE          1
+
+/* Buffer Type */
+#define XV_BUF_TYPE_DMABUF  0
+#define XV_BUF_TYPE_LEGACY  1
+#define XV_BUF_PLANE_NUM    3
+
+/* 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;
+    unsigned int dmabuf_fd[XV_BUF_PLANE_NUM];
+    unsigned int gem_handle[XV_BUF_PLANE_NUM];
+    void *bo[XV_BUF_PLANE_NUM];
+} XV_DATA, * XV_DATA_PTR;
+
+static void
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_INIT_DATA (XV_DATA_PTR data)
+{
+    data->_header = XV_DATA_HEADER;
+    data->_version = XV_DATA_VERSION;
+}
+
+static int
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_VALIDATE_DATA (XV_DATA_PTR data)
+{
+    if (data->_header != XV_DATA_HEADER)
+        return XV_HEADER_ERROR;
+    if (data->_version != XV_DATA_VERSION)
+        return XV_VERSION_MISMATCH;
+    return XV_OK;
+}
+
+#endif
diff --git a/mobile/gst-autogen.sh b/mobile/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/mobile/gst-plugins-ext0.10.manifest b/mobile/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/mobile/m4/Makefile.am b/mobile/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/mobile/m4/as-compiler-flag.m4 b/mobile/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/mobile/m4/as-version.m4 b/mobile/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/mobile/pdpushsrc/Makefile.am b/mobile/pdpushsrc/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/mobile/pdpushsrc/src/Makefile.am b/mobile/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/mobile/pdpushsrc/src/gstpdpushsrc.c b/mobile/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/mobile/pdpushsrc/src/gstpdpushsrc.h b/mobile/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/mobile/toggle/Makefile.am b/mobile/toggle/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/mobile/toggle/src/Makefile.am b/mobile/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/mobile/toggle/src/gsttoggle.c b/mobile/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/mobile/toggle/src/gsttoggle.h b/mobile/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/mobile/xvimagesrc/Makefile.am b/mobile/xvimagesrc/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/mobile/xvimagesrc/src/Makefile.am b/mobile/xvimagesrc/src/Makefile.am
new file mode 100644 (file)
index 0000000..7fb9ec7
--- /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) $(TBM_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) $(TBM_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/mobile/xvimagesrc/src/gstxvimagesrc.c b/mobile/xvimagesrc/src/gstxvimagesrc.c
new file mode 100644 (file)
index 0000000..21688bf
--- /dev/null
@@ -0,0 +1,1527 @@
+/*
+ * 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                10
+
+#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;
+  /* Y plane size in case of ST12 */
+  int y_size;
+  /* UV plane size in case of ST12 */
+  int uv_size;
+
+  /* Tizen buffer object of each image plane */
+  void *bo[SCMN_IMGB_MAX_PLANE];
+
+  /* JPEG data */
+  void *jpeg_data;
+  /* JPEG size */
+  int jpeg_size;
+
+  /* tzmem buffer */
+  int tz_enable;
+} 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;
+
+typedef struct GstXvImageOutBuffer GstXvImageOutBuffer;
+
+struct GstXvImageOutBuffer {
+  GstBuffer buffer;
+  int fd_name;
+  int YBuf;
+  GstXVImageSrc * xvimagesrc;
+};
+
+
+
+#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;
+
+#define HANDLE_OUTBUF_UNREF
+
+#ifdef HANDLE_OUTBUF_UNREF
+#define BUFFER_COND_WAIT_TIMEOUT            1000000
+#define GST_TYPE_GST_XV_IMAGE_OUT_BUFFER               (gst_xv_image_out_buffer_get_type())
+#define GST_IS_GST_XV_IMAGE_OUT_BUFFER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_GST_XV_IMAGE_OUT_BUFFER))
+static GstBufferClass *gst_xv_image_out_buffer_parent_class = NULL;
+static void gst_xv_image_out_buffer_class_init(gpointer g_class, gpointer class_data);
+static void gst_xv_image_out_buffer_finalize(GstXvImageOutBuffer *buffer);
+static GstXvImageOutBuffer *gst_xv_image_out_buffer_new(GstXVImageSrc *src);
+#endif
+static GstStateChangeReturn gst_xv_image_src_change_state (GstElement * element, GstStateChange transition);
+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 tbm_bufmgr bufmgr_get (Display *dpy, Pixmap pixmap);
+static int port_get (GstXVImageSrc * src, unsigned int id);
+static void pixmap_update (GstXVImageSrc * src,Display *dpy, tbm_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, long 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);
+
+#ifdef HANDLE_OUTBUF_UNREF
+static void gst_xv_image_out_buffer_class_init(gpointer g_class, gpointer class_data)
+{
+  GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS(g_class);
+  gst_xv_image_out_buffer_parent_class = g_type_class_peek_parent(g_class);
+  mini_object_class->finalize = (GstMiniObjectFinalizeFunction)gst_xv_image_out_buffer_finalize;
+}
+
+static GType gst_xv_image_out_buffer_get_type(void)
+{
+  static GType _gst_gst_xv_image_out_buffer_type;
+
+  if (G_UNLIKELY(_gst_gst_xv_image_out_buffer_type == 0)) {
+    static const GTypeInfo gst_xv_image_out_buffer_info = {
+      sizeof (GstBufferClass),
+      NULL,
+      NULL,
+      gst_xv_image_out_buffer_class_init,
+      NULL,
+      NULL,
+      sizeof (GstXvImageOutBuffer),
+      0,
+      NULL,
+      NULL
+    };
+    _gst_gst_xv_image_out_buffer_type = g_type_register_static(GST_TYPE_BUFFER,
+                                                        "GstOmxOutBuffer",
+                                                        &gst_xv_image_out_buffer_info, 0);
+  }
+  return _gst_gst_xv_image_out_buffer_type;
+}
+#ifdef DEBUG_BUFFER
+ int value[5] ={0};
+ static int value_count =0;
+#endif
+
+static GstStateChangeReturn
+gst_xv_image_src_change_state (GstElement * element, GstStateChange transition)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (element);
+
+  GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE;
+  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:
+    src->pause_cond_var = FALSE;
+    g_cond_signal(src->pause_cond);
+    break;
+  case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+    src->pause_cond_var = TRUE;
+    break;
+  case GST_STATE_CHANGE_PAUSED_TO_READY:
+    src->thread_return = TRUE;
+    g_cond_signal(src->pause_cond);
+    g_cond_signal(src->queue_cond);
+    break;
+  case GST_STATE_CHANGE_READY_TO_NULL:
+    break;
+  default :
+    break;
+  }
+  result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  return result;
+}
+
+
+static void gst_xv_image_out_buffer_finalize(GstXvImageOutBuffer *buffer)
+{
+  Atom atom_retbuf = 0;
+  g_mutex_lock (buffer->xvimagesrc->dpy_lock);
+  atom_retbuf = XInternAtom (buffer->xvimagesrc->dpy, "_USER_WM_PORT_ATTRIBUTE_RETURN_BUFFER", False);
+  XvSetPortAttribute (buffer->xvimagesrc->dpy, buffer->xvimagesrc->p, atom_retbuf, buffer->YBuf);  //data->YBuf is gemname, refer to drm_convert_gem_to_fd
+  g_mutex_unlock (buffer->xvimagesrc->dpy_lock);
+  g_cond_signal(buffer->xvimagesrc->buffer_cond);
+  GST_INFO(" xvimagesrc = %p, gem_name =%d, fd_name =%d", buffer->xvimagesrc, buffer->YBuf, buffer->fd_name);
+#ifdef DEBUG_BUFFER
+ int i = 0;
+ for(i=0 ; i<5; i++){
+   if (value[i] == buffer->YBuf) {
+     value[i]=0;
+     GST_ERROR("value[%d]=%d", i, value[i]);
+   }
+ }
+#endif
+  return;
+}
+
+
+static GstXvImageOutBuffer *gst_xv_image_out_buffer_new(GstXVImageSrc *src)
+{
+  GstXvImageOutBuffer *newbuf = NULL;
+  GST_LOG("gst_omx_out_buffer_new");
+
+  newbuf = (GstXvImageOutBuffer *)gst_mini_object_new(GST_TYPE_GST_XV_IMAGE_OUT_BUFFER);
+  if(!newbuf)
+  {
+    GST_ERROR("gst_omx_out_buffer_new out of memory");
+    return NULL;
+  }
+  GST_LOG("creating buffer : %p", newbuf);
+  newbuf->xvimagesrc = gst_object_ref(GST_OBJECT(src));
+  newbuf->fd_name = 0;
+  newbuf->YBuf =0;
+  return newbuf;
+}
+#endif
+
+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;
+  GstElementClass *gstelement_class;
+  gobject_class = G_OBJECT_CLASS (klass);
+  gstelement_class = (GstElementClass *) 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);
+  gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_xv_image_src_change_state);
+
+  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->buffer_cond = g_cond_new ();
+  src->buffer_cond_lock = g_mutex_new ();
+  src->pause_cond = g_cond_new ();
+  src->pause_cond_lock = g_mutex_new ();
+  src->dpy_lock = g_mutex_new ();
+  src->pause_cond_var = FALSE;
+  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;
+  src->tz_enable = 0;
+  drm_init(src);
+  gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
+}
+
+static void
+gst_xv_image_src_finalize (GObject * gobject)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (gobject);
+  GST_DEBUG_OBJECT (src, "finalize");
+  g_mutex_free (src->queue_lock);
+  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];
+  } else if (name == xv_gem_mmap->name[6]) {
+    *virtual_address = xv_gem_mmap->address[6];
+     fd = xv_gem_mmap->fd[6];
+  } else if (name == xv_gem_mmap->name[7]) {
+    *virtual_address = xv_gem_mmap->address[7];
+     fd = xv_gem_mmap->fd[7];
+  } else if ( name == xv_gem_mmap->name[8]) {
+    *virtual_address = xv_gem_mmap->address[8];
+     fd = xv_gem_mmap->fd[8];
+  } else if (name == xv_gem_mmap->name[9]) {
+    *virtual_address = xv_gem_mmap->address[9];
+     fd = xv_gem_mmap->fd[9];
+  }
+
+  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;
+  GstClock *clock;
+  if (!src || !buffer) {
+    GST_WARNING("Invalid pointer [handle:%p, buffer:%p]", src, buffer);
+    return FALSE;
+  }
+  clock = gst_element_get_clock (GST_ELEMENT (src));
+  if (clock) {
+    timestamp = gst_clock_get_time (clock);
+    timestamp -= gst_element_get_base_time (GST_ELEMENT (src));
+    gst_object_unref (clock);
+  } else {
+    /* not an error not to have a clock */
+    timestamp = GST_CLOCK_TIME_NONE;
+  }
+
+  //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, long duration)
+{
+    GST_INFO("end_time duration=%d", duration);
+    if (duration < 0) return;
+    GstXVImageSrc *src = (GstXVImageSrc *)asrc;
+    g_return_if_fail(src != NULL);
+    long sleep_time = 0;
+    sleep_time = (long)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 <= (long)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) {
+          GST_INFO("end_time : sleep_time = %d", sleep_time);
+          usleep(sleep_time);
+       }
+    }
+}
+static GstFlowReturn
+gst_xv_image_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
+{
+  GST_INFO("gst_xv_image_src_create");
+  GstXVImageSrc *src;
+  GstXvImageOutBuffer *outbuf = NULL;
+  src = GST_XV_IMAGE_SRC (psrc);
+  g_mutex_lock (src->queue_lock);
+  if(g_queue_is_empty (src->queue)) {
+    GST_INFO("g_queue_is_empty");
+    g_mutex_unlock (src->queue_lock);
+    GST_INFO("g_cond_wait");
+    g_cond_wait(src->queue_cond, src->cond_lock);
+    if(src->pause_cond_var) return GST_FLOW_WRONG_STATE;
+    g_mutex_lock (src->queue_lock);
+    outbuf = (GstXvImageOutBuffer *)g_queue_pop_head(src->queue);
+    GST_INFO("g_queue_pop_head");
+    g_mutex_unlock (src->queue_lock);
+  }
+  else {
+    GstXvImageOutBuffer *tempbuf = NULL;
+    while((tempbuf = (GstXvImageOutBuffer*)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);
+    }
+    GST_INFO("g_queue_pop_head end");
+  }
+  if(outbuf == NULL) return GST_FLOW_ERROR;
+  GST_INFO("gem_name=%d, fd_name=%d, Time stamp of the buffer is %"GST_TIME_FORMAT, outbuf->YBuf, outbuf->fd_name, 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
+  GST_INFO("return ok");
+  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;
+  Atom atom_data_type = 0;
+  Atom atom_secure = 0, atom_capture=0;
+  Atom atom_fps = 0;
+  g_return_val_if_fail((src != NULL),NULL);
+
+  struct drm_gem_close gem_close;
+  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, 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);
+    atom_capture = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_CAPTURE", False);
+    atom_secure = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_SECURE", 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);
+
+    /*get data type*/
+    atom_data_type = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_DATA_TYPE", False);
+    XvSelectPortNotify (src->dpy, src->p, 1);
+    XvGetPortAttribute (src->dpy, src->p, atom_data_type, &(src->new_data_type));
+#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
+  }
+
+  struct timeval start_time, end_time;
+  long duration;
+  long starttime, endtime;
+  GTimeVal timeout;
+  XEvent ev;
+  int eventcount = 0;
+  void *virtual_address = NULL;
+  int (*handler) (Display *, XErrorEvent *);
+  GstXvImageOutBuffer *outbuf = NULL;
+
+  while(!src->thread_return) {
+    if(src->pause_cond_var == TRUE) {
+      g_cond_wait(src->pause_cond,src->pause_cond_lock);
+    }
+    duration = 0;
+    starttime =0;
+    endtime = 0;
+    start_time.tv_sec = 0;
+    start_time.tv_usec = 0;
+    end_time.tv_sec     = 0;
+    end_time.tv_usec = 0;
+    gettimeofday(&start_time, NULL);
+
+    eventcount = 0;
+    virtual_address = NULL;
+    duration = 0;
+    outbuf = NULL;
+    g_mutex_lock (src->dpy_lock);
+    XSync(src->dpy, 0);
+    GST_INFO ("gst_xv_image_src_update_thread XSync@@ !!");
+    g_mutex_unlock (src->dpy_lock);
+    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 XvPutStill in !!");
+    g_mutex_lock (src->dpy_lock);
+    XvPutStill (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 XvPutStill !!");
+    XSync (src->dpy, 0);
+    g_mutex_unlock (src->dpy_lock);
+    if (error_caught) {
+      GST_ERROR("gst_xv_image_src_update_thread error_caught is TRUE, X is out of buffers");
+           error_caught = FALSE;
+           XSetErrorHandler(handler);
+      g_get_current_time(&timeout);
+      g_time_val_add(&timeout, BUFFER_COND_WAIT_TIMEOUT);
+      if(!g_cond_timed_wait(src->buffer_cond, src->buffer_cond_lock, &timeout)) {
+             GST_ERROR("skip wating");
+      } else {
+         GST_ERROR("Signal received");
+      }
+           continue;
+    }
+    /*reset error handler*/
+    error_caught = FALSE;
+    XSetErrorHandler(handler);
+
+    GST_INFO ("gst_xv_image_src_update_thread XSync !!");
+next_event:
+    g_mutex_lock (src->dpy_lock);
+    GST_INFO("XNextEvent in");
+    XNextEvent (src->dpy, &ev); /* wating for x event */
+    GST_INFO("XNextEvent out");
+    g_mutex_unlock (src->dpy_lock);
+    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");
+      g_mutex_lock (src->dpy_lock);
+      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 );
+      g_mutex_unlock (src->dpy_lock);
+      GST_INFO ("gst_xv_image_src_update_thread XDamageSubtract");
+    }
+    else if (ev.type == (src->evt_base + XvPortNotify)) {
+      XvPortNotifyEvent *notify_ev = (XvPortNotifyEvent*)&ev;
+      if (notify_ev->attribute == atom_secure) {
+          GST_WARNING ("secure attr changed : %s \n", ((int)notify_ev->value)?"Secure":"Normal");
+          src->tz_enable = (int)notify_ev->value;
+          GST_ERROR("src->tz_enable = %d", src->tz_enable);
+      }
+      else if (notify_ev->attribute == atom_data_type) {
+        /* got a port notify, data_type */
+        src->new_data_type = (int)notify_ev->value;
+        if (src->current_data_type != src->new_data_type) {
+          src->current_data_type = src->new_data_type;
+          GST_WARNING("current_data_type : %s \n", (src->current_data_type)?"Video":"UI+Video");
+          g_timeout_add(1, signal_emit_func, src);
+        }
+      }
+      goto next_event;
+    }
+
+    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_PUTSTILL_DATA_PTR data = (XV_PUTSTILL_DATA_PTR)src->virtual;
+      int error = XV_PUTSTILL_VALIDATE_DATA (data);
+      outbuf = gst_xv_image_out_buffer_new(src);
+      if(!outbuf)
+      {
+        GST_ERROR("Out of memory");
+        continue;
+      }
+      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);
+     if(!virtual_address) continue;
+          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);
+     if(!virtual_address) continue;
+          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->tz_enable = 0;
+        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]);
+        outbuf->fd_name = psimgb->fd[0];
+        GST_BUFFER_MALLOCDATA(outbuf) = (unsigned char*)psimgb;
+        GST_BUFFER_DATA(outbuf) = src->virtual;
+        outbuf->YBuf = (void *)data->YBuf;
+           outbuf->fd_name = psimgb->fd[0];
+#ifdef DEBUG_BUFFER
+        for ( i=0; i<5 ; i++) {
+         if(value[value_count] == outbuf->YBuf ) {
+           GST_ERROR("ERROR: value[%d](%d)==YBUf(%d)", value_count, value[value_count], outbuf->YBuf);
+         }
+        }
+        value[value_count] = outbuf->YBuf ;
+           GST_ERROR("value[%d]=%d", value_count, value[value_count]);
+           if( value_count < 4){
+             value_count ++;
+           } else {
+             value_count = 0;
+           }
+#endif
+      }
+    }
+  if(!outbuf) continue;
+       GST_BUFFER_SIZE (outbuf) = src->framesize;
+    gst_xv_image_src_get_timeinfo(src,outbuf);
+    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);
+    GST_INFO("g_queue_push_tail");
+    g_mutex_unlock (src->queue_lock);
+    g_cond_signal(src->queue_cond);
+    GST_INFO("g_cond_signal");
+
+    update_done:
+      if (src->virtual) tbm_bo_unmap(src->bo);
+      src->virtual = NULL;
+      GST_INFO("g_cond_signal");
+      if (src->bo) tbm_bo_unref(src->bo);
+      src->bo = NULL;
+      if (src->dri2_buffers) free(src->dri2_buffers);
+      src->dri2_buffers = NULL;
+      gettimeofday(&end_time, NULL);
+      starttime = start_time.tv_usec;
+      endtime =  end_time.tv_usec;
+      GST_INFO("star_time: %d, end_time:%d", starttime, endtime);
+      if (endtime > starttime) {
+        GST_INFO("end_time > start_time");
+        duration = endtime - starttime;
+        } else {
+        GST_INFO("end_time.tv_usec < start_time.tv_usec");
+        endtime=endtime+1000000;
+        GST_INFO("end_time =%d", endtime);
+        duration = endtime -starttime;
+      }
+      GST_INFO("end_time duration = %d", duration);
+      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;
+      }
+    }
+    if (xv_gem_mmap->handle[i]) {
+       gem_close.handle = xv_gem_mmap->handle[i];
+       if (ioctl(src->drm_fd, DRM_IOCTL_GEM_CLOSE, &gem_close)) {
+         GST_ERROR("Gem Close failed");
+       }
+    }
+    if (xv_gem_mmap->fd[i]) {
+      close(xv_gem_mmap->fd[i]);
+    }
+  }
+  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) {
+    tbm_bufmgr_deinit (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) tbm_bufmgr_deinit (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 tbm_bufmgr bufmgr_get (Display *dpy, Pixmap pixmap)
+{
+  int screen;
+  int drm_fd;
+  tbm_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 = tbm_bufmgr_init (drm_fd);
+  if (!bufmgr) {
+    GST_ERROR ("!!Error : fail to init buffer manager ");
+    close (drm_fd);
+    return NULL;
+  }
+  DRI2CreateDrawable (dpy, pixmap);
+  return bufmgr;
+}
+
+static int port_get (GstXVImageSrc * src, unsigned int id)
+{
+  unsigned int ver, rev, req_base, err_base;
+  unsigned int adaptors;
+  XvAdaptorInfo *ai = NULL;
+  XvAttribute *at = NULL;
+  XvImageFormatValues *fo = NULL;
+  int attributes, formats;
+  int i, j, p;
+
+  if (XvQueryExtension (src->dpy, &ver, &rev, &req_base, &src->evt_base, &err_base) != Success) return -1;
+  if (XvQueryAdaptors (src->dpy, DefaultRootWindow (src->dpy), &adaptors, &ai) != Success) return -1;
+  if (!ai) return -1;
+  for (i = 0; i < adaptors; i++) {
+    int support_format = False;
+    if (!(ai[i].type & XvInputMask) || !(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 (src->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 (src->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 (src->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, tbm_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;
+  tbm_bo_handle temp_virtual;
+  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 = tbm_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 = TBM_OPTION_READ|TBM_OPTION_WRITE;
+  temp_virtual = tbm_bo_map (src->bo, TBM_DEVICE_CPU, opt);
+  src->virtual = temp_virtual.ptr;
+  if (!src->virtual) {
+    GST_ERROR ("[Error] : fail to map ");
+    goto update_done;
+  }
+  return;
+update_done:
+  if (src->virtual) tbm_bo_unmap(src->bo);
+  src->virtual = NULL;
+  if (src->bo) tbm_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()");
+  g_cond_signal(src->queue_cond);
+  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/mobile/xvimagesrc/src/gstxvimagesrc.h b/mobile/xvimagesrc/src/gstxvimagesrc.h
new file mode 100644 (file)
index 0000000..37519e3
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * 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 <tbm_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;
+  unsigned int evt_base;
+  tbm_bufmgr bufmgr;
+  void *virtual;
+  tbm_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;
+  GCond *buffer_cond;
+  gboolean pause_cond_var;
+  GCond *pause_cond;
+  GMutex *pause_cond_lock;
+  GMutex *buffer_cond_lock;
+  GMutex *dpy_lock;
+  gint drm_fd;
+  int current_data_type;
+  int new_data_type;
+  double get_image_overtime;
+  int get_image_overtime_cnt;
+  int gemname_cnt;
+  int tz_enable;
+
+};
+
+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/mobile/xvimagesrc/src/xv_types.h b/mobile/xvimagesrc/src/xv_types.h
new file mode 100755 (executable)
index 0000000..afeb389
--- /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_PUTSTILL_HEADER     0xDEADCD02
+#define XV_PUTSTILL_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_PUTSTILL_DATA, * XV_PUTSTILL_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_PUTSTILL_INIT_DATA (XV_PUTSTILL_DATA_PTR data)
+{
+    data->_header = XV_PUTSTILL_HEADER;
+    data->_version = XV_PUTSTILL_VERSION;
+}
+
+
+static int
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_PUTSTILL_VALIDATE_DATA (XV_PUTSTILL_DATA_PTR data)
+{
+    if (data->_header != XV_PUTSTILL_HEADER)
+        return XV_HEADER_ERROR;
+    if (data->_version != XV_PUTSTILL_VERSION)
+        return XV_VERSION_MISMATCH;
+    return XV_OK;
+}
+
+G_END_DECLS
+
+#endif
diff --git a/packaging/gst-plugins-ext0.10-0.3.14.tar.gz b/packaging/gst-plugins-ext0.10-0.3.14.tar.gz
new file mode 100755 (executable)
index 0000000..0d4415b
Binary files /dev/null and b/packaging/gst-plugins-ext0.10-0.3.14.tar.gz differ
diff --git a/packaging/gst-plugins-ext0.10.spec b/packaging/gst-plugins-ext0.10.spec
new file mode 100644 (file)
index 0000000..cb3d74a
--- /dev/null
@@ -0,0 +1,95 @@
+Name:       gst-plugins-ext0.10
+%if 0%{?tizen_profile_mobile}
+Version:    0.3.14
+Summary:    GStreamer extra plugins (common)
+Release:    0
+%else
+Version:    0.4.13
+Summary:    GStreamer extra plugins (common)
+Release:    0
+VCS:        framework/multimedia/gst-plugins-ext0.10#gst-plugins-ext0.10_0.3.3-8-2-125-g8a01f7e8af22f9b5977ed9bbf6e0eff94afe837b
+%endif
+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)
+%if "%{_repository}" == "mobile"
+BuildRequires: pkgconfig(libdrm)
+BuildRequires: libdrm-devel
+BuildRequires: pkgconfig(libtbm)
+%else
+BuildRequires:  pkgconfig(libxml-2.0)
+%endif
+BuildRequires: pkgconfig(libdri2)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(xext)
+BuildRequires: pkgconfig(xv)
+BuildRequires: pkgconfig(xdamage)
+BuildRequires:  pkgconfig(libtbm)
+BuildRequires: pkgconfig(dri2proto)
+BuildRequires: pkgconfig(xfixes)
+
+%description
+GStreamer extra plugins (common)
+
+%prep
+%setup -q
+
+
+%build
+%if 0%{?tizen_profile_mobile}
+cd mobile
+%else
+cd wearable
+%endif
+
+export CFLAGS+=" -DGST_EXT_TIME_ANALYSIS -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\" "
+
+./autogen.sh --disable-static
+%if 0%{?tizen_profile_mobile}
+%configure --disable-static
+%else
+%configure  --disable-static \
+ --disable-ext-evasimagesink\
+ --disable-ext-evaspixmapsink\
+ --disable-ext-xvimagesrc\
+ --disable-ext-gstreamer-camera\
+ --disable-ext-audiotp\
+ --disable-ext-audioeq\
+ --disable-ext-dashdemux\
+ --disable-ext-pdpushsrc\
+%endif
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+
+%if 0%{?tizen_profile_mobile}
+cd mobile
+%else
+cd wearable
+%endif
+
+mkdir -p %{buildroot}/usr/share/license
+cp COPYING %{buildroot}/usr/share/license/%{name}
+%make_install
+
+
+%files
+%if 0%{?tizen_profile_mobile}
+%manifest mobile/gst-plugins-ext0.10.manifest
+%else
+%manifest wearable/gst-plugins-ext0.10.manifest
+%endif
+%defattr(-,root,root,-)  
+%{_libdir}/gstreamer-0.10/*.so
+%{_datadir}/license/%{name}
diff --git a/wearable/AUTHORS b/wearable/AUTHORS
new file mode 100644 (file)
index 0000000..96cbfc8
--- /dev/null
@@ -0,0 +1,5 @@
+JongHyuk Choi <jhchoi.choi@samsung.com>
+Seungbae Shin <seungbae.shin@samsung.com>
+Younghwan Ahn <younghwan_.an@samsung.com>
+Jeongmo Yang <jm80.yang@samsung.com>
+Sangchul Lee <sc11.lee@samsung.com>
diff --git a/wearable/COPYING b/wearable/COPYING
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/wearable/INSTALL b/wearable/INSTALL
new file mode 100644 (file)
index 0000000..23e5f25
--- /dev/null
@@ -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/wearable/LICENSE.LGPLv2.1 b/wearable/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/wearable/Makefile.am b/wearable/Makefile.am
new file mode 100755 (executable)
index 0000000..e8e3e20
--- /dev/null
@@ -0,0 +1,81 @@
+
+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_EVASPIXMAPSINK
+SUBDIRS += evaspixmapsink
+endif
+
+if GST_EXT_USE_EXT_XVIMAGESRC
+SUBDIRS += xvimagesrc
+endif
+
+if GST_EXT_USE_EXT_TOGGLE
+SUBDIRS += toggle
+endif
+
+if GST_EXT_USE_EXT_PD_PUSHSRC
+SUBDIRS += pdpushsrc
+endif
+
+if GST_EXT_USE_EXT_AUDIOTP
+SUBDIRS += audiotp
+endif
+
+if GST_EXT_USE_EXT_AUDIOEQ
+SUBDIRS += audioeq
+endif
+
+if GST_EXT_USE_EXT_DASHDEMUX
+SUBDIRS += dashdemux
+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_TOGGLE
+DIST_SUBDIRS += toggle
+endif
+
+if GST_EXT_USE_EXT_DASHDEMUX
+DIST_SUBDIRS += dashdemux
+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/wearable/NEWS b/wearable/NEWS
new file mode 100644 (file)
index 0000000..3474a99
--- /dev/null
@@ -0,0 +1 @@
+Nothing much yet.
diff --git a/wearable/PLUGINS b/wearable/PLUGINS
new file mode 100644 (file)
index 0000000..a737f3a
--- /dev/null
@@ -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/wearable/README b/wearable/README
new file mode 100644 (file)
index 0000000..9681276
--- /dev/null
@@ -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/wearable/aclocal.m4 b/wearable/aclocal.m4
new file mode 100644 (file)
index 0000000..f7d80b7
--- /dev/null
@@ -0,0 +1,1011 @@
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
+[m4_warning([this file was generated for autoconf 2.67.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.11'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.11.1], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 10
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  am__universal=false
+  m4_case([$1], [CC],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac],
+    [CXX],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac])
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 5
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`AS_DIRNAME("$mf")`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`AS_DIRNAME(["$file"])`
+      AS_MKDIR_P([$dirpart/$fdir])
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 16
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+             [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                 [_AM_DEPENDENCIES(CC)],
+                 [define([AC_PROG_CC],
+                         defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                 [_AM_DEPENDENCIES(CXX)],
+                 [define([AC_PROG_CXX],
+                         defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                 [_AM_DEPENDENCIES(OBJC)],
+                 [define([AC_PROG_OBJC],
+                         defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
+# From Jim Meyering
+
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well.  Anyway, the user
+# can override the default with the --enable/--disable switch.
+AC_DEFUN([AM_MAINTAINER_MODE],
+[m4_case(m4_default([$1], [disable]),
+       [enable], [m4_define([am_maintainer_other], [disable])],
+       [disable], [m4_define([am_maintainer_other], [enable])],
+       [m4_define([am_maintainer_other], [enable])
+        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+  AC_ARG_ENABLE([maintainer-mode],
+[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
+                         (and sometimes confusing) to the casual installer],
+      [USE_MAINTAINER_MODE=$enableval],
+      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
+  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST([MAINT])dnl
+]
+)
+
+AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
+
+# Check to see how 'make' treats includes.                 -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[[\\\"\#\$\&\'\`$am_lf]]*)
+    AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+  *[[\\\"\#\$\&\'\`$am_lf\ \   ]]*)
+    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([common/m4/libtool.m4])
+m4_include([common/m4/ltoptions.m4])
+m4_include([common/m4/ltsugar.m4])
+m4_include([common/m4/ltversion.m4])
+m4_include([common/m4/lt~obsolete.m4])
+m4_include([common/m4/pkg.m4])
+m4_include([m4/as-compiler-flag.m4])
+m4_include([m4/as-version.m4])
diff --git a/wearable/audioeq/Makefile.am b/wearable/audioeq/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/wearable/audioeq/src/Makefile.am b/wearable/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/wearable/audioeq/src/gstaudioeq.c b/wearable/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/wearable/audioeq/src/gstaudioeq.h b/wearable/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/wearable/audiotp/Makefile.am b/wearable/audiotp/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/wearable/audiotp/src/Makefile.am b/wearable/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/wearable/audiotp/src/gstaudiotp.c b/wearable/audiotp/src/gstaudiotp.c
new file mode 100755 (executable)
index 0000000..f0e73e4
--- /dev/null
@@ -0,0 +1,604 @@
+/*
+ * 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
+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/wearable/audiotp/src/gstaudiotp.h b/wearable/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/wearable/autogen.sh b/wearable/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/wearable/autoregen.sh b/wearable/autoregen.sh
new file mode 100755 (executable)
index 0000000..c67a299
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./autogen.sh  $@
diff --git a/wearable/avsystem/Makefile.am b/wearable/avsystem/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/wearable/avsystem/src/Makefile.am b/wearable/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/wearable/avsystem/src/gstavsysaudiosink.c b/wearable/avsystem/src/gstavsysaudiosink.c
new file mode 100755 (executable)
index 0000000..90c4921
--- /dev/null
@@ -0,0 +1,1196 @@
+/*
+ * 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
+#define DEFAULT_AUDIO_CLOSE_HANDLE_ON_PREPARE  FALSE
+#define DEFAULT_AUDIO_OPEN_FORCEDLY    FALSE
+
+//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");
+
+static const avsys_audio_channel_pos_t gst_pos_to_avsys[GST_AUDIO_CHANNEL_POSITION_NUM] = {
+       [GST_AUDIO_CHANNEL_POSITION_FRONT_MONO] = AVSYS_AUDIO_CHANNEL_POSITION_MONO,
+       [GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT] = AVSYS_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
+       [GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT] = AVSYS_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
+       [GST_AUDIO_CHANNEL_POSITION_REAR_CENTER] = AVSYS_AUDIO_CHANNEL_POSITION_REAR_CENTER,
+       [GST_AUDIO_CHANNEL_POSITION_REAR_LEFT] = AVSYS_AUDIO_CHANNEL_POSITION_REAR_LEFT,
+       [GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT] = AVSYS_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
+       [GST_AUDIO_CHANNEL_POSITION_LFE] = AVSYS_AUDIO_CHANNEL_POSITION_LFE,
+       [GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER] = AVSYS_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
+       [GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER] = AVSYS_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
+       [GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER] = AVSYS_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
+       [GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT] = AVSYS_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
+       [GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT] = AVSYS_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
+       [GST_AUDIO_CHANNEL_POSITION_NONE] = AVSYS_AUDIO_CHANNEL_POSITION_INVALID
+};
+
+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,
+       PROP_AUDIO_CLOSE_HANDLE_ON_PREPARE,
+       PROP_AUDIO_OPEN_FORCEDLY,
+#ifdef USE_PA_AUDIO_FILTER
+       PROP_SPEED,
+       PROP_FILTER_ACTION,
+       PROP_FILTER_OUTPUT_MODE,
+       PROP_PRESET_MODE,
+       PROP_CUSTOM_EQ,
+       PROP_CUSTOM_EXT,
+#endif
+};
+
+#ifdef USE_PA_AUDIO_FILTER
+#define AUDIOVSP_DEFAULT_PLAYBACK_RATE 1.0
+#define AUDIOVSP_MIN_PLAYBACK_RATE     0.5
+#define AUDIOVSP_MAX_PLAYBACK_RATE     2.0
+
+#define DEFAULT_FILTER_ACTION                  FILTER_NONE
+#define DEFAULT_FILTER_OUTPUT_MODE             OUTPUT_SPK
+#define DEFAULT_PRESET_MODE                            PRESET_NORMAL
+
+enum FilterActionType
+{
+       FILTER_NONE,
+       FILTER_PRESET,
+       FILTER_ADVANCED_SETTING
+};
+
+enum OutputMode
+{
+       OUTPUT_SPK,
+       OUTPUT_EAR,
+       OUTPUT_OTHERS,
+       OUTPUT_NUM
+};
+
+enum PresetMode
+{
+       PRESET_NORMAL,
+       PRESET_POP,
+       PRESET_ROCK,
+       PRESET_DANCE,
+       PRESET_JAZZ,
+       PRESET_CLASSIC,
+       PRESET_VOCAL,
+       PRESET_BASS_BOOST,
+       PRESET_TREBLE_BOOST,
+       PRESET_MTHEATER,
+       PRESET_EXTERNALIZATION,
+       PRESET_CAFE,
+       PRESET_CONCERT_HALL,
+       PRESET_VOICE,
+       PRESET_MOVIE,
+       PRESET_VIRT51,
+       PRESET_HIPHOP,
+       PRESET_RNB,
+       PRESET_FLAT,
+       PRESET_TUBE,
+
+       PRESET_NUM
+};
+#endif
+
+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"},
+               {AVSYSAUDIOSINK_USERROUTE_ALL, "Route to all", "all"},
+               {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) 44100, "
+                                                                        "channels = (int) [ 1, 6 ]; "
+                                                                        "audio/x-raw-int, "
+                                                                        "signed = (boolean) { FALSE }, "
+                                                                        "width = (int) 8, "
+                                                                        "depth = (int) 8, "
+                                                                        "rate = (int) 44100, "
+                                                                        "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_WARNING(">> Start(%d)", sink->audio_handle);
+
+       GST_AVSYS_AUDIO_SINK_LOCK(sink);
+       gst_avsysaudiosink_avsys_close(sink);
+       GST_AVSYS_AUDIO_SINK_UNLOCK(sink);
+       g_mutex_free (sink->avsys_audio_lock);
+       g_mutex_free (sink->avsys_audio_delay_lock);
+       g_mutex_free (sink->avsys_audio_reset_lock);
+
+       GST_WARNING("<< End(%d)", sink->audio_handle);
+
+       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_MAX - 1,
+                                       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 ));
+
+       g_object_class_install_property (gobject_class, PROP_AUDIO_CLOSE_HANDLE_ON_PREPARE,
+                       g_param_spec_boolean ("close-handle-on-prepare", "Close Handle on Prepare",
+                                       "Close Handle on Prepare",
+                                       DEFAULT_AUDIO_CLOSE_HANDLE_ON_PREPARE, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_class, PROP_AUDIO_OPEN_FORCEDLY,
+                               g_param_spec_boolean ("open-audio", "Open Audio",
+                                               "Open Audio dev",
+                                               DEFAULT_AUDIO_OPEN_FORCEDLY, G_PARAM_READWRITE));
+
+#ifdef USE_PA_AUDIO_FILTER
+       g_object_class_install_property(gobject_class, PROP_SPEED,
+               g_param_spec_float("speed", "speed", "speed",
+               AUDIOVSP_MIN_PLAYBACK_RATE,
+               AUDIOVSP_MAX_PLAYBACK_RATE,
+               AUDIOVSP_DEFAULT_PLAYBACK_RATE,
+               G_PARAM_READWRITE));
+
+       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_FILTER_OUTPUT_MODE,
+               g_param_spec_uint("filter-output-mode", "filter output mode", "(0)Speaker (1)Ear (2)Others",
+               0, 2, DEFAULT_FILTER_OUTPUT_MODE, G_PARAM_READWRITE));
+
+       g_object_class_install_property(gobject_class, PROP_PRESET_MODE,
+               g_param_spec_uint("preset-mode", "preset mode", "(0)normal (1)pop (2)rock (3)dance (4)jazz (5)classic (6)vocal (7)bass boost (8)treble boost (9)mtheater (10)externalization (11)cafe (12)concert hall (13)voice (14)movie (15)virt 5.1 (16)hip-hop (17)R&B (18)flat (19)tube",
+               0, 19, DEFAULT_PRESET_MODE, G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_class, PROP_CUSTOM_EQ,
+               g_param_spec_pointer("custom-eq", "custom eq level array",
+               "pointer for array of EQ bands level", G_PARAM_READWRITE));
+
+       g_object_class_install_property (gobject_class, PROP_CUSTOM_EXT,
+               g_param_spec_pointer("custom-ext", "custom ext level array",
+               "pointer for array of custom effect level", G_PARAM_READWRITE));
+#endif
+}
+
+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;
+#ifdef USE_PA_AUDIO_FILTER
+       gshort *pointer;
+#endif
+
+       sink = GST_AVSYS_AUDIO_SINK (object);
+
+       switch (prop_id) {
+       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;
+               GST_INFO_OBJECT(sink, "Set audio priority(%d)", nvalue);
+               if (sink->audio_handle != (avsys_handle_t)-1) {
+                       int error = AVSYS_STATE_ERR_UNKNOWN;
+                       int handle_route = 0;
+                       sink->audio_param.priority = sink->sound_priority;
+                       error = avsys_audio_handle_update_priority(sink->audio_handle, nvalue, handle_route, AVSYS_AUDIO_SET_PRIORITY);
+                       if (AVSYS_FAIL(error)) {
+                               GST_ERROR_OBJECT(sink, "Failed to set audio priority(%d) to audio handle(%d)", nvalue, sink->audio_handle);
+                               break;
+                       }
+               }
+               break;
+       case PROP_AUDIO_MUTE:
+               nvalue = g_value_get_enum(value);
+               if (sink->audio_handle != (avsys_handle_t)-1) {
+                       if (nvalue == AVSYSAUDIOSINK_AUDIO_MUTE_WITH_FADEDOWN_EFFECT) {
+                               if(AVSYS_SUCCESS(avsys_audio_set_mute_fadedown(sink->audio_handle)))
+                                       sink->mute = nvalue;
+                       } else {
+                               if(AVSYS_SUCCESS(avsys_audio_set_mute(sink->audio_handle, nvalue)))
+                                       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;
+       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_CLOSE_HANDLE_ON_PREPARE:
+               nbool = g_value_get_boolean(value);
+               sink->close_handle_on_prepare = nbool;
+               break;
+       case PROP_AUDIO_OPEN_FORCEDLY:
+               nbool = g_value_get_boolean(value);
+               if (nbool) {
+                       GST_AVSYS_AUDIO_SINK_LOCK(sink);
+                       if (gst_avsysaudiosink_avsys_open(sink) == FALSE) {
+                               GST_ERROR_OBJECT(sink, "gst_avsysaudiosink_avsys_open() failed");
+                       }
+                       GST_AVSYS_AUDIO_SINK_UNLOCK (sink);
+               }
+               break;
+#ifdef USE_PA_AUDIO_FILTER
+       case PROP_SPEED:
+               GST_INFO_OBJECT(sink, "request setting filter speed:%f (current:%f)",
+                       g_value_get_float(value), sink->playback_rate);
+               sink->playback_rate = g_value_get_float(value);
+               if (sink->audio_handle != -1) {
+                       avsys_audio_set_vsp_speed(sink->audio_handle, (guint)(sink->playback_rate * 1000));
+               }
+               break;
+       case PROP_FILTER_ACTION:
+               sink->filter_action = g_value_get_uint(value);
+               if (sink->audio_handle != -1) {
+                       avsys_audio_set_soundalive_filter_action(sink->audio_handle, sink->filter_action);
+                       if (sink->filter_action == FILTER_ADVANCED_SETTING) {
+                               avsys_audio_set_soundalive_eq(sink->audio_handle, sink->custom_eq);
+                               avsys_audio_set_soundalive_ext(sink->audio_handle, sink->custom_ext);
+                       }
+               }
+               break;
+       case PROP_FILTER_OUTPUT_MODE:
+               GST_INFO_OBJECT(sink, "request setting filter_output_mode:%d (current:%d)",
+                       g_value_get_uint(value), sink->filter_output_mode);
+               sink->filter_output_mode = g_value_get_uint(value);
+               if (sink->audio_handle != -1)
+                       avsys_audio_set_soundalive_device(sink->audio_handle, sink->filter_output_mode);
+               break;
+       case PROP_PRESET_MODE:
+               sink->preset_mode = g_value_get_uint(value);
+               if (sink->audio_handle != -1)
+                       avsys_audio_set_soundalive_preset_mode(sink->audio_handle, sink->preset_mode);
+               break;
+       case PROP_CUSTOM_EQ:
+               pointer = g_value_get_pointer(value);
+               if (pointer) {
+                       gint *custom_eq = (gint *)pointer;
+                       GST_INFO_OBJECT(sink, "request setting custom_eq:%d,%d,%d,%d,%d,%d,%d (current:%d,%d,%d,%d,%d,%d,%d)",
+                               custom_eq[0], custom_eq[1], custom_eq[2], custom_eq[3], custom_eq[4], custom_eq[5], custom_eq[6],
+                               sink->custom_eq[0], sink->custom_eq[1], sink->custom_eq[2], sink->custom_eq[3],
+                               sink->custom_eq[4], sink->custom_eq[5], sink->custom_eq[6]);
+                       memcpy(sink->custom_eq, pointer, sizeof(gint) * CUSTOM_EQ_BAND_MAX);
+                       if ((sink->audio_handle != -1) && (sink->filter_action == FILTER_ADVANCED_SETTING)) {
+                               avsys_audio_set_soundalive_eq(sink->audio_handle, sink->custom_eq);
+                       }
+               }
+               break;
+       case PROP_CUSTOM_EXT:
+               pointer = g_value_get_pointer(value);
+               if (pointer) {
+                       gint *custom_ext = (gint *)pointer;
+                       GST_INFO_OBJECT(sink, "request setting custom_ext:%d,%d,%d,%d,%d (current:%d,%d,%d,%d,%d)",
+                               custom_ext[CUSTOM_EXT_3D_LEVEL], custom_ext[CUSTOM_EXT_BASS_LEVEL],
+                               custom_ext[CUSTOM_EXT_CONCERT_HALL_LEVEL], custom_ext[CUSTOM_EXT_CONCERT_HALL_VOLUME],
+                               custom_ext[CUSTOM_EXT_CLARITY_LEVEL],
+                               sink->custom_ext[CUSTOM_EXT_3D_LEVEL], sink->custom_ext[CUSTOM_EXT_BASS_LEVEL],
+                               sink->custom_ext[CUSTOM_EXT_CONCERT_HALL_LEVEL], sink->custom_ext[CUSTOM_EXT_CONCERT_HALL_VOLUME],
+                               sink->custom_ext[CUSTOM_EXT_CLARITY_LEVEL]);
+                       memcpy(sink->custom_ext, pointer, sizeof(gint) * CUSTOM_EXT_PARAM_MAX);
+                       if ((sink->audio_handle != -1) && (sink->filter_action == FILTER_ADVANCED_SETTING)) {
+                               avsys_audio_set_soundalive_ext(sink->audio_handle, sink->custom_ext);
+                       }
+               }
+               break;
+#endif
+       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;
+       case PROP_AUDIO_HANDLE:
+               g_value_set_pointer(value, sink->cbHandle);
+               break;
+       case PROP_AUDIO_CALLBACK:
+               g_value_set_pointer(value, sink->audio_stream_cb);
+               break;
+       case PROP_AUDIO_CLOSE_HANDLE_ON_PREPARE:
+               g_value_set_boolean(value, sink->close_handle_on_prepare);
+               break;
+       case PROP_AUDIO_OPEN_FORCEDLY:
+               break;
+#ifdef USE_PA_AUDIO_FILTER
+       case PROP_SPEED:
+               g_value_set_float(value, sink->playback_rate);
+               break;
+       case PROP_FILTER_ACTION:
+               g_value_set_uint(value, sink->filter_action);
+               break;
+       case PROP_FILTER_OUTPUT_MODE:
+               g_value_set_uint(value, sink->filter_output_mode);
+               break;
+       case PROP_PRESET_MODE:
+               g_value_set_uint(value, sink->preset_mode);
+               break;
+       case PROP_CUSTOM_EQ:
+               g_value_set_pointer(value, sink->custom_eq);
+               break;
+       case PROP_CUSTOM_EXT:
+               g_value_set_pointer(value, sink->custom_ext);
+               break;
+#endif
+       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_delay_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;
+       avsysaudiosink->close_handle_on_prepare = DEFAULT_AUDIO_CLOSE_HANDLE_ON_PREPARE;
+       avsysaudiosink->first_write = FALSE;
+#if defined (LPCM_DUMP_SUPPORT)
+       avsysaudiosink->dumpFp = NULL;
+#endif
+       avsysaudiosink->audio_param.format = AVSYS_AUDIO_FORMAT_UNKNOWN;
+#ifdef USE_PA_AUDIO_FILTER
+       avsysaudiosink->filter_action = DEFAULT_FILTER_ACTION;
+       avsysaudiosink->filter_output_mode = DEFAULT_FILTER_OUTPUT_MODE;
+       avsysaudiosink->preset_mode = DEFAULT_PRESET_MODE;
+       memset(avsysaudiosink->custom_eq, 0x00, sizeof(gint) * CUSTOM_EQ_BAND_MAX);
+       memset(avsysaudiosink->custom_ext, 0x00, sizeof(gint) * CUSTOM_EXT_PARAM_MAX);
+       avsysaudiosink->playback_rate = AUDIOVSP_DEFAULT_PLAYBACK_RATE;
+#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 avsys_audio_channel_pos_t *
+gst_avsysaudiosink_gst_to_channel_map (avsys_audio_channel_pos_t * map,
+       const GstRingBufferSpec * spec)
+{
+       int i;
+       GstAudioChannelPosition *pos;
+
+       for (i = 0; i < AVSYS_CHANNEL_MAX; i++) {
+               map[i] = AVSYS_AUDIO_CHANNEL_POSITION_INVALID;
+       }
+
+       if (!(pos = gst_audio_get_channel_positions (gst_caps_get_structure (spec->caps, 0)))) {
+               return NULL;
+       }
+
+       for (i = 0; i < spec->channels; i++) {
+               if (pos[i] == GST_AUDIO_CHANNEL_POSITION_NONE) {
+                       g_free (pos);
+                       return NULL;
+               } else if (pos[i] < GST_AUDIO_CHANNEL_POSITION_NUM) {
+                       map[i] = gst_pos_to_avsys[pos[i]];
+               } else {
+                       map[i] = AVSYS_AUDIO_CHANNEL_POSITION_INVALID;
+               }
+       }
+
+       g_free (pos);
+
+       return map;
+}
+
+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;
+       gst_avsysaudiosink_gst_to_channel_map (avsys_audio->audio_param.map, spec);
+
+       /* 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)
+{
+       guint   p_time = 0, b_time = 0;
+       gboolean ret = FALSE;
+       gboolean close_on_exit = FALSE;
+       GstAvsysAudioSink *avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+
+       GST_WARNING(">> Start(%d)", avsys_audio->audio_handle);
+
+       GST_AVSYS_AUDIO_SINK_LOCK(avsys_audio);
+
+       // set avsys audio param
+       if (!avsysaudiosink_parse_spec (avsys_audio, spec)) {
+               GST_ELEMENT_ERROR (avsys_audio, RESOURCE, SETTINGS, (NULL),
+                                                                  ("Setting of swparams failed: " ));
+               goto exit;
+       }
+
+       /* Open Handle */
+       if (gst_avsysaudiosink_avsys_open(avsys_audio) == FALSE) {
+               GST_ERROR_OBJECT(avsys_audio, "gst_avsysaudiosink_avsys_open() failed");
+               goto OPEN_FAILED;
+       }
+
+       /* 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) {
+                       GST_WARNING_OBJECT(avsys_audio, "");
+                       close_on_exit = TRUE;
+                       goto exit;
+               }
+               spec->latency_time = (guint64)p_time;
+               spec->buffer_time = (guint64)b_time;
+       } else {
+               GST_WARNING_OBJECT(avsys_audio, "");
+               close_on_exit = TRUE;
+               goto exit;
+       }
+       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 ("latency time %u, buffer time %u, seg total %u\n",
+                               (unsigned int)(spec->latency_time/1000), (unsigned int)(spec->buffer_time/1000), spec->segtotal);
+
+       /* Close if needed */
+       close_on_exit = avsys_audio->close_handle_on_prepare;
+
+       ret = TRUE;
+
+exit:
+       if (close_on_exit) {
+               if (gst_avsysaudiosink_avsys_close(avsys_audio) == FALSE) {
+                       GST_ERROR_OBJECT(avsys_audio, "gst_avsysaudiosink_avsys_close() failed");
+               }
+       }
+
+       GST_AVSYS_AUDIO_SINK_UNLOCK (avsys_audio);
+       GST_WARNING("<< End(%d), ret=%d", avsys_audio->audio_handle, ret);
+       return ret;
+
+OPEN_FAILED:
+       avsysaudiosink_post_message(avsys_audio, GST_RESOURCE_ERROR_OPEN_READ);
+       GST_AVSYS_AUDIO_SINK_UNLOCK (avsys_audio);
+       GST_WARNING("<< End(%d), ret=%d", avsys_audio->audio_handle, ret);
+       return ret;
+}
+
+static gboolean
+gst_avsysaudiosink_unprepare (GstAudioSink * asink)
+{
+       gboolean ret = TRUE;
+       GstAvsysAudioSink       *avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+
+       GST_WARNING(">> Start(%d)", avsys_audio->audio_handle);
+       GST_AVSYS_AUDIO_SINK_LOCK(avsys_audio);
+       if(!gst_avsysaudiosink_avsys_close(avsys_audio)) {
+               GST_ERROR_OBJECT(avsys_audio, "gst_avsysaudiosink_avsys_close() failed");
+               ret = FALSE;
+       }
+       GST_AVSYS_AUDIO_SINK_UNLOCK(avsys_audio);
+       GST_WARNING("<< End(%d), ret=%d", avsys_audio->audio_handle, ret);
+
+       return ret;
+}
+
+static gboolean
+gst_avsysaudiosink_close (GstAudioSink * asink)
+{
+       GstAvsysAudioSink *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 = GST_AVSYS_AUDIO_SINK (asink);
+       gint    write_len = 0;
+       guint ret = 0;
+
+       GST_AVSYS_AUDIO_SINK_LOCK (asink);
+
+       if (avsys_audio->audio_stream_cb == NULL) {
+#if defined (LPCM_DUMP_SUPPORT)
+               fwrite(data, 1, write_len, avsys_audio->dumpFp); //This is for original data (no volume convert)
+#endif
+               write_len = avsys_audio_write(avsys_audio->audio_handle, data, length);
+               if(write_len == length) {
+                       ret = write_len;
+               } else {
+                       if(AVSYS_FAIL(write_len)) {
+                               GST_ERROR_OBJECT(avsys_audio, "avsys_audio_write() failed with %d\n", write_len);
+                       }
+                       ret = length; /* skip one period */
+               }
+       } else {
+               if(!avsys_audio->audio_stream_cb(data, length, avsys_audio->cbHandle)) {
+                       GST_ERROR_OBJECT(avsys_audio,"auido stream callback failed\n");
+               }
+               ret = length;
+       }
+
+       if (avsys_audio->first_write) {
+               GST_WARNING("First write (%d/%d)", ret, length);
+               avsys_audio->first_write = FALSE;
+       }
+
+       GST_AVSYS_AUDIO_SINK_UNLOCK (asink);
+       return ret;
+
+}
+
+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_DELAY_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_DELAY_UNLOCK (asink);
+       return retValue;
+}
+
+static void
+gst_avsysaudiosink_reset (GstAudioSink * asink)
+{
+       int avsys_result = AVSYS_STATE_SUCCESS;
+       GstAvsysAudioSink *avsys_audio = GST_AVSYS_AUDIO_SINK (asink);
+
+       GST_WARNING(">> Start(%d)", avsys_audio->audio_handle);
+       GST_AVSYS_AUDIO_SINK_LOCK (asink);
+
+#if defined(__REPLACE_RESET_WITH_CLOSE_AND_REOPEN__)
+       if(!gst_avsysaudiosink_avsys_close(avsys_audio)) {
+               GST_ERROR_OBJECT(avsys_audio, "gst_avsysaudiosink_avsys_close() failed");
+       }
+#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);
+       GST_WARNING("<<  End(%d)", avsys_audio->audio_handle);
+
+       return;
+}
+
+
+static gboolean
+gst_avsysaudiosink_avsys_open(GstAvsysAudioSink *avsys_audio)
+{
+       gboolean ret = TRUE;
+       int avsys_result;
+       int available = FALSE;
+
+       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);
+
+               /* workaround for PA audio filter */
+               if (avsys_audio->latency == AVSYSAUDIOSINK_LATENCY_HIGH) {
+                       avsys_audio_is_available_high_latency(&available);
+                       if (available == FALSE) {
+                               avsys_audio->latency = AVSYSAUDIOSINK_LATENCY_MID;
+                               avsys_audio->audio_param.mode = AVSYS_AUDIO_MODE_OUTPUT;
+                       }
+               }
+
+               avsys_result = avsys_audio_open(&avsys_audio->audio_param, &avsys_audio->audio_handle, &avsys_audio->avsys_size);
+               if (avsys_result != AVSYS_STATE_SUCCESS) {
+                       GST_ERROR_OBJECT(avsys_audio, "avsys_audio_open() failed with 0x%x", avsys_result);
+                       avsysaudiosink_post_message(avsys_audio, GST_RESOURCE_ERROR_OPEN_READ);
+                       ret = FALSE;
+               } else {
+                       GST_WARNING("avsys_audio_open() success [%d]", avsys_audio->audio_handle);
+                       avsys_audio->first_write = TRUE;
+
+#ifdef USE_PA_AUDIO_FILTER
+                       avsys_audio_set_vsp_speed(avsys_audio->audio_handle, (guint)(avsys_audio->playback_rate * 1000));
+#endif
+
+                       // check audio handle was already muted.
+                       if(avsys_audio->mute == TRUE) {
+                           if(AVSYS_SUCCESS(avsys_audio_set_mute(avsys_audio->audio_handle, AVSYS_AUDIO_MUTE)))
+                               GST_DEBUG("avsys_audio_set_mute() success. mute handle open success.\n");
+                           else
+                               GST_DEBUG("avsys_audio_set mute() fail.\n");
+                       }
+               }
+       } else {
+               GST_WARNING("audio handle has already opened");
+               ret = FALSE;
+       }
+#if defined (LPCM_DUMP_SUPPORT)
+       if (avsys_audio->dumpFp == NULL) {
+               avsys_audio->dumpFp = fopen("/root/dump.lpcm","w");
+       }
+#endif
+       return ret;
+}
+
+static gboolean
+gst_avsysaudiosink_avsys_close(GstAvsysAudioSink *avsys_audio)
+{
+       gboolean ret = TRUE;
+       int avsys_result = AVSYS_STATE_SUCCESS;
+
+       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);
+                       ret = FALSE;
+               } else {
+                       GST_WARNING("avsys_audio_close(%d) success", avsys_audio->audio_handle);
+                       avsys_audio->audio_handle = (avsys_handle_t) -1;
+               }
+       } else {
+               GST_INFO("audio handle has already closed");
+       }
+
+#if defined (LPCM_DUMP_SUPPORT)
+       if(avsys_audio->dumpFp != NULL)
+       {
+               fclose(avsys_audio->dumpFp);
+               avsys_audio->dumpFp = NULL;
+       }
+#endif
+       return ret;
+}
+
+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
+                       GST_AVSYS_AUDIO_SINK_LOCK (avsys_audio);
+#if defined(__REPLACE_RESET_WITH_CLOSE_AND_REOPEN__)
+                       if (avsys_audio->audio_handle == (avsys_handle_t)-1 &&
+                               avsys_audio->audio_param.format != AVSYS_AUDIO_FORMAT_UNKNOWN) {
+                               if (gst_avsysaudiosink_avsys_open(avsys_audio) == FALSE) {
+                                       GST_ERROR_OBJECT(avsys_audio, "gst_avsysaudiosink_avsys_open() failed");
+                                       GST_AVSYS_AUDIO_SINK_UNLOCK (avsys_audio);
+                                       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);
+                       }
+                       GST_AVSYS_AUDIO_SINK_UNLOCK (avsys_audio);
+
+#if 0
+                       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));
+                       }
+#endif
+                       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 = errorcode;
+               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/wearable/avsystem/src/gstavsysaudiosink.h b/wearable/avsystem/src/gstavsysaudiosink.h
new file mode 100644 (file)
index 0000000..cc77557
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * 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/base/gstbasesink.h>
+#include <gst/audio/gstaudiosink.h>
+#include <gst/audio/multichannel.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)))
+
+#define GST_AVSYS_AUDIO_SINK_GET_DELAY_LOCK(obj) (GST_AVSYS_AUDIO_SINK (obj)->avsys_audio_delay_lock)
+#define GST_AVSYS_AUDIO_SINK_DELAY_LOCK(obj)     (g_mutex_lock (GST_AVSYS_AUDIO_SINK_GET_DELAY_LOCK(obj)))
+#define GST_AVSYS_AUDIO_SINK_DELAY_UNLOCK(obj)   (g_mutex_unlock (GST_AVSYS_AUDIO_SINK_GET_DELAY_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,
+       AVSYSAUDIOSINK_USERROUTE_ALL
+}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
+#define USE_PA_AUDIO_FILTER
+#ifdef USE_PA_AUDIO_FILTER
+#define CUSTOM_EQ_BAND_MAX                             9
+enum {
+       CUSTOM_EXT_3D_LEVEL,
+       CUSTOM_EXT_BASS_LEVEL,
+       CUSTOM_EXT_CONCERT_HALL_VOLUME,
+       CUSTOM_EXT_CONCERT_HALL_LEVEL,
+       CUSTOM_EXT_CLARITY_LEVEL,
+       CUSTOM_EXT_PARAM_MAX
+};
+#endif
+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                                            close_handle_on_prepare;
+       gint                                            audio_route_policy;
+       gint                                            user_route_policy;
+       gint                                            latency;
+
+       GstCaps                                         *cached_caps;
+
+       GMutex                                          *avsys_audio_lock;
+       GMutex                                          *avsys_audio_reset_lock;
+       GMutex                                          *avsys_audio_delay_lock;
+       gint                                            volume_type;
+       gint                                            sound_priority;
+       gint                                            bytes_per_sample;
+
+       gboolean                                        first_write;
+
+       gpointer                         cbHandle;
+       gboolean (*audio_stream_cb) (void *stream, int stream_size, void *user_param);
+
+#ifdef USE_PA_AUDIO_FILTER
+       guint           filter_action;
+       guint           filter_output_mode;
+       guint           preset_mode;
+       gint            custom_eq[CUSTOM_EQ_BAND_MAX];
+       gint            custom_ext[CUSTOM_EXT_PARAM_MAX];
+       guint           custom_eq_band_num;
+       gint            custom_eq_band_freq[CUSTOM_EQ_BAND_MAX];
+       gint            custom_eq_band_width[CUSTOM_EQ_BAND_MAX];
+       float           playback_rate;
+#endif
+};
+
+
+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/wearable/avsystem/src/gstavsysaudiosrc.c b/wearable/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/wearable/avsystem/src/gstavsysaudiosrc.h b/wearable/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/wearable/avsystem/src/gstavsysmemsink.c b/wearable/avsystem/src/gstavsysmemsink.c
new file mode 100644 (file)
index 0000000..718afb4
--- /dev/null
@@ -0,0 +1,751 @@
+/*
+ * 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/wearable/avsystem/src/gstavsysmemsink.h b/wearable/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/wearable/avsystem/src/gstavsyssink.c b/wearable/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/wearable/avsystem/src/gstavsyssrc.c b/wearable/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/wearable/common/ChangeLog b/wearable/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/wearable/common/Makefile.am b/wearable/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/wearable/common/c-to-xml.py b/wearable/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/wearable/common/check-exports b/wearable/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/wearable/common/check.mak b/wearable/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/wearable/common/coverage/coverage-report-entry.pl b/wearable/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/wearable/common/coverage/coverage-report.pl b/wearable/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/wearable/common/coverage/coverage-report.xsl b/wearable/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/wearable/common/coverage/lcov.mak b/wearable/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/wearable/common/gettext.patch b/wearable/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/wearable/common/glib-gen.mak b/wearable/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/wearable/common/gst-autogen.sh b/wearable/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/wearable/common/gst-xmlinspect.py b/wearable/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/wearable/common/gst.supp b/wearable/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/wearable/common/gstdoc-scangobj b/wearable/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/wearable/common/gtk-doc-plugins.mak b/wearable/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/wearable/common/gtk-doc.mak b/wearable/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/wearable/common/m4/Makefile.am b/wearable/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/wearable/common/m4/README b/wearable/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/wearable/common/m4/as-ac-expand.m4 b/wearable/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/wearable/common/m4/as-auto-alt.m4 b/wearable/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/wearable/common/m4/as-compiler-flag.m4 b/wearable/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/wearable/common/m4/as-compiler.m4 b/wearable/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/wearable/common/m4/as-docbook.m4 b/wearable/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/wearable/common/m4/as-gcc-inline-assembly.m4 b/wearable/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/wearable/common/m4/as-libtool-tags.m4 b/wearable/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/wearable/common/m4/as-libtool.m4 b/wearable/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/wearable/common/m4/as-python.m4 b/wearable/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/wearable/common/m4/as-scrub-include.m4 b/wearable/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/wearable/common/m4/as-version.m4 b/wearable/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/wearable/common/m4/ax_create_stdint_h.m4 b/wearable/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/wearable/common/m4/check.m4 b/wearable/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/wearable/common/m4/gettext.m4 b/wearable/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/wearable/common/m4/glib-gettext.m4 b/wearable/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/wearable/common/m4/gst-arch.m4 b/wearable/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/wearable/common/m4/gst-args.m4 b/wearable/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/wearable/common/m4/gst-check.m4 b/wearable/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/wearable/common/m4/gst-debuginfo.m4 b/wearable/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/wearable/common/m4/gst-default.m4 b/wearable/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/wearable/common/m4/gst-doc.m4 b/wearable/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/wearable/common/m4/gst-error.m4 b/wearable/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/wearable/common/m4/gst-feature.m4 b/wearable/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/wearable/common/m4/gst-function.m4 b/wearable/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/wearable/common/m4/gst-gettext.m4 b/wearable/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/wearable/common/m4/gst-glib2.m4 b/wearable/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/wearable/common/m4/gst-libxml2.m4 b/wearable/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/wearable/common/m4/gst-parser.m4 b/wearable/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/wearable/common/m4/gst-plugin-docs.m4 b/wearable/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/wearable/common/m4/gst-plugindir.m4 b/wearable/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/wearable/common/m4/gst-valgrind.m4 b/wearable/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/wearable/common/m4/gst-x11.m4 b/wearable/common/m4/gst-x11.m4
new file mode 100644 (file)
index 0000000..d3baf2d
--- /dev/null
@@ -0,0 +1,70 @@
+dnl macros for X-related detections
+dnl AC_SUBST's HAVE_X, X_CFLAGS, X_LIBS
+AC_DEFUN([AG_GST_CHECK_X],
+[
+  AC_PATH_XTRA
+  ac_cflags_save="$CFLAGS"
+  ac_cppflags_save="$CPPFLAGS"
+  CFLAGS="$CFLAGS $X_CFLAGS"
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  dnl now try to find the HEADER
+  AC_CHECK_HEADER(X11/Xlib.h, HAVE_X="yes", HAVE_X="no")
+
+  if test "x$HAVE_X" = "xno"
+  then
+    AC_MSG_NOTICE([cannot find X11 development files])
+  else
+    dnl this is much more than we want
+    X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
+    dnl AC_PATH_XTRA only defines the path needed to find the X libs,
+    dnl it does not add the libs; therefore we add them here
+    X_LIBS="$X_LIBS -lX11"
+    AC_SUBST(X_CFLAGS)
+    AC_SUBST(X_LIBS)
+  fi
+  AC_SUBST(HAVE_X)
+
+  CFLAGS="$ac_cflags_save"
+  CPPFLAGS="$ac_cppflags_save"
+])
+
+dnl *** XVideo ***
+dnl Look for the PIC library first, Debian requires it.
+dnl Check debian-devel archives for gory details.
+dnl 20020110:
+dnl At the moment XFree86 doesn't distribute shared libXv due
+dnl to unstable API.  On many platforms you CAN NOT link a shared
+dnl lib to a static non-PIC lib.  This is what the xvideo GStreamer
+dnl plug-in wants to do.  So Debian distributes a PIC compiled
+dnl version of the static lib for plug-ins to link to when it is
+dnl inappropriate to link the main application to libXv directly.
+dnl FIXME: add check if this platform can support linking to a
+dnl        non-PIC libXv, if not then don not use Xv.
+dnl FIXME: perhaps warn user if they have a shared libXv since
+dnl        this is an error until XFree86 starts shipping one
+AC_DEFUN([AG_GST_CHECK_XV],
+[
+  if test x$HAVE_X = xyes; then
+    AC_CHECK_LIB(Xv_pic, XvQueryExtension,
+                 HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
+                 $X_LIBS -lXext)
+
+    if test x$HAVE_XVIDEO = xyes; then
+      XVIDEO_LIBS="-lXv_pic -lXext"
+      AC_SUBST(XVIDEO_LIBS)
+    else
+      dnl try again using something else if we didn't find it first
+      if test x$HAVE_XVIDEO = xno; then
+        AC_CHECK_LIB(Xv, XvQueryExtension,
+                   HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
+                   $X_LIBS -lXext)
+
+        if test x$HAVE_XVIDEO = xyes; then
+          XVIDEO_LIBS="-lXv -lXext"
+          AC_SUBST(XVIDEO_LIBS)
+        fi
+      fi
+    fi
+  fi
+])
diff --git a/wearable/common/m4/gst.m4 b/wearable/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/wearable/common/m4/gtk-doc.m4 b/wearable/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/wearable/common/m4/iconv.m4 b/wearable/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/wearable/common/m4/isc-posix.m4 b/wearable/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/wearable/common/m4/lib-ld.m4 b/wearable/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/wearable/common/m4/lib-link.m4 b/wearable/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/wearable/common/m4/lib-prefix.m4 b/wearable/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/wearable/common/m4/libtool.m4 b/wearable/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/wearable/common/m4/ltoptions.m4 b/wearable/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/wearable/common/m4/ltsugar.m4 b/wearable/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/wearable/common/m4/ltversion.m4 b/wearable/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/wearable/common/m4/lt~obsolete.m4 b/wearable/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/wearable/common/m4/pkg.m4 b/wearable/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/wearable/common/m4/progtest.m4 b/wearable/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/wearable/common/mangle-tmpl.py b/wearable/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/wearable/common/plugins.xsl b/wearable/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/wearable/common/po.mak b/wearable/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/wearable/common/release.mak b/wearable/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/wearable/common/scangobj-merge.py b/wearable/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/wearable/common/upload.mak b/wearable/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/wearable/common/win32.mak b/wearable/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/wearable/compile b/wearable/compile
new file mode 100755 (executable)
index 0000000..1b1d232
--- /dev/null
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.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, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+       # configure might choose to run compile as `compile cc -o foo foo.c'.
+       # So we strip `-o arg' only if arg is an object.
+       eat=1
+       case $2 in
+         *.o | *.obj)
+           ofile=$2
+           ;;
+         *)
+           set x "$@" -o "$2"
+           shift
+           ;;
+       esac
+       ;;
+      *.c)
+       cfile=$1
+       set x "$@" "$1"
+       shift
+       ;;
+      *)
+       set x "$@" "$1"
+       shift
+       ;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/wearable/config.guess b/wearable/config.guess
new file mode 100755 (executable)
index 0000000..40eaed4
--- /dev/null
@@ -0,0 +1,1517 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011 Free Software Foundation, Inc.
+
+timestamp='2011-05-11'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
+Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           sh5el) machine=sh5le-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep -q __ELF__
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit ;;
+    *:OpenBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    *:SolidBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Pn.n version is a patched version.
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+       exitcode=$?
+       trap '' 0
+       exit $exitcode ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+       echo powerpc-ibm-os400
+       exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7; exit ;;
+       esac ;;
+    s390x:SunOS:*:*)
+       echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+       echo i386-pc-auroraux${UNAME_RELEASE}
+       exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+       eval $set_cc_for_build
+       SUN_ARCH="i386"
+       # If there is a compiler, see if it is configured for 64-bit objects.
+       # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+       # This test works for both compilers.
+       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+           if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+               grep IS_64BIT_ARCH >/dev/null
+           then
+               SUN_ARCH="x86_64"
+           fi
+       fi
+       echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+       echo m68k-milan-mint${UNAME_RELEASE}
+       exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+       echo m68k-hades-mint${UNAME_RELEASE}
+       exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+       echo m68k-unknown-mint${UNAME_RELEASE}
+       exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit ;;
+    AViiON:dgux:*:*)
+       # DG/UX returns AViiON for all architectures
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit ;;
+    *:AIX:*:[4567])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                   sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                   case "${sc_cpu_version}" in
+                     523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                     528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                     532)                      # CPU_PA_RISC2_0
+                       case "${sc_kernel_bits}" in
+                         32) HP_ARCH="hppa2.0n" ;;
+                         64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                       esac ;;
+                   esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^            //' << EOF >$dummy.c
+
+               #define _HPUX_SOURCE
+               #include <stdlib.h>
+               #include <unistd.h>
+
+               int main ()
+               {
+               #if defined(_SC_KERNEL_BITS)
+                   long bits = sysconf(_SC_KERNEL_BITS);
+               #endif
+                   long cpu  = sysconf (_SC_CPU_VERSION);
+
+                   switch (cpu)
+                       {
+                       case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+                       case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+                       case CPU_PA_RISC2_0:
+               #if defined(_SC_KERNEL_BITS)
+                           switch (bits)
+                               {
+                               case 64: puts ("hppa2.0w"); break;
+                               case 32: puts ("hppa2.0n"); break;
+                               default: puts ("hppa2.0"); break;
+                               } break;
+               #else  /* !defined(_SC_KERNEL_BITS) */
+                           puts ("hppa2.0"); break;
+               #endif
+                       default: puts ("hppa1.0"); break;
+                       }
+                   exit (0);
+               }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep -q __LP64__
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
+       echo unknown-hitachi-hiuxwe2
+       exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+       exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+       exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+       exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+       exit ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+       echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    5000:UNIX_System_V:4.*:*)
+       FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+       FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+       echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:FreeBSD:*:*)
+       case ${UNAME_MACHINE} in
+           pc98)
+               echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           amd64)
+               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           *)
+               echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+       esac
+       exit ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit ;;
+    *:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit ;;
+    *:Interix*:*)
+       case ${UNAME_MACHINE} in
+           x86)
+               echo i586-pc-interix${UNAME_RELEASE}
+               exit ;;
+           authenticamd | genuineintel | EM64T)
+               echo x86_64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+           IA64)
+               echo ia64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+       esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit ;;
+    8664:Windows_NT:*)
+       echo x86_64-pc-mks
+       exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    *:GNU:*:*)
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+       esac
+       objdump --private-headers /bin/sh | grep -q ld.so.1
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit ;;
+    arm*:Linux:*:*)
+       eval $set_cc_for_build
+       if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+           | grep -q __ARM_EABI__
+       then
+           echo ${UNAME_MACHINE}-unknown-linux-gnu
+       else
+           if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+               | grep -q __ARM_PCS_VFP
+           then
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+           else
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+           fi
+       fi
+       exit ;;
+    avr32*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    cris:Linux:*:*)
+       echo cris-axis-linux-gnu
+       exit ;;
+    crisv32:Linux:*:*)
+       echo crisv32-axis-linux-gnu
+       exit ;;
+    frv:Linux:*:*)
+       echo frv-unknown-linux-gnu
+       exit ;;
+    i*86:Linux:*:*)
+       LIBC=gnu
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+       echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+       exit ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef ${UNAME_MACHINE}
+       #undef ${UNAME_MACHINE}el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=${UNAME_MACHINE}el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=${UNAME_MACHINE}
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    or32:Linux:*:*)
+       echo or32-unknown-linux-gnu
+       exit ;;
+    padre:Linux:*:*)
+       echo sparc-unknown-linux-gnu
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    tile*:Linux:*:*)
+       echo ${UNAME_MACHINE}-tilera-linux-gnu
+       exit ;;
+    vax:Linux:*:*)
+       echo ${UNAME_MACHINE}-dec-linux-gnu
+       exit ;;
+    x86_64:Linux:*:*)
+       echo x86_64-unknown-linux-gnu
+       exit ;;
+    xtensa*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+       # Unixware is an offshoot of SVR4, but it has its own version
+       # number series starting with 2...
+       # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+       # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+       # uname -m prints for DJGPP always 'pc', but it prints nothing about
+       # the processor, so we play safe by assuming i586.
+       # Note: whatever this is, it MUST be the same as what config.sub
+       # prints for the "djgpp" host, or else GDB configury will decide that
+       # this is a cross-build.
+       echo i586-pc-msdosdjgpp
+       exit ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+       OS_REL='.3'
+       test -r /etc/.relid \
+           && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+           && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit ;;
+    PENTIUM:*:4.0*:*)  # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                       # says <Richard.M.Bartel@ccMail.Census.GOV>
+       echo i586-unisys-sysv4
+       exit ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+       exit ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit ;;
+    BePC:Haiku:*:*)    # Haiku running on Intel PC compatible.
+       echo i586-pc-haiku
+       exit ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-7:SUPER-UX:*:*)
+       echo sx7-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8:SUPER-UX:*:*)
+       echo sx8-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8R:SUPER-UX:*:*)
+       echo sx8r-nec-superux${UNAME_RELEASE}
+       exit ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           i386)
+               eval $set_cc_for_build
+               if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+                 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+                     (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+                     grep IS_64BIT_ARCH >/dev/null
+                 then
+                     UNAME_PROCESSOR="x86_64"
+                 fi
+               fi ;;
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+       echo neo-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit ;;
+    SEI:*:*:SEIUX)
+       echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+    i*86:rdos:*:*)
+       echo ${UNAME_MACHINE}-pc-rdos
+       exit ;;
+    i*86:AROS:*:*)
+       echo ${UNAME_MACHINE}-pc-aros
+       exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+       "4"
+#else
+       ""
+#endif
+       ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    c34*)
+       echo c34-convex-bsd
+       exit ;;
+    c38*)
+       echo c38-convex-bsd
+       exit ;;
+    c4*)
+       echo c4-convex-bsd
+       exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/wearable/config.h.in b/wearable/config.h.in
new file mode 100644 (file)
index 0000000..be0c437
--- /dev/null
@@ -0,0 +1,68 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define the version */
+#undef GST_PLUGIN_VERSION
+
+/* Define the release version */
+#undef GST_PLUGIN_VERSION_RELEASE
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
diff --git a/wearable/config.sub b/wearable/config.sub
new file mode 100755 (executable)
index 0000000..30fdca8
--- /dev/null
@@ -0,0 +1,1760 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011 Free Software Foundation, Inc.
+
+timestamp='2011-03-23'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
+Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis | -knuth | -cray | -microblaze)
+               os=
+               basic_machine=$1
+               ;;
+       -bluegene*)
+               os=-cnk
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco6)
+               os=-sco5v6
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5v6*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+       | bfin \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fido | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | lm32 \
+       | m32c | m32r | m32rle | m68000 | m68k | m88k \
+       | maxq | mb | microblaze | mcore | mep | metag \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64octeon | mips64octeonel \
+       | mips64orion | mips64orionel \
+       | mips64r5900 | mips64r5900el \
+       | mips64vr | mips64vrel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | moxie \
+       | mt \
+       | msp430 \
+       | nds32 | nds32le | nds32be \
+       | nios | nios2 \
+       | ns16k | ns32k \
+       | open8 \
+       | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle \
+       | pyramid \
+       | rx \
+       | score \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+       | spu \
+       | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+       | ubicom32 \
+       | v850 | v850e \
+       | we32k \
+       | x86 | xc16x | xstormy16 | xtensa \
+       | z8k | z80)
+               basic_machine=$basic_machine-unknown
+               ;;
+       c54x)
+               basic_machine=tic54x-unknown
+               ;;
+       c55x)
+               basic_machine=tic55x-unknown
+               ;;
+       c6x)
+               basic_machine=tic6x-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+       ms1)
+               basic_machine=mt-unknown
+               ;;
+
+       strongarm | thumb | xscale)
+               basic_machine=arm-unknown
+               ;;
+
+       xscaleeb)
+               basic_machine=armeb-unknown
+               ;;
+
+       xscaleel)
+               basic_machine=armel-unknown
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* | avr32-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* \
+       | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | lm32-* \
+       | m32c-* | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64octeon-* | mips64octeonel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64r5900-* | mips64r5900el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | mt-* \
+       | msp430-* \
+       | nds32-* | nds32le-* | nds32be-* \
+       | nios-* | nios2-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | open8-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+       | pyramid-* \
+       | romp-* | rs6000-* | rx-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+       | tahoe-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tile-* | tilegx-* \
+       | tron-* \
+       | ubicom32-* \
+       | v850-* | v850e-* | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* \
+       | xstormy16-* | xtensa*-* \
+       | ymp-* \
+       | z8k-* | z80-*)
+               ;;
+       # Recognize the basic CPU types without company name, with glob match.
+       xtensa*)
+               basic_machine=$basic_machine-unknown
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aros)
+               basic_machine=i386-pc
+               os=-aros
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       blackfin)
+               basic_machine=bfin-unknown
+               os=-linux
+               ;;
+       blackfin-*)
+               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       bluegene*)
+               basic_machine=powerpc-ibm
+               os=-cnk
+               ;;
+       c54x-*)
+               basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c55x-*)
+               basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c6x-*)
+               basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       cegcc)
+               basic_machine=arm-unknown
+               os=-cegcc
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16 | cr16-*)
+               basic_machine=cr16-unknown
+               os=-elf
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       dicos)
+               basic_machine=i686-pc
+               os=-dicos
+               ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m68knommu)
+               basic_machine=m68k-unknown
+               os=-linux
+               ;;
+       m68knommu-*)
+               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       microblaze)
+               basic_machine=microblaze-xilinx
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       mingw32ce)
+               basic_machine=arm-unknown
+               os=-mingw32ce
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       ms1-*)
+               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       neo-tandem)
+               basic_machine=neo-tandem
+               ;;
+       nse-tandem)
+               basic_machine=nse-tandem
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       openrisc | openrisc-*)
+               basic_machine=or32-unknown
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       parisc)
+               basic_machine=hppa-unknown
+               os=-linux
+               ;;
+       parisc-*)
+               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       pc98-*)
+               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc | ppcbe)    basic_machine=powerpc-unknown
+               ;;
+       ppc-* | ppcbe-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rdos)
+               basic_machine=i386-pc
+               os=-rdos
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sde)
+               basic_machine=mipsisa32-sde
+               os=-elf
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh5el)
+               basic_machine=sh5le-unknown
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       strongarm-* | thumb-*)
+               basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       # This must be matched before tile*.
+       tilegx*)
+               basic_machine=tilegx-unknown
+               os=-linux-gnu
+               ;;
+       tile*)
+               basic_machine=tile-unknown
+               os=-linux-gnu
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       xscale-* | xscalee[bl]-*)
+               basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       z80-*-coff)
+               basic_machine=z80-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+       # First match some system type aliases
+       # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -auroraux)
+               os=-auroraux
+               ;;
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+             | -sym* | -kopensolaris* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* | -aros* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -openbsd* | -solidbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* | -cegcc* \
+             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -linux-android* \
+             | -linux-newlib* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+       -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+       -tpf*)
+               os=-tpf
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
+       -dicos*)
+               os=-dicos
+               ;;
+       -nacl*)
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       score-*)
+               os=-elf
+               ;;
+       spu-*)
+               os=-elf
+               ;;
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+       c4x-* | tic4x-*)
+               os=-coff
+               ;;
+       tic54x-*)
+               os=-coff
+               ;;
+       tic55x-*)
+               os=-coff
+               ;;
+       tic6x-*)
+               os=-coff
+               ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mep-*)
+               os=-elf
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-haiku)
+               os=-haiku
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -cnk*|-aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/wearable/configure b/wearable/configure
new file mode 100755 (executable)
index 0000000..19e3b6c
--- /dev/null
@@ -0,0 +1,18651 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.67 for extension 1.0.
+#
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+        /*)
+          for as_base in sh bash ksh sh5; do
+            # Try only shells that exist, to save several forks.
+            as_shell=$as_dir/$as_base
+            if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+                   { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+                  if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+          done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+             { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+       # neutralization value for shells without unset; and this also
+       # works around shells that cannot unset nonexistent variables.
+       BASH_ENV=/dev/null
+       ENV=/dev/null
+       (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+       export CONFIG_SHELL
+       exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+       test -d "$1/.";
+      else
+       case $1 in #(
+       -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$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
+
+
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='extension'
+PACKAGE_TARNAME='extension'
+PACKAGE_VERSION='1.0'
+PACKAGE_STRING='extension 1.0'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+IS_I386_FALSE
+IS_I386_TRUE
+GST_EXT_USE_EXT_TOGGLE_FALSE
+GST_EXT_USE_EXT_TOGGLE_TRUE
+DRM_SERVICE_LIBS
+DRM_SERVICE_CFLAGS
+GST_EXT_USE_EXT_DRMSRC_FALSE
+GST_EXT_USE_EXT_DRMSRC_TRUE
+CAMSRCJPEGENC_LIBS
+CAMSRCJPEGENC_CFLAGS
+AVSYSAUDIO_LIBS
+AVSYSAUDIO_CFLAGS
+GST_EXT_USE_EXT_AVSYSAUDIO_FALSE
+GST_EXT_USE_EXT_AVSYSAUDIO_TRUE
+AVSYSCAMERA_LIBS
+AVSYSCAMERA_CFLAGS
+GST_EXT_USE_EXT_AVSYSCAMERA_FALSE
+GST_EXT_USE_EXT_AVSYSCAMERA_TRUE
+GST_EXT_USE_EXT_EVASIMAGESINK_FALSE
+GST_EXT_USE_EXT_EVASIMAGESINK_TRUE
+GST_EXT_USE_EXT_AVSYSTEM_FALSE
+GST_EXT_USE_EXT_AVSYSTEM_TRUE
+GST_EXT_USE_EXT_ENCODEBIN_FALSE
+GST_EXT_USE_EXT_ENCODEBIN_TRUE
+EFL_LIBS
+EFL_CFLAGS
+MMTA_LIBS
+MMTA_CFLAGS
+GST_INTERFACES_LIBS
+GST_INTERFACES_CFLAGS
+GST_VIDEO_LIBS
+GST_VIDEO_CFLAGS
+GST_AUDIO_LIBS
+GST_AUDIO_CFLAGS
+GST_PLUGIN_LDFLAGS
+plugindir
+GSTCTRL_LIBS
+GSTCTRL_CFLAGS
+GSTPB_BASE_LIBS
+GSTPB_BASE_CFLAGS
+GST_BASE_LIBS
+GST_BASE_CFLAGS
+GST_MAJORMINOR
+GST_LIBS
+GST_CFLAGS
+PKG_CONFIG
+ISVOLANS_TARGET_FALSE
+ISVOLANS_TARGET_TRUE
+ISPROTECTOR_TARGET_FALSE
+ISPROTECTOR_TARGET_TRUE
+ISVOLANS_VODA_SDK_FALSE
+ISVOLANS_VODA_SDK_TRUE
+ISPROTECTOR_VODA_SDK_FALSE
+ISPROTECTOR_VODA_SDK_TRUE
+IS_VODA_SDK_FALSE
+IS_VODA_SDK_TRUE
+HAVE_PKGCONFIG
+CXXCPP
+CPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+lt_ECHO
+RANLIB
+AR
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+EGREP
+GREP
+SED
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+LIBTOOL
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+ACLOCAL_AMFLAGS
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+VERSION
+PACKAGE
+GST_PLUGIN_VERSION_NANO
+GST_PLUGIN_VERSION_MICRO
+GST_PLUGIN_VERSION_MINOR
+GST_PLUGIN_VERSION_MAJOR
+GST_PLUGIN_VERSION_RELEASE
+GST_PLUGIN_VERSION
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_maintainer_mode
+enable_dependency_tracking
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+enable_ext_encodebin
+enable_ext_avsystem
+enable_ext_evasimagesink
+enable_ext_gstreamer_camera
+enable_ext_gstreamer_audio
+enable_ext_drmsrc
+enable_ext_toggle
+enable_i386
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CXX
+CXXFLAGS
+CCC
+CPP
+CXXCPP
+PKG_CONFIG
+GST_CFLAGS
+GST_LIBS
+GST_BASE_CFLAGS
+GST_BASE_LIBS
+GSTPB_BASE_CFLAGS
+GSTPB_BASE_LIBS
+GSTCTRL_CFLAGS
+GSTCTRL_LIBS
+GST_AUDIO_CFLAGS
+GST_AUDIO_LIBS
+GST_VIDEO_CFLAGS
+GST_VIDEO_LIBS
+GST_INTERFACES_CFLAGS
+GST_INTERFACES_LIBS
+MMTA_CFLAGS
+MMTA_LIBS
+EFL_CFLAGS
+EFL_LIBS
+AVSYSCAMERA_CFLAGS
+AVSYSCAMERA_LIBS
+AVSYSAUDIO_CFLAGS
+AVSYSAUDIO_LIBS
+CAMSRCJPEGENC_CFLAGS
+CAMSRCJPEGENC_LIBS
+DRM_SERVICE_CFLAGS
+DRM_SERVICE_LIBS'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
+               datadir sysconfdir sharedstatedir localstatedir includedir \
+               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+               libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_myself" : 'X\(//\)[^/]' \| \
+        X"$as_myself" : 'X\(//\)$' \| \
+        X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+       cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+       pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures extension 1.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/extension]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of extension 1.0:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-maintainer-mode  enable make rules and dependencies not useful
+                         (and sometimes confusing) to the casual installer
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-ext-encodebin  using encodebin
+  --enable-ext-avsystem   using avsystem
+  --enable-ext-evasimagesink
+                          using evasimagesink
+  --enable-ext-gstreamer-camera
+                          using gstreamer-camera
+  --enable-ext-gstreamer-audio
+                          using gstreamer-audio
+  --enable-ext-drmsrc     using drmsrc
+  --enable-ext-toggle     using toggle
+  --enable-i386           i386 build
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CPP         C preprocessor
+  CXXCPP      C++ preprocessor
+  PKG_CONFIG  path to pkg-config utility
+  GST_CFLAGS  C compiler flags for GST, overriding pkg-config
+  GST_LIBS    linker flags for GST, overriding pkg-config
+  GST_BASE_CFLAGS
+              C compiler flags for GST_BASE, overriding pkg-config
+  GST_BASE_LIBS
+              linker flags for GST_BASE, overriding pkg-config
+  GSTPB_BASE_CFLAGS
+              C compiler flags for GSTPB_BASE, overriding pkg-config
+  GSTPB_BASE_LIBS
+              linker flags for GSTPB_BASE, overriding pkg-config
+  GSTCTRL_CFLAGS
+              C compiler flags for GSTCTRL, overriding pkg-config
+  GSTCTRL_LIBS
+              linker flags for GSTCTRL, overriding pkg-config
+  GST_AUDIO_CFLAGS
+              C compiler flags for GST_AUDIO, overriding pkg-config
+  GST_AUDIO_LIBS
+              linker flags for GST_AUDIO, overriding pkg-config
+  GST_VIDEO_CFLAGS
+              C compiler flags for GST_VIDEO, overriding pkg-config
+  GST_VIDEO_LIBS
+              linker flags for GST_VIDEO, overriding pkg-config
+  GST_INTERFACES_CFLAGS
+              C compiler flags for GST_INTERFACES, overriding pkg-config
+  GST_INTERFACES_LIBS
+              linker flags for GST_INTERFACES, overriding pkg-config
+  MMTA_CFLAGS C compiler flags for MMTA, overriding pkg-config
+  MMTA_LIBS   linker flags for MMTA, overriding pkg-config
+  EFL_CFLAGS  C compiler flags for EFL, overriding pkg-config
+  EFL_LIBS    linker flags for EFL, overriding pkg-config
+  AVSYSCAMERA_CFLAGS
+              C compiler flags for AVSYSCAMERA, overriding pkg-config
+  AVSYSCAMERA_LIBS
+              linker flags for AVSYSCAMERA, overriding pkg-config
+  AVSYSAUDIO_CFLAGS
+              C compiler flags for AVSYSAUDIO, overriding pkg-config
+  AVSYSAUDIO_LIBS
+              linker flags for AVSYSAUDIO, overriding pkg-config
+  CAMSRCJPEGENC_CFLAGS
+              C compiler flags for CAMSRCJPEGENC, overriding pkg-config
+  CAMSRCJPEGENC_LIBS
+              linker flags for CAMSRCJPEGENC, overriding pkg-config
+  DRM_SERVICE_CFLAGS
+              C compiler flags for DRM_SERVICE, overriding pkg-config
+  DRM_SERVICE_LIBS
+              linker flags for DRM_SERVICE, overriding pkg-config
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+extension configure 1.0
+generated by GNU Autoconf 2.67
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_cpp
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_cxx_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_link
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by extension $as_me 1.0, which was
+generated by GNU Autoconf 2.67.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+       "s/'\''/'\''\\\\'\'''\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=\$$ac_var
+       case $ac_val in
+       *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       esac
+       $as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5 ; }
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       # differences in whitespace do not lead to failure.
+       ac_old_val_w=`echo x $ac_old_val`
+       ac_new_val_w=`echo x $ac_new_val`
+       if test "$ac_old_val_w" != "$ac_new_val_w"; then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+         ac_cache_corrupted=:
+       else
+         { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+         eval $ac_var=\$ac_old_val
+       fi
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+GST_MAJORMINOR=0.10
+GST_REQUIRED=0.10.0
+GSTPB_REQUIRED=0.10.0
+EFL_REQUIRED=1.0.0
+
+
+
+  PACKAGE=gst-plugin
+  GST_PLUGIN_VERSION_MAJOR=0
+  GST_PLUGIN_VERSION_MINOR=10
+  GST_PLUGIN_VERSION_MICRO=0
+  NANO=1
+  GST_PLUGIN_VERSION_NANO=$NANO
+  if test "x$NANO" = "x" || test "x$NANO" = "x0";
+  then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: configuring gst-plugin for release" >&5
+$as_echo "$as_me: configuring gst-plugin for release" >&6;}
+      VERSION=0.10.0
+      GST_PLUGIN_VERSION_RELEASE=1
+            GST_PLUGIN_CVS="no"
+  else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: configuring gst-plugin for development with nano $NANO" >&5
+$as_echo "$as_me: configuring gst-plugin for development with nano $NANO" >&6;}
+      VERSION=0.10.0.$NANO
+      GST_PLUGIN_VERSION_RELEASE=0.`date +%Y%m%d.%H%M%S`
+            GST_PLUGIN_CVS="yes"
+  fi
+
+  GST_PLUGIN_VERSION=$VERSION
+
+cat >>confdefs.h <<_ACEOF
+#define GST_PLUGIN_VERSION "$GST_PLUGIN_VERSION"
+_ACEOF
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define GST_PLUGIN_VERSION_RELEASE "$GST_PLUGIN_VERSION_RELEASE"
+_ACEOF
+
+
+
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+    # Check whether --enable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then :
+  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
+   if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+#AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+am__api_version='1.11'
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           rm -rf conftest.one conftest.two conftest.dir
+           echo one > conftest.one
+           echo two > conftest.two
+           mkdir conftest.dir
+           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+             test -s conftest.one && test -s conftest.two &&
+             test -s conftest.dir/conftest.one &&
+             test -s conftest.dir/conftest.two
+           then
+             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+             break 3
+           fi
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+
+  done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \    ]*)
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in mkdir gmkdir; do
+        for ac_exec_ext in '' $ac_executable_extensions; do
+          { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+          case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+            'mkdir (GNU coreutils) '* | \
+            'mkdir (coreutils) '* | \
+            'mkdir (fileutils) '4.1*)
+              ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+              break 3;;
+          esac
+        done
+       done
+  done
+IFS=$as_save_IFS
+
+fi
+
+  test -d ./--version && rmdir ./--version
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+       @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='extension'
+ VERSION='1.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+#AC_CONFIG_MACRO_DIR([m4])
+
+
+ACLOCAL_AMFLAGS="-I m4 -I common/m4"
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+       ;;
+    [ab].out )
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
+    *.* )
+       if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       then :; else
+          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       fi
+       # We set ac_cv_exeext here because the later test for it is not
+       # safe: cross compilers may not add the suffix if given an `-o'
+       # argument, so we may need to know it at that point already.
+       # Even if this section looks crufty: it has the advantage of
+       # actually working.
+       break;;
+    * )
+       break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+         break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5 ; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC"   am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+        CXXFLAGS="-g"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+case `pwd` in
+  *\ * | *\    *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.2.6b'
+macro_revision='1.3017'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if test "${ac_cv_path_FGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
+   else
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in fgrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+  # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_FGREP=$FGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       # Tru64's nm complains that /dev/null is an invalid object file
+       case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+       */dev/null* | *'Invalid file or object type'*)
+         lt_cv_path_NM="$tmp_nm -B"
+         break
+         ;;
+       *)
+         case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+         */dev/null*)
+           lt_cv_path_NM="$tmp_nm -p"
+           break
+           ;;
+         *)
+           lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+           continue # so that we can try to find one that supports BSD flags
+           ;;
+         esac
+         ;;
+       esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$DUMPBIN" && break
+  done
+fi
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_DUMPBIN" && break
+done
+
+  if test "x$ac_ct_DUMPBIN" = x; then
+    DUMPBIN=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DUMPBIN=$ac_ct_DUMPBIN
+  fi
+fi
+
+
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if test "${lt_cv_nm_interface+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:5152: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:5155: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:5158: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  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
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  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
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_AR="ar"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*)
+  if test "$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 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+       mv -f "$nlist"T "$nlist"
+      else
+       rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+       if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+         cat <<_LT_EOF > conftest.$ac_ext
+#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_prog_compiler_no_builtin_flag"
+         if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+           pipe_works=yes
+         fi
+         LIBS="$lt_save_LIBS"
+         CFLAGS="$lt_save_CFLAGS"
+       else
+         echo "cannot find nm_test_func in $nlist" >&5
+       fi
+      else
+       echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -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
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+       HPUX_IA64_MODE="32"
+       ;;
+      *ELF-64*)
+       HPUX_IA64_MODE="64"
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 6364 "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -melf32bsmip"
+         ;;
+       *N32*)
+         LD="${LD-ld} -melf32bmipn32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -melf64bmip"
+       ;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+       *32-bit*)
+         LD="${LD-ld} -32"
+         ;;
+       *N32*)
+         LD="${LD-ld} -n32"
+         ;;
+       *64-bit*)
+         LD="${LD-ld} -64"
+         ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_i386_fbsd"
+           ;;
+         x86_64-*linux*)
+           LD="${LD-ld} -m elf_i386"
+           ;;
+         ppc64-*linux*|powerpc64-*linux*)
+           LD="${LD-ld} -m elf32ppclinux"
+           ;;
+         s390x-*linux*)
+           LD="${LD-ld} -m elf_s390"
+           ;;
+         sparc64-*linux*)
+           LD="${LD-ld} -m elf32_sparc"
+           ;;
+       esac
+       ;;
+      *64-bit*)
+       case $host in
+         x86_64-*kfreebsd*-gnu)
+           LD="${LD-ld} -m elf_x86_64_fbsd"
+           ;;
+         x86_64-*linux*)
+           LD="${LD-ld} -m elf_x86_64"
+           ;;
+         ppc*-*linux*|powerpc*-*linux*)
+           LD="${LD-ld} -m elf64ppc"
+           ;;
+         s390*-*linux*|s390*-*tpf*)
+           LD="${LD-ld} -m elf64_s390"
+           ;;
+         sparc*-*linux*)
+           LD="${LD-ld} -m elf64_sparc"
+           ;;
+       esac
+       ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_cc_needs_belf=yes
+else
+  lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+       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"
+
+
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
+  fi
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_LIPO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LIPO"; then
+  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_LIPO="lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    LIPO=$ac_ct_LIPO
+  fi
+else
+  LIPO="$ac_cv_prog_LIPO"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL="otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL=$ac_ct_OTOOL
+  fi
+else
+  OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL64="otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
+  fi
+else
+  OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+       # By default we will add the -single_module flag. You can override
+       # by either setting the environment variable LT_MULTI_MODULE
+       # non-empty at configure time, or by adding -multi_module to the
+       # link flags.
+       rm -rf libconftest.dylib*
+       echo "int foo(void){return 1;}" > conftest.c
+       echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+       $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+         -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+       if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+         lt_cv_apple_cc_single_mod=yes
+       else
+         cat conftest.err >&5
+       fi
+       rm -rf libconftest.dylib*
+       rm -f conftest.*
+      fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_ld_exported_symbols_list=yes
+else
+  lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+       LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    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
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+       || toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+        CXXFLAGS="-g"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX"  am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                    Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+_lt_caught_CXX_error=yes; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+else
+  _lt_caught_CXX_error=yes
+fi
+
+
+
+
+
+# Set options
+
+
+
+        enable_dlopen=no
+
+
+  enable_win32_dll=no
+
+
+            # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_shared=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+  # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_static=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+       IFS="$lt_save_ifs"
+       if test "X$pkg" = "X$p"; then
+         enable_fast_install=yes
+       fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# 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
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+       case $deplibs_check_method in
+       "file_magic "*)
+         file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+         MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+         if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+           $EGREP "$file_magic_regex" > /dev/null; then
+           :
+         else
+           cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+         fi ;;
+       esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8420: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:8424: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+
+
+
+
+
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='-fPIC'
+       ;;
+      esac
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static='-Bstatic'
+      else
+       lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+       # +Z the default
+       ;;
+      *)
+       lt_prog_compiler_pic='+Z'
+       ;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-KPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='--shared'
+       lt_prog_compiler_static='--static'
+       ;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+       # which looks to be a dead project)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fpic'
+       lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      xl*)
+       # IBM XL C 8.0/Fortran 10.1 on PPC
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-qpic'
+       lt_prog_compiler_static='-qstaticlink'
+       ;;
+      *)
+       case `$CC -V 2>&1 | sed 5q` in
+       *Sun\ C*)
+         # Sun C 5.9
+         lt_prog_compiler_pic='-KPIC'
+         lt_prog_compiler_static='-Bstatic'
+         lt_prog_compiler_wl='-Wl,'
+         ;;
+       *Sun\ F*)
+         # Sun Fortran 8.3 passes all unrecognized flags to the linker
+         lt_prog_compiler_pic='-KPIC'
+         lt_prog_compiler_static='-Bstatic'
+         lt_prog_compiler_wl=''
+         ;;
+       esac
+       ;;
+      esac
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+       lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+       lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+       lt_prog_compiler_pic='-Kconform_pic'
+       lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+
+
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8759: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:8763: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8864: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:8868: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:8919: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:8923: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  compiler_needs_object=no
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_direct_absolute=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  linux* | k*bsd*-gnu)
+    link_all_deplibs=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.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
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       allow_undefined_flag=unsupported
+       # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+       # support --undefined.  This deserves some investigation.  FIXME
+       archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+       # If the export-symbols file already is a .def file (1st line
+       # is EXPORTS), use it as is; otherwise, prepend...
+       archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname.def;
+       else
+         echo EXPORTS > $output_objdir/$soname.def;
+         cat $export_symbols >> $output_objdir/$soname.def;
+       fi~
+       $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+       case $cc_basename in
+         diet\ *) tmp_diet=yes;;       # linux-dietlibc with static linking (!diet-dyn)
+       esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+        && test "$tmp_diet" = no
+      then
+       tmp_addflag=
+       tmp_sharedflag='-shared'
+       case $cc_basename,$host_cpu in
+        pgcc*)                         # Portland Group C compiler
+         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag'
+         ;;
+       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
+         whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+         tmp_addflag=' $pic_flag -Mnomain' ;;
+       ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
+         tmp_addflag=' -i_dynamic' ;;
+       efc*,ia64* | ifort*,ia64*)      # Intel Fortran compiler on ia64
+         tmp_addflag=' -i_dynamic -nofor_main' ;;
+       ifc* | ifort*)                  # Intel Fortran compiler
+         tmp_addflag=' -nofor_main' ;;
+       lf95*)                          # Lahey Fortran 8.1
+         whole_archive_flag_spec=
+         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
+         whole_archive_flag_spec='${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'
+         compiler_needs_object=yes
+         tmp_sharedflag='-G' ;;
+       *Sun\ F*)                       # Sun Fortran 8.3
+         tmp_sharedflag='-G' ;;
+       esac
+       archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+           cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+           echo "local: *; };" >> $output_objdir/$libname.ver~
+           $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+       case $cc_basename in
+       xlf*)
+         # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+         whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+         hardcode_libdir_flag_spec=
+         hardcode_libdir_flag_spec_ld='-rpath $libdir'
+         archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+         if test "x$supports_anon_versioning" = xyes; then
+           archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+             cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+             echo "local: *; };" >> $output_objdir/$libname.ver~
+             $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+         fi
+         ;;
+       esac
+      else
+        ld_shlibs=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+       wlarc=
+      else
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+       ld_shlibs=no
+       cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+       ;;
+       *)
+         # For security reasons, it is highly recommended that you always
+         # use absolute paths for naming shared libraries, and exclude the
+         # DT_RUNPATH tag from executables and libraries.  But doing so
+         # requires that you compile everything twice, which is a pain.
+         if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+           hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+           archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+         else
+           ld_shlibs=no
+         fi
+       ;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+       archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+       ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+       # Neither direct hardcoding nor static linking is supported with a
+       # broken collect2.
+       hardcode_direct=unsupported
+      fi
+      ;;
+
+    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
+         export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+       else
+         export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+       fi
+       aix_use_runtimelinking=no
+
+       # Test if we are trying to use run time linking or normal
+       # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+       # need to do runtime linking.
+       case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+         for ld_flag in $LDFLAGS; do
+         if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+           aix_use_runtimelinking=yes
+           break
+         fi
+         done
+         ;;
+       esac
+
+       exp_sym_flag='-bexport'
+       no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_direct_absolute=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='${wl}-f,'
+
+      if test "$GCC" = yes; then
+       case $host_os in aix4.[012]|aix4.[012].*)
+       # We only want to do this on AIX 4.2 and lower, the check
+       # below for broken collect2 doesn't work under 4.3+
+         collect2name=`${CC} -print-prog-name=collect2`
+         if test -f "$collect2name" &&
+          strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+         then
+         # We have reworked collect2
+         :
+         else
+         # We have old collect2
+         hardcode_direct=unsupported
+         # It fails to find uninstalled libraries when the uninstalled
+         # path is not listed in the libpath.  Setting hardcode_minus_L
+         # to unsupported forces relinking
+         hardcode_minus_L=yes
+         hardcode_libdir_flag_spec='-L$libdir'
+         hardcode_libdir_separator=
+         fi
+         ;;
+       esac
+       shared_flag='-shared'
+       if test "$aix_use_runtimelinking" = yes; then
+         shared_flag="$shared_flag "'${wl}-G'
+       fi
+       link_all_deplibs=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
+
+      export_dynamic_flag_spec='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+       # Warning - without using the other runtime loading flags (-brtl),
+       # -berok will link without error, but may produce a broken library.
+       allow_undefined_flag='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+       /^0/ {
+           s/^0  *\(.*\)$/\1/
+           p
+       }
+    }'
+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
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+       if test "$host_cpu" = ia64; then
+         hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+         allow_undefined_flag="-z nodefs"
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+       else
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+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
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+         # Warning - without using the other run time loading flags,
+         # -berok will link without error, but may produce a broken library.
+         no_undefined_flag=' ${wl}-bernotok'
+         allow_undefined_flag=' ${wl}-berok'
+         # Exported symbols can be pulled into shared objects from archives
+         whole_archive_flag_spec='$convenience'
+         archive_cmds_need_lc=yes
+         # This is similar to how AIX traditionally builds its shared libraries.
+         archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+       fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_from_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc=no
+  hardcode_direct=no
+  hardcode_automatic=yes
+  hardcode_shlibpath_var=unsupported
+  whole_archive_flag_spec=''
+  link_all_deplibs=yes
+  allow_undefined_flag="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=echo
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+  else
+  ld_shlibs=no
+  fi
+
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+       archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+       archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+       hardcode_libdir_flag_spec_ld='+b $libdir'
+       hardcode_libdir_separator=:
+       hardcode_direct=yes
+       hardcode_direct_absolute=yes
+       export_dynamic_flag_spec='${wl}-E'
+       # hardcode_minus_L: Not really in the search PATH,
+       # but as the default location of the library.
+       hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      else
+       case $host_cpu in
+       hppa*64*)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       ia64*)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       esac
+      fi
+      if test "$with_gnu_ld" = no; then
+       hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+       hardcode_libdir_separator=:
+
+       case $host_cpu in
+       hppa*64*|ia64*)
+         hardcode_direct=no
+         hardcode_shlibpath_var=no
+         ;;
+       *)
+         hardcode_direct=yes
+         hardcode_direct_absolute=yes
+         export_dynamic_flag_spec='${wl}-E'
+
+         # hardcode_minus_L: Not really in the search PATH,
+         # but as the default location of the library.
+         hardcode_minus_L=yes
+         ;;
+       esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared $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"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo(void) {}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  archive_expsym_cmds='$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'
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+        LDFLAGS="$save_LDFLAGS"
+      else
+       archive_cmds='$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'
+       archive_expsym_cmds='$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
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+       archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+       hardcode_direct=yes
+       hardcode_shlibpath_var=no
+       hardcode_direct_absolute=yes
+       if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+         archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+         hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+         export_dynamic_flag_spec='${wl}-E'
+       else
+         case $host_os in
+          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+            archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+            hardcode_libdir_flag_spec='-R$libdir'
+            ;;
+          *)
+            archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+            hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+            ;;
+         esac
+       fi
+      else
+       ld_shlibs=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)     # as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+       allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $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'
+       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+       allow_undefined_flag=' -expect_unresolved \*'
+       archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+       archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+       $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+       # Both c and cxx compiler support -rpath directly
+       hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z defs'
+      if test "$GCC" = yes; then
+       wlarc='${wl}'
+       archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+       case `$CC -V 2>&1` in
+       *"Compilers 5.0"*)
+         wlarc=''
+         archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+         ;;
+       *)
+         wlarc='${wl}'
+         archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+         $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+         ;;
+       esac
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+       # The compiler driver will combine and reorder linker options,
+       # but understands `-z linker_flag'.  GCC discards it without `$wl',
+       # but is careful enough not to reorder.
+       # Supported since Solaris 2.6 (maybe 2.5.1?)
+       if test "$GCC" = yes; then
+         whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+       else
+         whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+       fi
+       ;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+       # Use $CC to link under sequent, because it throws in some extra .o
+       # files that make .init and .fini sections work.
+       archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+       sni)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=yes # is this really true???
+       ;;
+       siemens)
+         ## LD is ld it makes a PLAMLIB
+         ## CC just makes a GrossModule.
+         archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+         reload_cmds='$CC -r -o $output$reload_objs'
+         hardcode_direct=no
+        ;;
+       motorola)
+         archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+         hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+       ;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+       hardcode_shlibpath_var=no
+       runpath_var=LD_RUN_PATH
+       hardcode_runpath_var=yes
+       ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+       archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+       archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+       archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+       export_dynamic_flag_spec='${wl}-Blargedynsym'
+       ;;
+      esac
+    fi
+  fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+       pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+        then
+         archive_cmds_need_lc=no
+        else
+         archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+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`'
+
+  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_prog_compiler_wl\"; \
+       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
+
+  # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+   test "$inherit_rpath" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+  if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+    ;;
+
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = x""yes; then :
+  lt_cv_dlopen="shl_load"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_shl_load=yes
+else
+  ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_svld_dlopen=yes
+else
+  ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_dld_link=yes
+else
+  ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 11303 "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 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+         if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 11399 "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 { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+  # Report which library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[4-9]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+compiler_needs_object_CXX=no
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_direct_absolute_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$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.
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+  # save warnings/boilerplate of simple test code
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  compiler=$CC
+  compiler_CXX=$CC
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+  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_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+    else
+      lt_prog_compiler_no_builtin_flag_CXX=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+       ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+       test "$with_gnu_ld" != no && break
+       ;;
+      *)
+       test "$with_gnu_ld" != yes && break
+       ;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+         $GREP 'no-whole-archive' > /dev/null; then
+          whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          whole_archive_flag_spec_CXX=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+    ld_shlibs_CXX=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+      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.
+
+        archive_cmds_CXX=''
+        hardcode_direct_CXX=yes
+        hardcode_direct_absolute_CXX=yes
+        hardcode_libdir_separator_CXX=':'
+        link_all_deplibs_CXX=yes
+        file_list_spec_CXX='${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
+           hardcode_direct_CXX=unsupported
+           # It fails to find uninstalled libraries when the uninstalled
+           # path is not listed in the libpath.  Setting hardcode_minus_L
+           # to unsupported forces relinking
+           hardcode_minus_L_CXX=yes
+           hardcode_libdir_flag_spec_CXX='-L$libdir'
+           hardcode_libdir_separator_CXX=
+         fi
+          esac
+          shared_flag='-shared'
+         if test "$aix_use_runtimelinking" = yes; then
+           shared_flag="$shared_flag "'${wl}-G'
+         fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+         # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+         # chokes on -Wl,-G. The following line is correct:
+         shared_flag='-G'
+          else
+           if test "$aix_use_runtimelinking" = yes; then
+             shared_flag='${wl}-G'
+           else
+             shared_flag='${wl}-bM:SRE'
+           fi
+          fi
+        fi
+
+        export_dynamic_flag_spec_CXX='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+       # export.
+        always_export_symbols_CXX=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          allow_undefined_flag_CXX='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+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
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+          hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+           hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+           allow_undefined_flag_CXX="-z nodefs"
+           archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+           # Determine the default libpath from the value encoded in an
+           # empty executable.
+           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+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
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+           hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+           # Warning - without using the other run time loading flags,
+           # -berok will link without error, but may produce a broken library.
+           no_undefined_flag_CXX=' ${wl}-bernotok'
+           allow_undefined_flag_CXX=' ${wl}-berok'
+           # Exported symbols can be pulled into shared objects from archives
+           whole_archive_flag_spec_CXX='$convenience'
+           archive_cmds_need_lc_CXX=yes
+           # This is similar to how AIX traditionally builds its shared
+           # libraries.
+           archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+         allow_undefined_flag_CXX=unsupported
+         # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+         # support --undefined.  This deserves some investigation.  FIXME
+         archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+       else
+         ld_shlibs_CXX=no
+       fi
+       ;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+         # FIXME: insert proper C++ library support
+         ld_shlibs_CXX=no
+         ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+        # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+        # as there is no search path for DLLs.
+        hardcode_libdir_flag_spec_CXX='-L$libdir'
+        allow_undefined_flag_CXX=unsupported
+        always_export_symbols_CXX=no
+        enable_shared_with_static_runtimes_CXX=yes
+
+        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+          archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          # If the export-symbols file already is a .def file (1st line
+          # is EXPORTS), use it as is; otherwise, prepend...
+          archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+           cp $export_symbols $output_objdir/$soname.def;
+          else
+           echo EXPORTS > $output_objdir/$soname.def;
+           cat $export_symbols >> $output_objdir/$soname.def;
+          fi~
+          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        else
+          ld_shlibs_CXX=no
+        fi
+        ;;
+      darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc_CXX=no
+  hardcode_direct_CXX=no
+  hardcode_automatic_CXX=yes
+  hardcode_shlibpath_var_CXX=unsupported
+  whole_archive_flag_spec_CXX=''
+  link_all_deplibs_CXX=yes
+  allow_undefined_flag_CXX="$_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
+    archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds_CXX="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}"
+       if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      archive_expsym_cmds_CXX="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
+  ld_shlibs_CXX=no
+  fi
+
+       ;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          ghcx*)
+           # Green Hills C++ Compiler
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+        esac
+        ;;
+
+      freebsd[12]*)
+        # C++ shared libraries reported to be fairly broken before
+       # switch to ELF
+        ld_shlibs_CXX=no
+        ;;
+
+      freebsd-elf*)
+        archive_cmds_need_lc_CXX=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        ld_shlibs_CXX=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      hpux9*)
+        hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        export_dynamic_flag_spec_CXX='${wl}-E'
+        hardcode_direct_CXX=yes
+        hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                            # but as the default
+                                            # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            ld_shlibs_CXX=no
+            ;;
+          aCC*)
+            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $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
+              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              ld_shlibs_CXX=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+         hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+         hardcode_libdir_separator_CXX=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+             export_dynamic_flag_spec_CXX='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct_CXX=no
+            hardcode_shlibpath_var_CXX=no
+            ;;
+          *)
+            hardcode_direct_CXX=yes
+            hardcode_direct_absolute_CXX=yes
+            hardcode_minus_L_CXX=yes # Not in the search PATH,
+                                                # but as the default
+                                                # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          aCC*)
+           case $host_cpu in
+             hppa*64*)
+               archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             ia64*)
+               archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+             *)
+               archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+               ;;
+           esac
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+           ;;
+          *)
+           if test "$GXX" = yes; then
+             if test $with_gnu_ld = no; then
+               case $host_cpu in
+                 hppa*64*)
+                   archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 ia64*)
+                   archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+                 *)
+                   archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+                   ;;
+               esac
+             fi
+           else
+             # FIXME: insert proper C++ library support
+             ld_shlibs_CXX=no
+           fi
+           ;;
+        esac
+        ;;
+
+      interix[3-9]*)
+       hardcode_direct_CXX=no
+       hardcode_shlibpath_var_CXX=no
+       hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+       export_dynamic_flag_spec_CXX='${wl}-E'
+       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+       # Instead, shared libraries are loaded at an image base (0x10000000 by
+       # default) and relocated if they conflict, which is a slow very memory
+       # consuming and fragmenting process.  To avoid this, we pick a random,
+       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+       archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+       ;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+           # SGI C++
+           archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "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.
+           old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+           ;;
+          *)
+           if test "$GXX" = yes; then
+             if test "$with_gnu_ld" = no; then
+               archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+             else
+               archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+             fi
+           fi
+           link_all_deplibs_CXX=yes
+           ;;
+        esac
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        inherit_rpath_CXX=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.
+           archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+           archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+
+           hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+           export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+           # Archives containing C++ object files must be created using
+           # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+           old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+           ;;
+         icpc* | 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."*)
+               archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+             *)  # Version 8.0 or newer
+               tmp_idyn=
+               case $host_cpu in
+                 ia64*) tmp_idyn=' -i_dynamic';;
+               esac
+               archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+               ;;
+           esac
+           archive_cmds_need_lc_CXX=no
+           hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+           export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+           whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+           case `$CC -V` in
+           *pgCC\ [1-5]* | *pgcpp\ [1-5]*)
+             prelink_cmds_CXX='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`"'
+             old_archive_cmds_CXX='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'
+             archive_cmds_CXX='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'
+             archive_expsym_cmds_CXX='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
+             archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+             archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+             ;;
+           esac
+
+           hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+           export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+           whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+         cxx*)
+           # Compaq C++
+           archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+           runpath_var=LD_RUN_PATH
+           hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+           hardcode_libdir_separator_CXX=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "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
+           hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+           export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+           archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+           if test "x$supports_anon_versioning" = xyes; then
+             archive_expsym_cmds_CXX='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
+             no_undefined_flag_CXX=' -zdefs'
+             archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+             archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+             hardcode_libdir_flag_spec_CXX='-R$libdir'
+             whole_archive_flag_spec_CXX='${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'
+             compiler_needs_object_CXX=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.
+             old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+       ld_shlibs_CXX=no
+       ;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+       ;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+         *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+       esac
+       ;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+         archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+         wlarc=
+         hardcode_libdir_flag_spec_CXX='-R$libdir'
+         hardcode_direct_CXX=yes
+         hardcode_shlibpath_var_CXX=no
+       fi
+       # Workaround some broken pre-1.5 toolchains
+       output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+       ;;
+
+      *nto* | *qnx*)
+        ld_shlibs_CXX=yes
+       ;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+       ld_shlibs_CXX=no
+       ;;
+
+      openbsd*)
+       if test -f /usr/libexec/ld.so; then
+         hardcode_direct_CXX=yes
+         hardcode_shlibpath_var_CXX=no
+         hardcode_direct_absolute_CXX=yes
+         archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+         hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+         if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+           archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+           export_dynamic_flag_spec_CXX='${wl}-E'
+           whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+         fi
+         output_verbose_link_cmd=echo
+       else
+         ld_shlibs_CXX=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.
+           archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+           hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+           hardcode_libdir_separator_CXX=:
+
+           # Archives containing C++ object files must be created using
+           # the KAI C++ compiler.
+           case $host in
+             osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+             *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+           esac
+           ;;
+          RCC*)
+           # Rational C++ 2.4.1
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          cxx*)
+           case $host in
+             osf3*)
+               allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+               archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+               hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+               ;;
+             *)
+               allow_undefined_flag_CXX=' -expect_unresolved \*'
+               archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+               archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+                 echo "-hidden">> $lib.exp~
+                 $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+                 $RM $lib.exp'
+               hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+               ;;
+           esac
+
+           hardcode_libdir_separator_CXX=:
+
+           # Commands to make compiler produce verbose output that lists
+           # what "hidden" libraries, object files and flags are used when
+           # linking a shared library.
+           #
+           # There doesn't appear to be a way to prevent this compiler from
+           # explicitly linking system object files so we need to strip them
+           # from the output so that they don't get included in the library
+           # dependencies.
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "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
+             allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+             case $host in
+               osf3*)
+                 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 ;;
+               *)
+                 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 ;;
+             esac
+
+             hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+             hardcode_libdir_separator_CXX=:
+
+             # Commands to make compiler produce verbose output that lists
+             # what "hidden" libraries, object files and flags are used when
+             # linking a shared library.
+             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+           else
+             # FIXME: insert proper C++ library support
+             ld_shlibs_CXX=no
+           fi
+           ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+           # Sun C++ 4.x
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          lcc*)
+           # Lucid
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+            archive_cmds_need_lc_CXX=yes
+           no_undefined_flag_CXX=' -zdefs'
+           archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+           archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+             $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+           hardcode_libdir_flag_spec_CXX='-R$libdir'
+           hardcode_shlibpath_var_CXX=no
+           case $host_os in
+             solaris2.[0-5] | solaris2.[0-5].*) ;;
+             *)
+               # The compiler driver will combine and reorder linker options,
+               # but understands `-z linker_flag'.
+               # Supported since Solaris 2.6 (maybe 2.5.1?)
+               whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+               ;;
+           esac
+           link_all_deplibs_CXX=yes
+
+           output_verbose_link_cmd='echo'
+
+           # Archives containing C++ object files must be created using
+           # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+           # necessary to make sure instantiated templates are included
+           # in the archive.
+           old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+           ;;
+          gcx*)
+           # Green Hills C++ Compiler
+           archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+           # The C++ compiler must be used to create the archive.
+           old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+           ;;
+          *)
+           # GNU C++ compiler with Solaris linker
+           if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+             no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+             if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+               archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                 $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+             else
+               # g++ 2.7 appears to require `-G' NOT `-shared' on this
+               # platform.
+               archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+               archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+                 $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+               # Commands to make compiler produce verbose output that lists
+               # what "hidden" libraries, object files and flags are used when
+               # linking a shared library.
+               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+             fi
+
+             hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+             case $host_os in
+               solaris2.[0-5] | solaris2.[0-5].*) ;;
+               *)
+                 whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+                 ;;
+             esac
+           fi
+           ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_CXX='${wl}-z,text'
+      archive_cmds_need_lc_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+         archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+       *)
+         archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+         ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+       # Note: We can NOT use -z defs as we might desire, because we do not
+       # link with -lc, and that would cause any symbols used from libc to
+       # always be unresolved, which means just about no library would
+       # ever link correctly.  If we're not using GNU ld we use -z text
+       # though, which does catch some bad symbols but isn't as heavy-handed
+       # as -z defs.
+       no_undefined_flag_CXX='${wl}-z,text'
+       allow_undefined_flag_CXX='${wl}-z,nodefs'
+       archive_cmds_need_lc_CXX=no
+       hardcode_shlibpath_var_CXX=no
+       hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
+       hardcode_libdir_separator_CXX=':'
+       link_all_deplibs_CXX=yes
+       export_dynamic_flag_spec_CXX='${wl}-Bexport'
+       runpath_var='LD_RUN_PATH'
+
+       case $cc_basename in
+          CC*)
+           archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           ;;
+         *)
+           archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           ;;
+       esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+           # NonStop-UX NCC 3.20
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+          *)
+           # FIXME: insert proper C++ library support
+           ld_shlibs_CXX=no
+           ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+    esac
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+    test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+    GCC_CXX="$GXX"
+    LD_CXX="$LD"
+
+    ## 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...
+    # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  # 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 "$compiler_lib_search_path_CXX"; then
+            compiler_lib_search_path_CXX="${prev}${p}"
+          else
+            compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+          fi
+          ;;
+        # The "-l" case would never come before the object being
+        # linked, so don't bother handling this case.
+        esac
+       else
+        if test -z "$postdeps_CXX"; then
+          postdeps_CXX="${prev}${p}"
+        else
+          postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+        fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+        pre_test_object_deps_done=yes
+        continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+        if test -z "$predep_objects_CXX"; then
+          predep_objects_CXX="$p"
+        else
+          predep_objects_CXX="$predep_objects_CXX $p"
+        fi
+       else
+        if test -z "$postdep_objects_CXX"; then
+          postdep_objects_CXX="$p"
+        else
+          postdep_objects_CXX="$postdep_objects_CXX $p"
+        fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+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.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+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
+      postdeps_CXX='-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
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+ compiler_lib_search_dirs_CXX=
+if test -n "${compiler_lib_search_path_CXX}"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+       # AIX 5 now supports IA64 processor
+       lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic_CXX='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic_CXX='-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
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    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_prog_compiler_pic_CXX=-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_prog_compiler_pic_CXX='-fPIC'
+       ;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_CXX='-fPIC -shared'
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-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_prog_compiler_static_CXX='-Bstatic'
+       else
+         lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+       fi
+       ;;
+      chorus*)
+       case $cc_basename in
+       cxch68*)
+         # Green Hills C++ Compiler
+         # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+         ;;
+       esac
+       ;;
+      dgux*)
+       case $cc_basename in
+         ec++*)
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         ghcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      freebsd* | dragonfly*)
+       # FreeBSD uses GNU C++
+       ;;
+      hpux9* | hpux10* | hpux11*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+           if test "$host_cpu" != ia64; then
+             lt_prog_compiler_pic_CXX='+Z'
+           fi
+           ;;
+         aCC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+           case $host_cpu in
+           hppa*64*|ia64*)
+             # +Z the default
+             ;;
+           *)
+             lt_prog_compiler_pic_CXX='+Z'
+             ;;
+           esac
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      interix*)
+       # This is c89, which is MS Visual C++ (no shared libs)
+       # Anyone wants to do a port?
+       ;;
+      irix5* | irix6* | nonstopux*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_static_CXX='-non_shared'
+           # CC pic flag -KPIC is the default.
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+       case $cc_basename in
+         KCC*)
+           # KAI C++ Compiler
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           lt_prog_compiler_pic_CXX='-fPIC'
+           ;;
+         ecpc* )
+           # old Intel C++ for x86_64 which still supported -KPIC.
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-static'
+           ;;
+         icpc* )
+           # Intel C++, used to be incompatible with GCC.
+           # ICC 10 doesn't accept -KPIC any more.
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-fPIC'
+           lt_prog_compiler_static_CXX='-static'
+           ;;
+         pgCC* | pgcpp*)
+           # Portland Group C++ compiler
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-fpic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         cxx*)
+           # Compaq C++
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         xlc* | xlC*)
+           # IBM XL 8.0 on PPC
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-qpic'
+           lt_prog_compiler_static_CXX='-qstaticlink'
+           ;;
+         *)
+           case `$CC -V 2>&1 | sed 5q` in
+           *Sun\ C*)
+             # Sun C++ 5.9
+             lt_prog_compiler_pic_CXX='-KPIC'
+             lt_prog_compiler_static_CXX='-Bstatic'
+             lt_prog_compiler_wl_CXX='-Qoption ld '
+             ;;
+           esac
+           ;;
+       esac
+       ;;
+      lynxos*)
+       ;;
+      m88k*)
+       ;;
+      mvs*)
+       case $cc_basename in
+         cxx*)
+           lt_prog_compiler_pic_CXX='-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_prog_compiler_pic_CXX='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+       case $cc_basename in
+         KCC*)
+           lt_prog_compiler_wl_CXX='--backend -Wl,'
+           ;;
+         RCC*)
+           # Rational C++ 2.4.1
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         cxx*)
+           # Digital/Compaq C++
+           lt_prog_compiler_wl_CXX='-Wl,'
+           # Make sure the PIC flag is empty.  It appears that all Alpha
+           # Linux and Compaq Tru64 Unix objects are PIC.
+           lt_prog_compiler_pic_CXX=
+           lt_prog_compiler_static_CXX='-non_shared'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      psos*)
+       ;;
+      solaris*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.2, 5.x and Centerline C++
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           lt_prog_compiler_wl_CXX='-Qoption ld '
+           ;;
+         gcx*)
+           # Green Hills C++ Compiler
+           lt_prog_compiler_pic_CXX='-PIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sunos4*)
+       case $cc_basename in
+         CC*)
+           # Sun C++ 4.x
+           lt_prog_compiler_pic_CXX='-pic'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+         lcc*)
+           # Lucid
+           lt_prog_compiler_pic_CXX='-pic'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+       case $cc_basename in
+         CC*)
+           lt_prog_compiler_wl_CXX='-Wl,'
+           lt_prog_compiler_pic_CXX='-KPIC'
+           lt_prog_compiler_static_CXX='-Bstatic'
+           ;;
+       esac
+       ;;
+      tandem*)
+       case $cc_basename in
+         NCC*)
+           # NonStop-UX NCC 3.20
+           lt_prog_compiler_pic_CXX='-KPIC'
+           ;;
+         *)
+           ;;
+       esac
+       ;;
+      vxworks*)
+       ;;
+      *)
+       lt_prog_compiler_can_build_shared_CXX=no
+       ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_prog_compiler_pic_CXX" >&6; }
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works_CXX=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:13355: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:13359: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   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:13454: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:13458: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   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:13506: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:13510: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  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
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw* | cegcc*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
+    link_all_deplibs_CXX=no
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+with_gnu_ld_CXX=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+       pic_flag=$lt_prog_compiler_pic_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+        then
+         archive_cmds_need_lc_CXX=no
+        else
+         archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_CXX" >&5
+$as_echo "$archive_cmds_need_lc_CXX" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+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`'
+
+  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_prog_compiler_wl_CXX\"; \
+       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
+
+  # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+   test -n "$runpath_var_CXX" ||
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink ||
+   test "$inherit_rpath_CXX" = 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
+
+
+
+
+
+
+
+  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_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+        ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if compiler understands -Wall" >&5
+$as_echo_n "checking to see if compiler understands -Wall... " >&6; }
+
+  save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -Wall"
+
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  flag_ok=yes
+else
+  flag_ok=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$save_CFLAGS"
+
+  if test "X$flag_ok" = Xyes ; then
+    GST_WALL="yes"
+    true
+  else
+    GST_WALL="no"
+    true
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag_ok" >&5
+$as_echo "$flag_ok" >&6; }
+
+
+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
+
+# Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_HAVE_PKGCONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$HAVE_PKGCONFIG"; then
+  ac_cv_prog_HAVE_PKGCONFIG="$HAVE_PKGCONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_HAVE_PKGCONFIG="yes"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_HAVE_PKGCONFIG" && ac_cv_prog_HAVE_PKGCONFIG="no"
+fi
+fi
+HAVE_PKGCONFIG=$ac_cv_prog_HAVE_PKGCONFIG
+if test -n "$HAVE_PKGCONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_PKGCONFIG" >&5
+$as_echo "$HAVE_PKGCONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+if test "x$HAVE_PKGCONFIG" = "xno"; then
+  as_fn_error $? "you need to have pkgconfig installed !" "$LINENO" 5
+fi
+
+ if test "x$DISTRO" = "xvodafone-sdk"; then
+  IS_VODA_SDK_TRUE=
+  IS_VODA_SDK_FALSE='#'
+else
+  IS_VODA_SDK_TRUE='#'
+  IS_VODA_SDK_FALSE=
+fi
+
+ if test "x$DISTRO" = "xvodafone-sdk" && test "x$MACHINE" = "xprotector"; then
+  ISPROTECTOR_VODA_SDK_TRUE=
+  ISPROTECTOR_VODA_SDK_FALSE='#'
+else
+  ISPROTECTOR_VODA_SDK_TRUE='#'
+  ISPROTECTOR_VODA_SDK_FALSE=
+fi
+
+ if test "x$DISTRO" = "xvodafone-sdk" && test "x$MACHINE" = "xvolans"; then
+  ISVOLANS_VODA_SDK_TRUE=
+  ISVOLANS_VODA_SDK_FALSE='#'
+else
+  ISVOLANS_VODA_SDK_TRUE='#'
+  ISVOLANS_VODA_SDK_FALSE=
+fi
+
+ if test "x$ARCH" = "xarm" && test "x$MACHINE" = "xprotector"; then
+  ISPROTECTOR_TARGET_TRUE=
+  ISPROTECTOR_TARGET_FALSE='#'
+else
+  ISPROTECTOR_TARGET_TRUE='#'
+  ISPROTECTOR_TARGET_FALSE=
+fi
+
+ if test "x$ARCH" = "xarm" && test "x$MACHINE" = "xvolans"; then
+  ISVOLANS_TARGET_TRUE=
+  ISVOLANS_TARGET_FALSE='#'
+else
+  ISVOLANS_TARGET_TRUE='#'
+  ISVOLANS_TARGET_FALSE=
+fi
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=0.9.0
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       else
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+               PKG_CONFIG=""
+       fi
+
+fi
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GST" >&5
+$as_echo_n "checking for GST... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_CFLAGS"; then
+        pkg_cv_GST_CFLAGS="$GST_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\\
+  gstreamer-\$GST_MAJORMINOR >= \$GST_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "\
+  gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_CFLAGS=`$PKG_CONFIG --cflags "\
+  gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_LIBS"; then
+        pkg_cv_GST_LIBS="$GST_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\\
+  gstreamer-\$GST_MAJORMINOR >= \$GST_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "\
+  gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_LIBS=`$PKG_CONFIG --libs "\
+  gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       GST_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "\
+  gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$GST_PKG_ERRORS" 1>&5
+
+       HAVE_GST=no
+elif test $pkg_failed = untried; then
+       HAVE_GST=no
+else
+       GST_CFLAGS=$pkg_cv_GST_CFLAGS
+       GST_LIBS=$pkg_cv_GST_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       HAVE_GST=yes
+fi
+
+if test "x$HAVE_GST" = "xno"; then
+  as_fn_error $? "you need gstreamer development packages installed !" "$LINENO" 5
+fi
+
+GST_CFLAGS="$GST_CFLAGS $GST_ERROR"
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GST" >&5
+$as_echo_n "checking for GST... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_CFLAGS"; then
+        pkg_cv_GST_CFLAGS="$GST_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-0.10 >= 0.10\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-0.10 >= 0.10") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-0.10 >= 0.10" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_LIBS"; then
+        pkg_cv_GST_LIBS="$GST_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-0.10 >= 0.10\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-0.10 >= 0.10") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_LIBS=`$PKG_CONFIG --libs "gstreamer-0.10 >= 0.10" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       GST_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-0.10 >= 0.10"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$GST_PKG_ERRORS" 1>&5
+
+       as_fn_error $? "Package requirements (gstreamer-0.10 >= 0.10) 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 GST_CFLAGS and GST_LIBS environment variables
+to avoid the need to call pkg-config.  See the pkg-config man page for
+more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively you may set the GST_CFLAGS and GST_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>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       GST_CFLAGS=$pkg_cv_GST_CFLAGS
+       GST_LIBS=$pkg_cv_GST_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       :
+fi
+
+
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GST_BASE" >&5
+$as_echo_n "checking for GST_BASE... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_BASE_CFLAGS"; then
+        pkg_cv_GST_BASE_CFLAGS="$GST_BASE_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-base-\$GST_MAJORMINOR >= \$GST_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_BASE_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_BASE_LIBS"; then
+        pkg_cv_GST_BASE_LIBS="$GST_BASE_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-base-\$GST_MAJORMINOR >= \$GST_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_BASE_LIBS=`$PKG_CONFIG --libs "gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       GST_BASE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$GST_BASE_PKG_ERRORS" 1>&5
+
+       HAVE_GST_BASE=no
+elif test $pkg_failed = untried; then
+       HAVE_GST_BASE=no
+else
+       GST_BASE_CFLAGS=$pkg_cv_GST_BASE_CFLAGS
+       GST_BASE_LIBS=$pkg_cv_GST_BASE_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       HAVE_GST_BASE=yes
+fi
+
+if test "x$HAVE_GST_BASE" = "xno"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: no GStreamer base class libraries found (gstreamer-base-$GST_MAJORMINOR)" >&5
+$as_echo "$as_me: no GStreamer base class libraries found (gstreamer-base-$GST_MAJORMINOR)" >&6;}
+fi
+
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GSTPB_BASE" >&5
+$as_echo_n "checking for GSTPB_BASE... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GSTPB_BASE_CFLAGS"; then
+        pkg_cv_GSTPB_BASE_CFLAGS="$GSTPB_BASE_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-plugins-base-\$GST_MAJORMINOR >= \$GSTPB_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPB_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GSTPB_BASE_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPB_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GSTPB_BASE_LIBS"; then
+        pkg_cv_GSTPB_BASE_LIBS="$GSTPB_BASE_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-plugins-base-\$GST_MAJORMINOR >= \$GSTPB_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPB_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GSTPB_BASE_LIBS=`$PKG_CONFIG --libs "gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPB_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       GSTPB_BASE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPB_REQUIRED"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$GSTPB_BASE_PKG_ERRORS" 1>&5
+
+       HAVE_GSTPB_BASE=no
+elif test $pkg_failed = untried; then
+       HAVE_GSTPB_BASE=no
+else
+       GSTPB_BASE_CFLAGS=$pkg_cv_GSTPB_BASE_CFLAGS
+       GSTPB_BASE_LIBS=$pkg_cv_GSTPB_BASE_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       HAVE_GSTPB_BASE=yes
+fi
+
+if test "x$HAVE_GSTPB_BASE" = "xno"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: no GStreamer Plugins Base libraries found (gstreamer-plugins-base-$GST_MAJORMINOR)" >&5
+$as_echo "$as_me: no GStreamer Plugins Base libraries found (gstreamer-plugins-base-$GST_MAJORMINOR)" >&6;}
+fi
+
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GSTCTRL" >&5
+$as_echo_n "checking for GSTCTRL... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GSTCTRL_CFLAGS"; then
+        pkg_cv_GSTCTRL_CFLAGS="$GSTCTRL_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-controller-\$GST_MAJORMINOR >= \$GSTPB_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-controller-$GST_MAJORMINOR >= $GSTPB_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GSTCTRL_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-controller-$GST_MAJORMINOR >= $GSTPB_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GSTCTRL_LIBS"; then
+        pkg_cv_GSTCTRL_LIBS="$GSTCTRL_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-controller-\$GST_MAJORMINOR >= \$GSTPB_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-controller-$GST_MAJORMINOR >= $GSTPB_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GSTCTRL_LIBS=`$PKG_CONFIG --libs "gstreamer-controller-$GST_MAJORMINOR >= $GSTPB_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       GSTCTRL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-controller-$GST_MAJORMINOR >= $GSTPB_REQUIRED"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$GSTCTRL_PKG_ERRORS" 1>&5
+
+       HAVE_GSTCTRL=no
+elif test $pkg_failed = untried; then
+       HAVE_GSTCTRL=no
+else
+       GSTCTRL_CFLAGS=$pkg_cv_GSTCTRL_CFLAGS
+       GSTCTRL_LIBS=$pkg_cv_GSTCTRL_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       HAVE_GSTCTRL=yes
+fi
+
+if test "x$HAVE_GSTCTRL" = "xno"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: no GStreamer Controller libraries found (gstreamer-controller-$GST_MAJORMINOR)" >&5
+$as_echo "$as_me: no GStreamer Controller libraries found (gstreamer-controller-$GST_MAJORMINOR)" >&6;}
+fi
+
+
+
+
+if test "x${prefix}" = "x$HOME"; then
+  plugindir="$HOME/.gstreamer-$GST_MAJORMINOR/plugins"
+else
+  plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
+fi
+
+
+#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'
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GST_AUDIO" >&5
+$as_echo_n "checking for GST_AUDIO... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_AUDIO_CFLAGS"; then
+        pkg_cv_GST_AUDIO_CFLAGS="$GST_AUDIO_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-audio-\$GST_MAJORMINOR >= \$GST_REQUIRED \""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-audio-$GST_MAJORMINOR >= $GST_REQUIRED ") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_AUDIO_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-audio-$GST_MAJORMINOR >= $GST_REQUIRED " 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_AUDIO_LIBS"; then
+        pkg_cv_GST_AUDIO_LIBS="$GST_AUDIO_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-audio-\$GST_MAJORMINOR >= \$GST_REQUIRED \""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-audio-$GST_MAJORMINOR >= $GST_REQUIRED ") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_AUDIO_LIBS=`$PKG_CONFIG --libs "gstreamer-audio-$GST_MAJORMINOR >= $GST_REQUIRED " 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       GST_AUDIO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-audio-$GST_MAJORMINOR >= $GST_REQUIRED "`
+       # Put the nasty error message in config.log where it belongs
+       echo "$GST_AUDIO_PKG_ERRORS" 1>&5
+
+       as_fn_error $? "Package requirements (gstreamer-audio-$GST_MAJORMINOR >= $GST_REQUIRED ) 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 GST_AUDIO_CFLAGS and GST_AUDIO_LIBS environment variables
+to avoid the need to call pkg-config.  See the pkg-config man page for
+more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively you may set the GST_AUDIO_CFLAGS and GST_AUDIO_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>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       GST_AUDIO_CFLAGS=$pkg_cv_GST_AUDIO_CFLAGS
+       GST_AUDIO_LIBS=$pkg_cv_GST_AUDIO_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       :
+fi
+
+
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GST_VIDEO" >&5
+$as_echo_n "checking for GST_VIDEO... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_VIDEO_CFLAGS"; then
+        pkg_cv_GST_VIDEO_CFLAGS="$GST_VIDEO_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-video-\$GST_MAJORMINOR >= \$GST_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-video-$GST_MAJORMINOR >= $GST_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_VIDEO_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-video-$GST_MAJORMINOR >= $GST_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_VIDEO_LIBS"; then
+        pkg_cv_GST_VIDEO_LIBS="$GST_VIDEO_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-video-\$GST_MAJORMINOR >= \$GST_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-video-$GST_MAJORMINOR >= $GST_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_VIDEO_LIBS=`$PKG_CONFIG --libs "gstreamer-video-$GST_MAJORMINOR >= $GST_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       GST_VIDEO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-video-$GST_MAJORMINOR >= $GST_REQUIRED"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$GST_VIDEO_PKG_ERRORS" 1>&5
+
+       as_fn_error $? "Package requirements (gstreamer-video-$GST_MAJORMINOR >= $GST_REQUIRED) 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 GST_VIDEO_CFLAGS and GST_VIDEO_LIBS environment variables
+to avoid the need to call pkg-config.  See the pkg-config man page for
+more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively you may set the GST_VIDEO_CFLAGS and GST_VIDEO_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>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       GST_VIDEO_CFLAGS=$pkg_cv_GST_VIDEO_CFLAGS
+       GST_VIDEO_LIBS=$pkg_cv_GST_VIDEO_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       :
+fi
+
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GST_INTERFACES" >&5
+$as_echo_n "checking for GST_INTERFACES... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_INTERFACES_CFLAGS"; then
+        pkg_cv_GST_INTERFACES_CFLAGS="$GST_INTERFACES_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-interfaces-\$GST_MAJORMINOR >= \$GST_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-interfaces-$GST_MAJORMINOR >= $GST_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_INTERFACES_CFLAGS=`$PKG_CONFIG --cflags "gstreamer-interfaces-$GST_MAJORMINOR >= $GST_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$GST_INTERFACES_LIBS"; then
+        pkg_cv_GST_INTERFACES_LIBS="$GST_INTERFACES_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gstreamer-interfaces-\$GST_MAJORMINOR >= \$GST_REQUIRED\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "gstreamer-interfaces-$GST_MAJORMINOR >= $GST_REQUIRED") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GST_INTERFACES_LIBS=`$PKG_CONFIG --libs "gstreamer-interfaces-$GST_MAJORMINOR >= $GST_REQUIRED" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       GST_INTERFACES_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gstreamer-interfaces-$GST_MAJORMINOR >= $GST_REQUIRED"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$GST_INTERFACES_PKG_ERRORS" 1>&5
+
+       as_fn_error $? "Package requirements (gstreamer-interfaces-$GST_MAJORMINOR >= $GST_REQUIRED) 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 GST_INTERFACES_CFLAGS and GST_INTERFACES_LIBS environment variables
+to avoid the need to call pkg-config.  See the pkg-config man page for
+more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively you may set the GST_INTERFACES_CFLAGS and GST_INTERFACES_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>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       GST_INTERFACES_CFLAGS=$pkg_cv_GST_INTERFACES_CFLAGS
+       GST_INTERFACES_LIBS=$pkg_cv_GST_INTERFACES_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       :
+fi
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MMTA" >&5
+$as_echo_n "checking for MMTA... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$MMTA_CFLAGS"; then
+        pkg_cv_MMTA_CFLAGS="$MMTA_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mm-ta\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "mm-ta") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_MMTA_CFLAGS=`$PKG_CONFIG --cflags "mm-ta" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$MMTA_LIBS"; then
+        pkg_cv_MMTA_LIBS="$MMTA_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mm-ta\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "mm-ta") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_MMTA_LIBS=`$PKG_CONFIG --libs "mm-ta" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       MMTA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "mm-ta"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$MMTA_PKG_ERRORS" 1>&5
+
+       as_fn_error $? "Package requirements (mm-ta) 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 MMTA_CFLAGS and MMTA_LIBS environment variables
+to avoid the need to call pkg-config.  See the pkg-config man page for
+more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively you may set the MMTA_CFLAGS and MMTA_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>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       MMTA_CFLAGS=$pkg_cv_MMTA_CFLAGS
+       MMTA_LIBS=$pkg_cv_MMTA_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       :
+fi
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EFL" >&5
+$as_echo_n "checking for EFL... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$EFL_CFLAGS"; then
+        pkg_cv_EFL_CFLAGS="$EFL_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"
+  evas >= \$EFL_REQUIRED
+  ecore >= \$EFL_REQUIRED
+  ecore-x >= \$EFL_REQUIRED
+\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "
+  evas >= $EFL_REQUIRED
+  ecore >= $EFL_REQUIRED
+  ecore-x >= $EFL_REQUIRED
+") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_EFL_CFLAGS=`$PKG_CONFIG --cflags "
+  evas >= $EFL_REQUIRED
+  ecore >= $EFL_REQUIRED
+  ecore-x >= $EFL_REQUIRED
+" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$EFL_LIBS"; then
+        pkg_cv_EFL_LIBS="$EFL_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"
+  evas >= \$EFL_REQUIRED
+  ecore >= \$EFL_REQUIRED
+  ecore-x >= \$EFL_REQUIRED
+\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "
+  evas >= $EFL_REQUIRED
+  ecore >= $EFL_REQUIRED
+  ecore-x >= $EFL_REQUIRED
+") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_EFL_LIBS=`$PKG_CONFIG --libs "
+  evas >= $EFL_REQUIRED
+  ecore >= $EFL_REQUIRED
+  ecore-x >= $EFL_REQUIRED
+" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       EFL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "
+  evas >= $EFL_REQUIRED
+  ecore >= $EFL_REQUIRED
+  ecore-x >= $EFL_REQUIRED
+"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$EFL_PKG_ERRORS" 1>&5
+
+
+  as_fn_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.
+  " "$LINENO" 5
+
+elif test $pkg_failed = untried; then
+
+  as_fn_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.
+  " "$LINENO" 5
+
+else
+       EFL_CFLAGS=$pkg_cv_EFL_CFLAGS
+       EFL_LIBS=$pkg_cv_EFL_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+
+
+fi
+
+
+# Check whether --enable-ext-encodebin was given.
+if test "${enable_ext_encodebin+set}" = set; then :
+  enableval=$enable_ext_encodebin;
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_ENCODEBIN=yes ;;
+      no)  GST_EXT_USE_EXT_ENCODEBIN=no ;;
+      *)   as_fn_error $? "bad value ${enableval} for --enable-ext-encodebin" "$LINENO" 5  ;;
+    esac
+
+else
+  GST_EXT_USE_EXT_ENCODEBIN=yes
+fi
+
+ if test "x$GST_EXT_USE_EXT_ENCODEBIN" = "xyes"; then
+  GST_EXT_USE_EXT_ENCODEBIN_TRUE=
+  GST_EXT_USE_EXT_ENCODEBIN_FALSE='#'
+else
+  GST_EXT_USE_EXT_ENCODEBIN_TRUE='#'
+  GST_EXT_USE_EXT_ENCODEBIN_FALSE=
+fi
+
+
+# Check whether --enable-ext-avsystem was given.
+if test "${enable_ext_avsystem+set}" = set; then :
+  enableval=$enable_ext_avsystem;
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_AVSYSTEM=yes ;;
+      no)  GST_EXT_USE_EXT_AVSYSTEM=no ;;
+      *)   as_fn_error $? "bad value ${enableval} for --enable-ext-avsystem" "$LINENO" 5  ;;
+    esac
+
+else
+  GST_EXT_USE_EXT_AVSYSTEM=yes
+fi
+
+ if test "x$GST_EXT_USE_EXT_AVSYSTEM" = "xyes"; then
+  GST_EXT_USE_EXT_AVSYSTEM_TRUE=
+  GST_EXT_USE_EXT_AVSYSTEM_FALSE='#'
+else
+  GST_EXT_USE_EXT_AVSYSTEM_TRUE='#'
+  GST_EXT_USE_EXT_AVSYSTEM_FALSE=
+fi
+
+
+# Check whether --enable-ext-evasimagesink was given.
+if test "${enable_ext_evasimagesink+set}" = set; then :
+  enableval=$enable_ext_evasimagesink;
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_EVASIMAGESINK=yes ;;
+      no)  GST_EXT_USE_EXT_EVASIMAGESINK=no ;;
+      *)   as_fn_error $? "bad value ${enableval} for --enable-ext-evasimagesink" "$LINENO" 5  ;;
+    esac
+
+else
+  GST_EXT_USE_EXT_EVASIMAGESINK=yes
+fi
+
+ if test "x$GST_EXT_USE_EXT_EVASIMAGESINK" = "xyes"; then
+  GST_EXT_USE_EXT_EVASIMAGESINK_TRUE=
+  GST_EXT_USE_EXT_EVASIMAGESINK_FALSE='#'
+else
+  GST_EXT_USE_EXT_EVASIMAGESINK_TRUE='#'
+  GST_EXT_USE_EXT_EVASIMAGESINK_FALSE=
+fi
+
+
+# Check whether --enable-ext-gstreamer-camera was given.
+if test "${enable_ext_gstreamer_camera+set}" = set; then :
+  enableval=$enable_ext_gstreamer_camera;
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_AVSYSCAMERA=yes ;;
+      no)  GST_EXT_USE_EXT_AVSYSCAMERA=no ;;
+      *)   as_fn_error $? "bad value ${enableval} for --enable-ext-gstreamer-camera" "$LINENO" 5  ;;
+    esac
+
+else
+  GST_EXT_USE_EXT_AVSYSCAMERA=yes
+fi
+
+ if test "x$GST_EXT_USE_EXT_AVSYSCAMERA" = "xyes"; then
+  GST_EXT_USE_EXT_AVSYSCAMERA_TRUE=
+  GST_EXT_USE_EXT_AVSYSCAMERA_FALSE='#'
+else
+  GST_EXT_USE_EXT_AVSYSCAMERA_TRUE='#'
+  GST_EXT_USE_EXT_AVSYSCAMERA_FALSE=
+fi
+
+
+if test "x$GST_EXT_USE_EXT_AVSYSCAMERA" = "xyes"; then
+       HAVE_AVSYSCAMERA=NO
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVSYSCAMERA" >&5
+$as_echo_n "checking for AVSYSCAMERA... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$AVSYSCAMERA_CFLAGS"; then
+        pkg_cv_AVSYSCAMERA_CFLAGS="$AVSYSCAMERA_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"avsyscamera\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "avsyscamera") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_AVSYSCAMERA_CFLAGS=`$PKG_CONFIG --cflags "avsyscamera" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$AVSYSCAMERA_LIBS"; then
+        pkg_cv_AVSYSCAMERA_LIBS="$AVSYSCAMERA_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"avsyscamera\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "avsyscamera") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_AVSYSCAMERA_LIBS=`$PKG_CONFIG --libs "avsyscamera" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       AVSYSCAMERA_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "avsyscamera"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$AVSYSCAMERA_PKG_ERRORS" 1>&5
+
+
+           HAVE_AVSYSCAMERA="no"
+           { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+elif test $pkg_failed = untried; then
+
+           HAVE_AVSYSCAMERA="no"
+           { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+else
+       AVSYSCAMERA_CFLAGS=$pkg_cv_AVSYSCAMERA_CFLAGS
+       AVSYSCAMERA_LIBS=$pkg_cv_AVSYSCAMERA_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       HAVE_AVSYSCAMERA="yes"
+fi
+       if test "x$HAVE_AVSYSCAMERA" = "xno"; then
+         as_fn_error $? "no avsyscamera package found" "$LINENO" 5
+       fi
+
+
+fi
+
+# Check whether --enable-ext-gstreamer-audio was given.
+if test "${enable_ext_gstreamer_audio+set}" = set; then :
+  enableval=$enable_ext_gstreamer_audio;
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_AVSYSAUDIO=yes ;;
+      no)  GST_EXT_USE_EXT_AVSYSAUDIO=no ;;
+      *)   as_fn_error $? "bad value ${enableval} for --enable-ext-gstreamer-audio" "$LINENO" 5  ;;
+    esac
+
+else
+  GST_EXT_USE_EXT_AVSYSAUDIO=yes
+fi
+
+ if test "x$GST_EXT_USE_EXT_AVSYSAUDIO" = "xyes"; then
+  GST_EXT_USE_EXT_AVSYSAUDIO_TRUE=
+  GST_EXT_USE_EXT_AVSYSAUDIO_FALSE='#'
+else
+  GST_EXT_USE_EXT_AVSYSAUDIO_TRUE='#'
+  GST_EXT_USE_EXT_AVSYSAUDIO_FALSE=
+fi
+
+
+if test "x$GST_EXT_USE_EXT_AVSYSAUDIO" = "xyes"; then
+       HAVE_AVSYSAUDIO=NO
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVSYSAUDIO" >&5
+$as_echo_n "checking for AVSYSAUDIO... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$AVSYSAUDIO_CFLAGS"; then
+        pkg_cv_AVSYSAUDIO_CFLAGS="$AVSYSAUDIO_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"avsysaudio\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "avsysaudio") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_AVSYSAUDIO_CFLAGS=`$PKG_CONFIG --cflags "avsysaudio" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$AVSYSAUDIO_LIBS"; then
+        pkg_cv_AVSYSAUDIO_LIBS="$AVSYSAUDIO_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"avsysaudio\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "avsysaudio") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_AVSYSAUDIO_LIBS=`$PKG_CONFIG --libs "avsysaudio" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       AVSYSAUDIO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "avsysaudio"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$AVSYSAUDIO_PKG_ERRORS" 1>&5
+
+
+           HAVE_AVSYSAUDIO="no"
+           { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+elif test $pkg_failed = untried; then
+
+           HAVE_AVSYSAUDIO="no"
+           { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+else
+       AVSYSAUDIO_CFLAGS=$pkg_cv_AVSYSAUDIO_CFLAGS
+       AVSYSAUDIO_LIBS=$pkg_cv_AVSYSAUDIO_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       HAVE_AVSYSAUDIO="yes"
+fi
+       if test "x$HAVE_AVSYSAUDIO" = "xno"; then
+         as_fn_error $? "no avsysaudio package found" "$LINENO" 5
+       fi
+
+
+fi
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CAMSRCJPEGENC" >&5
+$as_echo_n "checking for CAMSRCJPEGENC... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$CAMSRCJPEGENC_CFLAGS"; then
+        pkg_cv_CAMSRCJPEGENC_CFLAGS="$CAMSRCJPEGENC_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"camsrcjpegenc\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "camsrcjpegenc") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_CAMSRCJPEGENC_CFLAGS=`$PKG_CONFIG --cflags "camsrcjpegenc" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$CAMSRCJPEGENC_LIBS"; then
+        pkg_cv_CAMSRCJPEGENC_LIBS="$CAMSRCJPEGENC_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"camsrcjpegenc\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "camsrcjpegenc") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_CAMSRCJPEGENC_LIBS=`$PKG_CONFIG --libs "camsrcjpegenc" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       CAMSRCJPEGENC_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "camsrcjpegenc"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$CAMSRCJPEGENC_PKG_ERRORS" 1>&5
+
+       as_fn_error $? "Package requirements (camsrcjpegenc) 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 CAMSRCJPEGENC_CFLAGS and CAMSRCJPEGENC_LIBS environment variables
+to avoid the need to call pkg-config.  See the pkg-config man page for
+more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively you may set the CAMSRCJPEGENC_CFLAGS and CAMSRCJPEGENC_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>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       CAMSRCJPEGENC_CFLAGS=$pkg_cv_CAMSRCJPEGENC_CFLAGS
+       CAMSRCJPEGENC_LIBS=$pkg_cv_CAMSRCJPEGENC_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       :
+fi
+
+
+
+# Check whether --enable-ext-drmsrc was given.
+if test "${enable_ext_drmsrc+set}" = set; then :
+  enableval=$enable_ext_drmsrc;
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_DRMSRC=yes ;;
+      no)  GST_EXT_USE_EXT_DRMSRC=no ;;
+      *)   as_fn_error $? "bad value ${enableval} for --enable-ext-drmsrc" "$LINENO" 5  ;;
+    esac
+
+else
+  GST_EXT_USE_EXT_DRMSRC=yes
+fi
+
+ if test "x$GST_EXT_USE_EXT_DRMSRC" = "xyes"; then
+  GST_EXT_USE_EXT_DRMSRC_TRUE=
+  GST_EXT_USE_EXT_DRMSRC_FALSE='#'
+else
+  GST_EXT_USE_EXT_DRMSRC_TRUE='#'
+  GST_EXT_USE_EXT_DRMSRC_FALSE=
+fi
+
+
+if test "x$GST_EXT_USE_EXT_DRMSRC" = "xyes"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DRM_SERVICE" >&5
+$as_echo_n "checking for DRM_SERVICE... " >&6; }
+
+if test -n "$PKG_CONFIG"; then
+    if test -n "$DRM_SERVICE_CFLAGS"; then
+        pkg_cv_DRM_SERVICE_CFLAGS="$DRM_SERVICE_CFLAGS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"drm-service\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "drm-service") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DRM_SERVICE_CFLAGS=`$PKG_CONFIG --cflags "drm-service" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+if test -n "$PKG_CONFIG"; then
+    if test -n "$DRM_SERVICE_LIBS"; then
+        pkg_cv_DRM_SERVICE_LIBS="$DRM_SERVICE_LIBS"
+    else
+        if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"drm-service\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "drm-service") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_DRM_SERVICE_LIBS=`$PKG_CONFIG --libs "drm-service" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+    fi
+else
+       pkg_failed=untried
+fi
+
+if test $pkg_failed = yes; then
+       DRM_SERVICE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "drm-service"`
+       # Put the nasty error message in config.log where it belongs
+       echo "$DRM_SERVICE_PKG_ERRORS" 1>&5
+
+       as_fn_error $? "Package requirements (drm-service) 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 DRM_SERVICE_CFLAGS and DRM_SERVICE_LIBS environment variables
+to avoid the need to call pkg-config.  See the pkg-config man page for
+more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively you may set the DRM_SERVICE_CFLAGS and DRM_SERVICE_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>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       DRM_SERVICE_CFLAGS=$pkg_cv_DRM_SERVICE_CFLAGS
+       DRM_SERVICE_LIBS=$pkg_cv_DRM_SERVICE_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       :
+fi
+
+
+fi
+
+# Check whether --enable-ext-toggle was given.
+if test "${enable_ext_toggle+set}" = set; then :
+  enableval=$enable_ext_toggle;
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_TOGGLE=yes ;;
+      no)  GST_EXT_USE_EXT_TOGGLE=no ;;
+      *)   as_fn_error $? "bad value ${enableval} for --enable-ext-toggle" "$LINENO" 5  ;;
+    esac
+
+else
+  GST_EXT_USE_EXT_TOGGLE=yes
+fi
+
+ if test "x$GST_EXT_USE_EXT_TOGGLE" = "xyes"; then
+  GST_EXT_USE_EXT_TOGGLE_TRUE=
+  GST_EXT_USE_EXT_TOGGLE_FALSE='#'
+else
+  GST_EXT_USE_EXT_TOGGLE_TRUE='#'
+  GST_EXT_USE_EXT_TOGGLE_FALSE=
+fi
+
+
+# Check whether --enable-i386 was given.
+if test "${enable_i386+set}" = set; then :
+  enableval=$enable_i386;
+        case "${enableval}" in
+         yes) IS_I386=yes ;;
+         no)  IS_I386=no ;;
+         *)   as_fn_error $? "bad value ${enableval} for --enable-i386" "$LINENO" 5  ;;
+        esac
+
+else
+  IS_I386=no
+fi
+
+ if test "x$IS_I386" = "xyes"; then
+  IS_I386_TRUE=
+  IS_I386_FALSE='#'
+else
+  IS_I386_TRUE='#'
+  IS_I386_FALSE=
+fi
+
+
+ac_config_files="$ac_config_files Makefile common/Makefile common/m4/Makefile avsystem/Makefile avsystem/src/Makefile encodebin/Makefile encodebin/src/Makefile evasimagesink/Makefile evasimagesink/src/Makefile toggle/Makefile toggle/src/Makefile drmsrc/Makefile drmsrc/src/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
+  as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${IS_VODA_SDK_TRUE}" && test -z "${IS_VODA_SDK_FALSE}"; then
+  as_fn_error $? "conditional \"IS_VODA_SDK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ISPROTECTOR_VODA_SDK_TRUE}" && test -z "${ISPROTECTOR_VODA_SDK_FALSE}"; then
+  as_fn_error $? "conditional \"ISPROTECTOR_VODA_SDK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ISVOLANS_VODA_SDK_TRUE}" && test -z "${ISVOLANS_VODA_SDK_FALSE}"; then
+  as_fn_error $? "conditional \"ISVOLANS_VODA_SDK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ISPROTECTOR_TARGET_TRUE}" && test -z "${ISPROTECTOR_TARGET_FALSE}"; then
+  as_fn_error $? "conditional \"ISPROTECTOR_TARGET\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ISVOLANS_TARGET_TRUE}" && test -z "${ISVOLANS_TARGET_FALSE}"; then
+  as_fn_error $? "conditional \"ISVOLANS_TARGET\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GST_EXT_USE_EXT_ENCODEBIN_TRUE}" && test -z "${GST_EXT_USE_EXT_ENCODEBIN_FALSE}"; then
+  as_fn_error $? "conditional \"GST_EXT_USE_EXT_ENCODEBIN\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GST_EXT_USE_EXT_AVSYSTEM_TRUE}" && test -z "${GST_EXT_USE_EXT_AVSYSTEM_FALSE}"; then
+  as_fn_error $? "conditional \"GST_EXT_USE_EXT_AVSYSTEM\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GST_EXT_USE_EXT_EVASIMAGESINK_TRUE}" && test -z "${GST_EXT_USE_EXT_EVASIMAGESINK_FALSE}"; then
+  as_fn_error $? "conditional \"GST_EXT_USE_EXT_EVASIMAGESINK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GST_EXT_USE_EXT_AVSYSCAMERA_TRUE}" && test -z "${GST_EXT_USE_EXT_AVSYSCAMERA_FALSE}"; then
+  as_fn_error $? "conditional \"GST_EXT_USE_EXT_AVSYSCAMERA\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GST_EXT_USE_EXT_AVSYSAUDIO_TRUE}" && test -z "${GST_EXT_USE_EXT_AVSYSAUDIO_FALSE}"; then
+  as_fn_error $? "conditional \"GST_EXT_USE_EXT_AVSYSAUDIO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GST_EXT_USE_EXT_DRMSRC_TRUE}" && test -z "${GST_EXT_USE_EXT_DRMSRC_FALSE}"; then
+  as_fn_error $? "conditional \"GST_EXT_USE_EXT_DRMSRC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${GST_EXT_USE_EXT_TOGGLE_TRUE}" && test -z "${GST_EXT_USE_EXT_TOGGLE_FALSE}"; then
+  as_fn_error $? "conditional \"GST_EXT_USE_EXT_TOGGLE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${IS_I386_TRUE}" && test -z "${IS_I386_FALSE}"; then
+  as_fn_error $? "conditional \"IS_I386\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+       test -d "$1/.";
+      else
+       case $1 in #(
+       -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by extension $as_me 1.0, which was
+generated by GNU Autoconf 2.67.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to the package provider."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+extension config.status 1.0
+configured by $0, generated by GNU Autoconf 2.67,
+  with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=?*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
+    esac
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+  --help | --hel | -h )
+    $as_echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+  *) as_fn_append ac_config_targets " $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
+  export CONFIG_SHELL
+  exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
+LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "X$compiler_lib_search_dirs" | $Xsed -e "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "X$predep_objects" | $Xsed -e "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "X$postdep_objects" | $Xsed -e "$delay_single_quote_subst"`'
+predeps='`$ECHO "X$predeps" | $Xsed -e "$delay_single_quote_subst"`'
+postdeps='`$ECHO "X$postdeps" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "X$compiler_lib_search_path" | $Xsed -e "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "X$LD_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "X$old_archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "X$compiler_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "X$GCC_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "X$lt_prog_compiler_no_builtin_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "X$lt_prog_compiler_wl_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "X$lt_prog_compiler_pic_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "X$lt_prog_compiler_static_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "X$lt_cv_prog_compiler_c_o_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "X$archive_cmds_need_lc_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "X$enable_shared_with_static_runtimes_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "X$export_dynamic_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "X$whole_archive_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "X$compiler_needs_object_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "X$old_archive_from_new_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "X$old_archive_from_expsyms_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "X$archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "X$archive_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "X$module_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "X$module_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "X$with_gnu_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "X$allow_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "X$no_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "X$hardcode_libdir_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld_CXX='`$ECHO "X$hardcode_libdir_flag_spec_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "X$hardcode_libdir_separator_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "X$hardcode_direct_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "X$hardcode_direct_absolute_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "X$hardcode_minus_L_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "X$hardcode_shlibpath_var_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "X$hardcode_automatic_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "X$inherit_rpath_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "X$link_all_deplibs_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path_CXX='`$ECHO "X$fix_srcfile_path_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "X$always_export_symbols_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "X$export_symbols_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "X$exclude_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "X$include_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "X$prelink_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "X$file_list_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "X$hardcode_action_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "X$compiler_lib_search_dirs_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "X$predep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "X$postdep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "X$predeps_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "X$postdeps_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "X$compiler_lib_search_path_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+SHELL \
+ECHO \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+finish_eval \
+old_striplib \
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+compiler_CXX \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_static_CXX \
+lt_cv_prog_compiler_c_o_CXX \
+export_dynamic_flag_spec_CXX \
+whole_archive_flag_spec_CXX \
+compiler_needs_object_CXX \
+with_gnu_ld_CXX \
+allow_undefined_flag_CXX \
+no_undefined_flag_CXX \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_flag_spec_ld_CXX \
+hardcode_libdir_separator_CXX \
+fix_srcfile_path_CXX \
+exclude_expsyms_CXX \
+include_expsyms_CXX \
+file_list_spec_CXX \
+compiler_lib_search_dirs_CXX \
+predep_objects_CXX \
+postdep_objects_CXX \
+predeps_CXX \
+postdeps_CXX \
+compiler_lib_search_path_CXX; 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 reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec \
+old_archive_cmds_CXX \
+old_archive_from_new_cmds_CXX \
+old_archive_from_expsyms_cmds_CXX \
+archive_cmds_CXX \
+archive_expsym_cmds_CXX \
+module_cmds_CXX \
+module_expsym_cmds_CXX \
+export_symbols_cmds_CXX \
+prelink_cmds_CXX; 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"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+  ;;
+esac
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# 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
+
+
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'
+
+
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;;
+    "common/m4/Makefile") CONFIG_FILES="$CONFIG_FILES common/m4/Makefile" ;;
+    "avsystem/Makefile") CONFIG_FILES="$CONFIG_FILES avsystem/Makefile" ;;
+    "avsystem/src/Makefile") CONFIG_FILES="$CONFIG_FILES avsystem/src/Makefile" ;;
+    "encodebin/Makefile") CONFIG_FILES="$CONFIG_FILES encodebin/Makefile" ;;
+    "encodebin/src/Makefile") CONFIG_FILES="$CONFIG_FILES encodebin/src/Makefile" ;;
+    "evasimagesink/Makefile") CONFIG_FILES="$CONFIG_FILES evasimagesink/Makefile" ;;
+    "evasimagesink/src/Makefile") CONFIG_FILES="$CONFIG_FILES evasimagesink/src/Makefile" ;;
+    "toggle/Makefile") CONFIG_FILES="$CONFIG_FILES toggle/Makefile" ;;
+    "toggle/src/Makefile") CONFIG_FILES="$CONFIG_FILES toggle/src/Makefile" ;;
+    "drmsrc/Makefile") CONFIG_FILES="$CONFIG_FILES drmsrc/Makefile" ;;
+    "drmsrc/src/Makefile") CONFIG_FILES="$CONFIG_FILES drmsrc/src/Makefile" ;;
+
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
+else
+  ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  . ./conf$$subs.sh ||
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = "\a"
+
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
+
+  print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=[    ]*/{
+h
+s///
+s/^/:/
+s/[     ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[  ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[      ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_t"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[    ]*#[    ]*define[       ][      ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = "\a"
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+        # (if the path is not absolute).  The absolute path cannot be DOS-style,
+        # because $ac_f cannot contain `:'.
+        test -f "$ac_f" ||
+          case $ac_f in
+          [\\/$]*) false;;
+          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+          esac ||
+          as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      as_fn_append ac_file_inputs " '$ac_f'"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input='Generated from '`
+         $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+       `' by configure.'
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+    fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  as_dir="$ac_dir"; as_fn_mkdir_p
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+  s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  esac \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+  if test x"$ac_file" != x-; then
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+    } >"$tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f "$ac_file"
+      mv "$tmp/config.h" "$ac_file" \
+       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    fi
+  else
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
+  fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$_am_arg" : 'X\(//\)[^/]' \| \
+        X"$_am_arg" : 'X\(//\)$' \| \
+        X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+ ;;
+    "libtool":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.
+#
+#   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.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags="CXX "
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### 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
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  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"`
+}
+
+
+# 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
+
+
+  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"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
+ ;;
+
+  esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/wearable/configure.ac b/wearable/configure.ac
new file mode 100755 (executable)
index 0000000..9239bfc
--- /dev/null
@@ -0,0 +1,487 @@
+
+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(TBM, libtbm)
+AC_SUBST(TBM_CFLAGS)
+AC_SUBST(TBM_LIBS)
+
+dnl use time analysis module
+PKG_CHECK_MODULES(MMTA, mm-ta)
+AC_SUBST(MMTA_CFLAGS)
+AC_SUBST(MMTA_LIBS)
+
+PKG_CHECK_MODULES(XML2, libxml-2.0)
+AC_SUBST(XML2_CFLAGS)
+AC_SUBST(XML2_LIBS)
+
+dnl required package for evasimagesink/evaspixmapsink
+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 *** belows are related to evaspixmapsink plug-ins ***
+AG_GST_ARG_WITH_PACKAGE_NAME
+AG_GST_ARG_WITH_PACKAGE_ORIGIN
+
+dnl set license and copyright notice
+GST_LICENSE="LGPL"
+AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
+AC_SUBST(GST_LICENSE)
+
+echo
+AC_MSG_NOTICE([Checking libraries for evaspixmapsink plugin])
+echo
+dnl *** X11 ***
+translit(dnm, m, l) AM_CONDITIONAL(USE_X, true)
+AG_GST_CHECK_FEATURE(X, [X libraries and plugins],
+                  [evaspixmapsink], [
+  AC_PATH_XTRA
+  ac_cflags_save="$CFLAGS"
+  ac_cppflags_save="$CPPFLAGS"
+  CFLAGS="$CFLAGS $X_CFLAGS"
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  dnl now try to find the HEADER
+  AC_CHECK_HEADER(X11/Xlib.h, HAVE_X="yes", HAVE_X="no")
+
+  if test "x$HAVE_X" = "xno"
+  then
+    AC_MSG_NOTICE([cannot find X11 development files])
+  else
+    dnl this is much more than we want
+    X_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS"
+    dnl AC_PATH_XTRA only defines the path needed to find the X libs,
+    dnl it does not add the libs; therefore we add them here
+    X_LIBS="$X_LIBS -lX11"
+    AC_SUBST(X_CFLAGS)
+    AC_SUBST(X_LIBS)
+  fi
+  AC_SUBST(HAVE_X)
+  CFLAGS="$ac_cflags_save"
+  CPPFLAGS="$ac_cppflags_save"
+])
+
+dnl Check for Xv extension
+translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
+AG_GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions],
+                  [evaspixmapsink], [
+AG_GST_CHECK_XV
+])
+
+dnl check for X Shm
+translit(dnm, m, l) AM_CONDITIONAL(USE_XSHM, true)
+AG_GST_CHECK_FEATURE(XSHM, [X Shared Memory extension], , [
+  if test x$HAVE_X = xyes; then
+    AC_CHECK_LIB(Xext, XShmAttach,
+                HAVE_XSHM="yes", HAVE_XSHM="no",
+                $X_LIBS)
+    if test "x$HAVE_XSHM" = "xyes"; then
+      XSHM_LIBS="-lXext"
+    else
+      dnl On AIX, it is in XextSam instead, but we still need -lXext
+      AC_CHECK_LIB(XextSam, XShmAttach,
+                  HAVE_XSHM="yes", HAVE_XSHM="no",
+                  $X_LIBS)
+      if test "x$HAVE_XSHM" = "xyes"; then
+       XSHM_LIBS="-lXext -lXextSam"
+      fi
+    fi
+  fi
+], , [
+  AC_SUBST(HAVE_XSHM)
+  AC_SUBST(XSHM_LIBS)
+])
+
+dnl use tbm
+PKG_CHECK_MODULES(TBM, libtbm)
+AC_SUBST(TBM_CFLAGS)
+AC_SUBST(TBM_LIBS)
+
+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 evaspixmapsink ---------------------------------------------------------------------------
+AC_ARG_ENABLE(ext-evaspixmapsink, AC_HELP_STRING([--enable-ext-evaspixmapsink], [using evaspixmapsink]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_EVASPIXMAPSINK=yes ;;
+      no)  GST_EXT_USE_EXT_EVASPIXMAPSINK=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-evaspixmapsink) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_EVASPIXMAPSINK=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_EVASPIXMAPSINK, test "x$GST_EXT_USE_EXT_EVASPIXMAPSINK" = "xyes")
+
+AC_ARG_ENABLE([qc-specific], AC_HELP_STRING([--enable-qc-specific], [Enable QC changes for WFD]),
+       [
+        case "${enableval}" in
+         yes) IS_QC_SPECIFIC=yes ;;
+         no)  IS_QC_SPECIFIC=no ;;
+         *)   AC_MSG_ERROR(bad value ${enableval} for --enable-qc-specific) ;;
+        esac
+       ],
+       [IS_QC_SPECIFIC=no])
+AM_CONDITIONAL([IS_QC_SPECIFIC], [test "x$IS_QC_SPECIFIC" = "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-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")
+
+dnl use ext-dashdemux -----------------------------------------------------------------------
+AC_ARG_ENABLE(ext-dashdemux, AC_HELP_STRING([--enable-ext-dashdemux], [using dashdemux]),
+  [
+    case "${enableval}" in
+      yes) GST_EXT_USE_EXT_DASHDEMUX=yes ;;
+      no)  GST_EXT_USE_EXT_DASHDEMUX=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ext-dashdemux) ;;
+    esac
+  ],
+  [GST_EXT_USE_EXT_DASHDEMUX=yes])
+AM_CONDITIONAL(GST_EXT_USE_EXT_DASHDEMUX, test "x$GST_EXT_USE_EXT_DASHDEMUX" = "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
+evaspixmapsink/Makefile
+xvimagesrc/Makefile
+xvimagesrc/src/Makefile
+toggle/Makefile
+toggle/src/Makefile
+audiotp/Makefile
+audiotp/src/Makefile
+audioeq/Makefile
+audioeq/src/Makefile
+dashdemux/Makefile
+dashdemux/src/Makefile
+)
diff --git a/wearable/control.in b/wearable/control.in
new file mode 100644 (file)
index 0000000..6f18ad6
--- /dev/null
@@ -0,0 +1,11 @@
+Package: gst-plugins-extention-@MACHINE@
+Priority: optional
+Version: @VERSION@
+Section: middleware
+Architecture: @ARCH@
+Maintainer: Heechul jeon <heechul.jeon@samsung.com>
+Source: xo
+Depends:
+Description: Gstreamer package for multimedia framework middleware package
+
+:
diff --git a/wearable/dashdemux/Makefile.am b/wearable/dashdemux/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/wearable/dashdemux/src/Makefile.am b/wearable/dashdemux/src/Makefile.am
new file mode 100644 (file)
index 0000000..892762d
--- /dev/null
@@ -0,0 +1,23 @@
+
+plugin_LTLIBRARIES = libgstdashdemux.la
+
+libgstdashdemux_la_SOURCES =                   \
+       gstmpdparser.c                          \
+       gstdashdemux.c                          \
+       gstfragment.c                           \
+       gsturidownloader.c                      \
+       gstplugin.c
+
+# headers we need but don't want installed
+noinst_HEADERS =             \
+        gstmpdparser.h                 \
+       gstfragmented.h                 \
+       gstfragment.h                   \
+       gstdashdemux.h                  \
+       gsturidownloader.h
+
+# compiler and linker flags used to compile this plugin, set in configure.ac
+libgstdashdemux_la_CFLAGS = $(GST_CFLAGS) 
+libgstdashdemux_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
+libgstdashdemux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstdashdemux_la_LIBTOOLFLAGS = --tag=disable-static
diff --git a/wearable/dashdemux/src/Makefile.in b/wearable/dashdemux/src/Makefile.in
new file mode 100644 (file)
index 0000000..7d81648
--- /dev/null
@@ -0,0 +1,605 @@
+# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = src
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(plugindir)"
+LTLIBRARIES = $(plugin_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libgstdashdemux_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
+am_libgstdashdemux_la_OBJECTS = libgstdashdemux_la-gstmpdparser.lo \
+       libgstdashdemux_la-gstdashdemux.lo \
+       libgstdashdemux_la-gstfragment.lo \
+       libgstdashdemux_la-gsturidownloader.lo \
+       libgstdashdemux_la-gstplugin.lo
+libgstdashdemux_la_OBJECTS = $(am_libgstdashdemux_la_OBJECTS)
+libgstdashdemux_la_LINK = $(LIBTOOL) --tag=CC \
+       $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
+       $(CCLD) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) \
+       $(libgstdashdemux_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+SOURCES = $(libgstdashdemux_la_SOURCES)
+DIST_SOURCES = $(libgstdashdemux_la_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GST_CFLAGS = @GST_CFLAGS@
+GST_LIBS = @GST_LIBS@
+GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
+HAVE_PKGCONFIG = @HAVE_PKGCONFIG@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+plugindir = @plugindir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+plugin_LTLIBRARIES = libgstdashdemux.la
+libgstdashdemux_la_SOURCES = \
+       gstmpdparser.c                          \
+       gstdashdemux.c                          \
+       gstfragment.c                           \
+       gsturidownloader.c                      \
+       gstplugin.c
+
+
+# headers we need but don't want installed
+noinst_HEADERS = \
+        gstmpdparser.h                 \
+       gstfragmented.h                 \
+       gstfragment.h                   \
+       gstdashdemux.h                  \
+       gsturidownloader.h
+
+
+# compiler and linker flags used to compile this plugin, set in configure.ac
+libgstdashdemux_la_CFLAGS = $(GST_CFLAGS) 
+libgstdashdemux_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
+libgstdashdemux_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstdashdemux_la_LIBTOOLFLAGS = --tag=disable-static
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+       $(am__cd) $(top_srcdir) && \
+         $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
+       @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+       list2=; for p in $$list; do \
+         if test -f $$p; then \
+           list2="$$list2 $$p"; \
+         else :; fi; \
+       done; \
+       test -z "$$list2" || { \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
+       }
+
+uninstall-pluginLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+       for p in $$list; do \
+         $(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
+       done
+
+clean-pluginLTLIBRARIES:
+       -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+       @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libgstdashdemux.la: $(libgstdashdemux_la_OBJECTS) $(libgstdashdemux_la_DEPENDENCIES) $(EXTRA_libgstdashdemux_la_DEPENDENCIES) 
+       $(libgstdashdemux_la_LINK) -rpath $(plugindir) $(libgstdashdemux_la_OBJECTS) $(libgstdashdemux_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdashdemux_la-gstdashdemux.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdashdemux_la-gstfragment.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdashdemux_la-gstmpdparser.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdashdemux_la-gstplugin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgstdashdemux_la-gsturidownloader.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+libgstdashdemux_la-gstmpdparser.lo: gstmpdparser.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -MT libgstdashdemux_la-gstmpdparser.lo -MD -MP -MF $(DEPDIR)/libgstdashdemux_la-gstmpdparser.Tpo -c -o libgstdashdemux_la-gstmpdparser.lo `test -f 'gstmpdparser.c' || echo '$(srcdir)/'`gstmpdparser.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libgstdashdemux_la-gstmpdparser.Tpo $(DEPDIR)/libgstdashdemux_la-gstmpdparser.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gstmpdparser.c' object='libgstdashdemux_la-gstmpdparser.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -c -o libgstdashdemux_la-gstmpdparser.lo `test -f 'gstmpdparser.c' || echo '$(srcdir)/'`gstmpdparser.c
+
+libgstdashdemux_la-gstdashdemux.lo: gstdashdemux.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -MT libgstdashdemux_la-gstdashdemux.lo -MD -MP -MF $(DEPDIR)/libgstdashdemux_la-gstdashdemux.Tpo -c -o libgstdashdemux_la-gstdashdemux.lo `test -f 'gstdashdemux.c' || echo '$(srcdir)/'`gstdashdemux.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libgstdashdemux_la-gstdashdemux.Tpo $(DEPDIR)/libgstdashdemux_la-gstdashdemux.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gstdashdemux.c' object='libgstdashdemux_la-gstdashdemux.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -c -o libgstdashdemux_la-gstdashdemux.lo `test -f 'gstdashdemux.c' || echo '$(srcdir)/'`gstdashdemux.c
+
+libgstdashdemux_la-gstfragment.lo: gstfragment.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -MT libgstdashdemux_la-gstfragment.lo -MD -MP -MF $(DEPDIR)/libgstdashdemux_la-gstfragment.Tpo -c -o libgstdashdemux_la-gstfragment.lo `test -f 'gstfragment.c' || echo '$(srcdir)/'`gstfragment.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libgstdashdemux_la-gstfragment.Tpo $(DEPDIR)/libgstdashdemux_la-gstfragment.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gstfragment.c' object='libgstdashdemux_la-gstfragment.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -c -o libgstdashdemux_la-gstfragment.lo `test -f 'gstfragment.c' || echo '$(srcdir)/'`gstfragment.c
+
+libgstdashdemux_la-gsturidownloader.lo: gsturidownloader.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -MT libgstdashdemux_la-gsturidownloader.lo -MD -MP -MF $(DEPDIR)/libgstdashdemux_la-gsturidownloader.Tpo -c -o libgstdashdemux_la-gsturidownloader.lo `test -f 'gsturidownloader.c' || echo '$(srcdir)/'`gsturidownloader.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libgstdashdemux_la-gsturidownloader.Tpo $(DEPDIR)/libgstdashdemux_la-gsturidownloader.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gsturidownloader.c' object='libgstdashdemux_la-gsturidownloader.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -c -o libgstdashdemux_la-gsturidownloader.lo `test -f 'gsturidownloader.c' || echo '$(srcdir)/'`gsturidownloader.c
+
+libgstdashdemux_la-gstplugin.lo: gstplugin.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -MT libgstdashdemux_la-gstplugin.lo -MD -MP -MF $(DEPDIR)/libgstdashdemux_la-gstplugin.Tpo -c -o libgstdashdemux_la-gstplugin.lo `test -f 'gstplugin.c' || echo '$(srcdir)/'`gstplugin.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libgstdashdemux_la-gstplugin.Tpo $(DEPDIR)/libgstdashdemux_la-gstplugin.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='gstplugin.c' object='libgstdashdemux_la-gstplugin.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(libgstdashdemux_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgstdashdemux_la_CFLAGS) $(CFLAGS) -c -o libgstdashdemux_la-gstplugin.lo `test -f 'gstplugin.c' || echo '$(srcdir)/'`gstplugin.c
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       set x; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       shift; \
+       if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         if test $$# -gt 0; then \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             "$$@" $$unique; \
+         else \
+           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+             $$unique; \
+         fi; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && $(am__cd) $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d "$(distdir)/$$file"; then \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+           fi; \
+           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+         else \
+           test -f "$(distdir)/$$file" \
+           || cp -p $$d/$$file "$(distdir)/$$file" \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(plugindir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       if test -z '$(STRIP)'; then \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+             install; \
+       else \
+         $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+           install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+           "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+       fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
+       mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+       clean-libtool clean-pluginLTLIBRARIES ctags distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-dvi \
+       install-dvi-am install-exec install-exec-am install-html \
+       install-html-am install-info install-info-am install-man \
+       install-pdf install-pdf-am install-pluginLTLIBRARIES \
+       install-ps install-ps-am install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am uninstall-pluginLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/wearable/dashdemux/src/glibcompat.h b/wearable/dashdemux/src/glibcompat.h
new file mode 100755 (executable)
index 0000000..3f8951c
--- /dev/null
@@ -0,0 +1,48 @@
+/*\r
+ * glibcompat.h\r
+ *\r
+ * Copyright (C) 2013 Douglas Gore <doug@ssonic.co.uk>\r
+ *\r
+ * Authors:\r
+ *   Douglas Gore <doug@ssonic.co.uk>\r
+ *\r
+ * This library is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU Library General Public\r
+ * License as published by the Free Software Foundation; either\r
+ * version 2 of the License, or (at your option) any later version.\r
+ *\r
+ * This library 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 GNU\r
+ * Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this library; if not, write to the\r
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r
+ * Boston, MA 02111-1307, USA.\r
+ */\r
+\r
+#ifndef GLIBCOMPAT_H_\r
+#define GLIBCOMPAT_H_\r
+\r
+/* The GLib threading API changed in 2.32, these macros are used to\r
+ * provide backwards compatibility with older versions without\r
+ * complicating the code. */\r
+\r
+#include <glib.h>\r
+\r
+#if (GLIB_CHECK_VERSION (2, 32, 0))\r
+    #define G_MUTEX GMutex\r
+    #define G_MUTEX_INIT(mutex) g_mutex_init(&mutex)\r
+    #define G_MUTEX_CLEAR(mutex) g_mutex_clear (&mutex);\r
+    #define G_MUTEX_LOCK(mutex) g_mutex_lock (&mutex)\r
+    #define G_MUTEX_UNLOCK(mutex) g_mutex_unlock (&mutex)\r
+#else\r
+    #define G_MUTEX GMutex*\r
+    #define G_MUTEX_INIT(mutex) mutex = g_mutex_new()\r
+    #define G_MUTEX_CLEAR(mutex) g_mutex_free (mutex)\r
+    #define G_MUTEX_LOCK(mutex) g_mutex_lock (mutex)\r
+    #define G_MUTEX_UNLOCK(mutex) g_mutex_unlock (mutex)\r
+#endif\r
+\r
+#endif /* GLIBCOMPAT_H_ */\r
diff --git a/wearable/dashdemux/src/gstdashdemux.c b/wearable/dashdemux/src/gstdashdemux.c
new file mode 100755 (executable)
index 0000000..d3460e1
--- /dev/null
@@ -0,0 +1,1864 @@
+/*
+ * DASH demux plugin for GStreamer
+ *
+ * gstdashdemux.c
+ *
+ * Copyright (C) 2012 Orange
+ *
+ * Authors:
+ *   David Corvoysier <david.corvoysier@orange.com>
+ *   Hamid Zakari <hamid.zakari@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library (COPYING); if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/**
+ * SECTION:element-dashdemux
+ *
+ * DASH demuxer element.
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch playbin2 uri="http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/RedBullPlayStreets/redbull_4s/RedBullPlayStreets_4s_isoffmain_DIS_23009_1_v_2_1c2_2011_08_30.mpd"
+ * ]|
+ */
+
+/* Implementation notes:
+ *
+ * The following section describes how dashdemux works internally.
+ *
+ * Introduction:
+ *
+ * dashdemux is a "fake" demux, as unlike traditional demux elements, it
+ * doesn't split data streams contained in an enveloppe to expose them
+ * to downstream decoding elements.
+ *
+ * Instead, it parses an XML file called a manifest to identify a set of
+ * individual stream fragments it needs to fetch and expose to the actual
+ * demux elements that will handle them (this behavior is sometimes
+ * referred as the "demux after a demux" scenario).
+ *
+ * For a given section of content, several representations corresponding
+ * to different bitrates may be available: dashdemux will select the most
+ * appropriate representation based on local conditions (typically the
+ * available bandwidth and the amount of buffering available, capped by
+ * a maximum allowed bitrate).
+ *
+ * The representation selection algorithm can be configured using
+ * specific properties: max bitrate, min/max buffering, bandwidth ratio.
+ *
+ *
+ * General Design:
+ *
+ * dashdemux has a single sink pad that accepts the data corresponding
+ * to the manifest, typically fetched from an HTTP or file source.
+ *
+ * dashdemux exposes the streams it recreates based on the fragments it
+ * fetches through dedicated src pads corresponding to the caps of the
+ * fragments container (ISOBMFF/MP4 or MPEG2TS).
+ *
+ * During playback, new representations will typically be exposed as a
+ * new set of pads (see 'Switching between representations' below).
+ *
+ * Fragments downloading is performed using a dedicated task that fills
+ * an internal queue. Another task is in charge of popping fragments
+ * from the queue and pushing them downstream.
+ *
+ * Switching between representations:
+ *
+ * Decodebin supports scenarios allowing to seamlessly switch from one
+ * stream to another inside the same "decoding chain".
+ *
+ * To achieve that, it combines the elements it autoplugged in chains
+ *  and groups, allowing only one decoding group to be active at a given
+ * time for a given chain.
+ *
+ * A chain can signal decodebin that it is complete by sending a
+ * no-more-pads event, but even after that new pads can be added to
+ * create new subgroups, providing that a new no-more-pads event is sent.
+ *
+ * We take advantage of that to dynamically create a new decoding group
+ * in order to select a different representation during playback.
+ *
+ * Typically, assuming that each fragment contains both audio and video,
+ * the following tree would be created:
+ *
+ * chain "DASH Demux"
+ * |_ group "Representation set 1"
+ * |   |_ chain "Qt Demux 0"
+ * |       |_ group "Stream 0"
+ * |           |_ chain "H264"
+ * |           |_ chain "AAC"
+ * |_ group "Representation set 2"
+ *     |_ chain "Qt Demux 1"
+ *         |_ group "Stream 1"
+ *             |_ chain "H264"
+ *             |_ chain "AAC"
+ *
+ * Or, if audio and video are contained in separate fragments:
+ *
+ * chain "DASH Demux"
+ * |_ group "Representation set 1"
+ * |   |_ chain "Qt Demux 0"
+ * |   |   |_ group "Stream 0"
+ * |   |       |_ chain "H264"
+ * |   |_ chain "Qt Demux 1"
+ * |       |_ group "Stream 1"
+ * |           |_ chain "AAC"
+ * |_ group "Representation set 2"
+ *     |_ chain "Qt Demux 3"
+ *     |   |_ group "Stream 2"
+ *     |       |_ chain "H264"
+ *     |_ chain "Qt Demux 4"
+ *         |_ group "Stream 3"
+ *             |_ chain "AAC"
+ *
+ * In both cases, when switching from Set 1 to Set 2 an EOS is sent on
+ * each end pad corresponding to Rep 0, triggering the "drain" state to
+ * propagate upstream.
+ * Once both EOS have been processed, the "Set 1" group is completely
+ * drained, and decodebin2 will switch to the "Set 2" group.
+ *
+ * Note: nothing can be pushed to the new decoding group before the
+ * old one has been drained, which means that in order to be able to
+ * adapt quickly to bandwidth changes, we will not be able to rely
+ * on downstream buffering, and will instead manage an internal queue.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
+#include <string.h>
+#include <inttypes.h>
+#include <gst/base/gsttypefindhelper.h>
+#include "gstdashdemux.h"
+
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src%d",
+    GST_PAD_SRC,
+    GST_PAD_SOMETIMES,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("application/dash+xml"));
+
+GST_DEBUG_CATEGORY_STATIC (gst_dash_demux_debug);
+#define GST_CAT_DEFAULT gst_dash_demux_debug
+
+enum
+{
+  PROP_0,
+
+  PROP_MIN_BUFFERING_TIME,
+  PROP_MAX_BUFFERING_TIME,
+  PROP_BANDWIDTH_USAGE,
+  PROP_MAX_BITRATE,
+  PROP_LAST
+};
+
+/* Default values for properties */
+#define DEFAULT_MIN_BUFFERING_TIME        5     /* in seconds */
+#define DEFAULT_MAX_BUFFERING_TIME       30     /* in seconds */
+#define DEFAULT_BANDWIDTH_USAGE         0.8     /* 0 to 1     */
+#define DEFAULT_MAX_BITRATE        24000000     /* in bit/s  */
+
+#define DEFAULT_FAILED_COUNT 3
+
+
+/* GObject */
+static void gst_dash_demux_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_dash_demux_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+static void gst_dash_demux_dispose (GObject * obj);
+
+/* GstElement */
+static GstStateChangeReturn
+gst_dash_demux_change_state (GstElement * element, GstStateChange transition);
+
+/* GstDashDemux */
+static GstFlowReturn gst_dash_demux_pad (GstPad * pad, GstBuffer * buf);
+static gboolean gst_dash_demux_sink_event (GstPad * pad, GstEvent * event);
+static gboolean gst_dash_demux_src_event (GstPad * pad, GstEvent * event);
+static gboolean gst_dash_demux_src_query (GstPad * pad, GstQuery * query);
+static void gst_dash_demux_stream_loop (GstDashDemux * demux);
+static void gst_dash_demux_download_loop (GstDashDemux * demux);
+static void gst_dash_demux_stop (GstDashDemux * demux);
+static void gst_dash_demux_pause_stream_task (GstDashDemux * demux);
+static void gst_dash_demux_resume_stream_task (GstDashDemux * demux);
+static void gst_dash_demux_resume_download_task (GstDashDemux * demux);
+static gboolean gst_dash_demux_setup_all_streams (GstDashDemux * demux);
+static gboolean gst_dash_demux_select_representations (GstDashDemux * demux,
+    guint64 current_bitrate);
+static gboolean gst_dash_demux_get_next_fragment_set (GstDashDemux * demux);
+
+static void gst_dash_demux_reset (GstDashDemux * demux, gboolean dispose);
+static GstClockTime gst_dash_demux_get_buffering_time (GstDashDemux * demux);
+static float gst_dash_demux_get_buffering_ratio (GstDashDemux * demux);
+static GstBuffer *gst_dash_demux_merge_buffer_list (GstFragment * fragment);
+
+static void
+_do_init (GType type)
+{
+  GST_DEBUG_CATEGORY_INIT (gst_dash_demux_debug, "dashdemux", 0,
+      "dashdemux element");
+}
+
+GST_BOILERPLATE_FULL (GstDashDemux, gst_dash_demux, GstElement,
+    GST_TYPE_ELEMENT, _do_init);
+
+static void
+gst_dash_demux_base_init (gpointer g_class)
+{
+  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_add_static_pad_template (element_class, &srctemplate);
+
+  gst_element_class_add_static_pad_template (element_class, &sinktemplate);
+
+  gst_element_class_set_details_simple (element_class,
+      "DASH Demuxer",
+      "Codec/Demuxer",
+      "Dynamic Adaptive Streaming over HTTP demuxer",
+      "David Corvoysier <david.corvoysier@orange.com>\n\
+                Hamid Zakari <hamid.zakari@gmail.com>\n\
+                Gianluca Gennari <gennarone@gmail.com>");
+}
+
+static void
+gst_dash_demux_dispose (GObject * obj)
+{
+  GstDashDemux *demux = GST_DASH_DEMUX (obj);
+
+  if (demux->stream_task) {
+    if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) {
+      GST_DEBUG_OBJECT (demux, "Leaving streaming task");
+      gst_task_stop (demux->stream_task);
+      gst_task_join (demux->stream_task);
+    }
+    gst_object_unref (demux->stream_task);
+    g_static_rec_mutex_free (&demux->stream_lock);
+    g_mutex_free(demux->stream_timed_lock);
+    demux->stream_task = NULL;
+  }
+
+  if (demux->download_task) {
+    if (GST_TASK_STATE (demux->download_task) != GST_TASK_STOPPED) {
+      GST_DEBUG_OBJECT (demux, "Leaving download task");
+      gst_task_stop (demux->download_task);
+      gst_task_join (demux->download_task);
+    }
+    gst_object_unref (demux->download_task);
+    g_static_rec_mutex_free (&demux->download_lock);
+    g_mutex_free(demux->download_timed_lock);
+    demux->download_task = NULL;
+  }
+
+  if (demux->downloader != NULL) {
+    g_object_unref (demux->downloader);
+    demux->downloader = NULL;
+  }
+
+  gst_dash_demux_reset (demux, TRUE);
+
+  g_queue_free (demux->queue);
+
+  G_OBJECT_CLASS (parent_class)->dispose (obj);
+}
+
+static void
+gst_dash_demux_class_init (GstDashDemuxClass * klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+
+  gobject_class->set_property = gst_dash_demux_set_property;
+  gobject_class->get_property = gst_dash_demux_get_property;
+  gobject_class->dispose = gst_dash_demux_dispose;
+
+  g_object_class_install_property (gobject_class, PROP_MIN_BUFFERING_TIME,
+      g_param_spec_uint ("min-buffering-time", "Minimum buffering time",
+          "Minimum number of seconds of buffer accumulated before playback",
+          1, G_MAXUINT, DEFAULT_MIN_BUFFERING_TIME,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_MAX_BUFFERING_TIME,
+      g_param_spec_uint ("max-buffering-time", "Maximum buffering time",
+          "Maximum number of seconds of buffer accumulated during playback",
+          2, G_MAXUINT, DEFAULT_MAX_BUFFERING_TIME,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_BANDWIDTH_USAGE,
+      g_param_spec_float ("bandwidth-usage",
+          "Bandwidth usage [0..1]",
+          "Percentage of the available bandwidth to use when selecting representations",
+          0, 1, DEFAULT_BANDWIDTH_USAGE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_MAX_BITRATE,
+      g_param_spec_uint ("max-bitrate", "Max bitrate",
+          "Max of bitrate supported by target decoder",
+          1000, G_MAXUINT, DEFAULT_MAX_BITRATE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gstelement_class->change_state =
+      GST_DEBUG_FUNCPTR (gst_dash_demux_change_state);
+}
+
+static void
+gst_dash_demux_init (GstDashDemux * demux, GstDashDemuxClass * klass)
+{
+  /* sink pad */
+  demux->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
+  gst_pad_set_chain_function (demux->sinkpad,
+      GST_DEBUG_FUNCPTR (gst_dash_demux_pad));
+  gst_pad_set_event_function (demux->sinkpad,
+      GST_DEBUG_FUNCPTR (gst_dash_demux_sink_event));
+  gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
+
+  /* Downloader */
+  demux->downloader = gst_uri_downloader_new ();
+
+  /* Properties */
+  demux->min_buffering_time = DEFAULT_MIN_BUFFERING_TIME * GST_SECOND;
+  demux->max_buffering_time = DEFAULT_MAX_BUFFERING_TIME * GST_SECOND;
+  demux->bandwidth_usage = DEFAULT_BANDWIDTH_USAGE;
+  demux->max_bitrate = DEFAULT_MAX_BITRATE;
+
+  demux->queue = g_queue_new ();
+  /* Updates task */
+  g_static_rec_mutex_init (&demux->download_lock);
+  demux->download_task =
+      gst_task_create ((GstTaskFunction) gst_dash_demux_download_loop, demux);
+  gst_task_set_lock (demux->download_task, &demux->download_lock);
+  demux->download_timed_lock = g_mutex_new ();
+
+  /* Streaming task */
+  g_static_rec_mutex_init (&demux->stream_lock);
+  demux->stream_task =
+      gst_task_create ((GstTaskFunction) gst_dash_demux_stream_loop, demux);
+  gst_task_set_lock (demux->stream_task, &demux->stream_lock);
+  demux->stream_timed_lock = g_mutex_new ();
+}
+
+static void
+gst_dash_demux_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstDashDemux *demux = GST_DASH_DEMUX (object);
+
+  switch (prop_id) {
+    case PROP_MIN_BUFFERING_TIME:
+      demux->min_buffering_time = g_value_get_uint (value) * GST_SECOND;
+      break;
+    case PROP_MAX_BUFFERING_TIME:
+      demux->max_buffering_time = g_value_get_uint (value) * GST_SECOND;
+      break;
+    case PROP_BANDWIDTH_USAGE:
+      demux->bandwidth_usage = g_value_get_float (value);
+      break;
+    case PROP_MAX_BITRATE:
+      demux->max_bitrate = g_value_get_uint (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_dash_demux_get_property (GObject * object, guint prop_id, GValue * value,
+    GParamSpec * pspec)
+{
+  GstDashDemux *demux = GST_DASH_DEMUX (object);
+
+  switch (prop_id) {
+    case PROP_MIN_BUFFERING_TIME:
+      g_value_set_uint (value, demux->min_buffering_time);
+      demux->min_buffering_time *= GST_SECOND;
+      break;
+    case PROP_MAX_BUFFERING_TIME:
+      g_value_set_uint (value, demux->max_buffering_time);
+      demux->max_buffering_time *= GST_SECOND;
+      break;
+    case PROP_BANDWIDTH_USAGE:
+      g_value_set_float (value, demux->bandwidth_usage);
+      break;
+    case PROP_MAX_BITRATE:
+      g_value_set_uint (value, demux->max_bitrate);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+}
+
+static GstStateChangeReturn
+gst_dash_demux_change_state (GstElement * element, GstStateChange transition)
+{
+  GstStateChangeReturn ret;
+  GstDashDemux *demux = GST_DASH_DEMUX (element);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_READY_TO_PAUSED:
+      gst_dash_demux_reset (demux, FALSE);
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+      /* Start the streaming loop in paused only if we already received
+         the manifest. It might have been stopped if we were in PAUSED
+         state and we filled our queue with enough cached fragments
+       */
+      if (demux->client->mpd_node != NULL)
+        gst_dash_demux_resume_stream_task (demux);
+      break;
+    default:
+      break;
+  }
+
+  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+  switch (transition) {
+    case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+      gst_dash_demux_pause_stream_task (demux);
+      break;
+    case GST_STATE_CHANGE_PAUSED_TO_READY:
+      demux->cancelled = TRUE;
+      gst_dash_demux_stop (demux);
+      gst_task_join (demux->stream_task);
+      gst_task_join (demux->download_task);
+      break;
+    default:
+      break;
+  }
+  return ret;
+}
+
+void
+gst_dash_demux_clear_queue (GstDashDemux * demux)
+{
+  while (!g_queue_is_empty (demux->queue)) {
+    GList *listfragment = g_queue_pop_head (demux->queue);
+    guint j = 0;
+    while (j < g_list_length (listfragment)) {
+      GstFragment *fragment = g_list_nth_data (listfragment, j);
+      g_object_unref (fragment);
+      j++;
+    }
+    g_list_free (listfragment);
+  }
+  g_queue_clear (demux->queue);
+}
+
+static gboolean
+gst_dash_demux_src_event (GstPad * pad, GstEvent * event)
+{
+  GstDashDemux *demux;
+
+  demux = GST_DASH_DEMUX (gst_pad_get_element_private (pad));
+
+  switch (event->type) {
+    case GST_EVENT_SEEK:
+    {
+      gdouble rate;
+      GstFormat format;
+      GstSeekFlags flags;
+      GstSeekType start_type, stop_type;
+      gint64 start, stop;
+      GList *list;
+      GstClockTime current_pos, target_pos;
+      guint current_sequence, current_period;
+      GstActiveStream *stream;
+      GstMediaSegment *chunk;
+      GstStreamPeriod *period;
+      guint nb_active_stream;
+      guint stream_idx;
+
+      if (gst_mpd_client_is_live (demux->client)) {
+        GST_WARNING_OBJECT (demux, "Received seek event for live stream");
+        return FALSE;
+      }
+
+      gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
+          &stop_type, &stop);
+
+      if (format != GST_FORMAT_TIME)
+        return FALSE;
+
+      GST_DEBUG_OBJECT (demux,
+          "seek event, rate: %f type: %d start: %" GST_TIME_FORMAT " stop: %"
+          GST_TIME_FORMAT, rate, start_type, GST_TIME_ARGS (start),
+          GST_TIME_ARGS (stop));
+
+      //GST_MPD_CLIENT_LOCK (demux->client);
+
+      /* select the requested Period in the Media Presentation */
+      target_pos = (GstClockTime) start;
+      current_period = 0;
+      for (list = g_list_first (demux->client->periods); list;
+          list = g_list_next (list)) {
+        period = list->data;
+        current_pos = period->start;
+        current_period = period->number;
+        if (current_pos <= target_pos
+            && target_pos < current_pos + period->duration) {
+          break;
+        }
+      }
+      if (list == NULL) {
+        GST_WARNING_OBJECT (demux, "Could not find seeked Period");
+        return FALSE;
+      }
+      if (current_period != gst_mpd_client_get_period_index (demux->client)) {
+        GST_DEBUG_OBJECT (demux, "Seeking to Period %d", current_period);
+        /* setup video, audio and subtitle streams, starting from the new Period */
+        if (!gst_mpd_client_set_period_index (demux->client, current_period) ||
+            !gst_dash_demux_setup_all_streams (demux))
+          return FALSE;
+      }
+
+      stream = gst_mpdparser_get_active_stream_by_index (demux->client, 0);
+      current_pos = 0;
+      for (list = g_list_first (stream->segments); list;
+          list = g_list_next (list)) {
+        chunk = list->data;
+        current_pos = chunk->start_time;
+        current_sequence = chunk->number;
+        if (current_pos <= target_pos
+            && target_pos < current_pos + chunk->duration) {
+          break;
+        }
+      }
+      //GST_MPD_CLIENT_UNLOCK (demux->client);
+
+      if (list == NULL) {
+        GST_WARNING_OBJECT (demux, "Could not find seeked fragment");
+        return FALSE;
+      }
+
+      /* We can actually perform the seek */
+      nb_active_stream = gst_mpdparser_get_nb_active_stream (demux->client);
+
+      if (flags & GST_SEEK_FLAG_FLUSH) {
+        GST_DEBUG_OBJECT (demux, "sending flush start");
+        stream_idx = 0;
+        while (stream_idx < nb_active_stream) {
+          gst_pad_push_event (demux->srcpad[stream_idx],
+              gst_event_new_flush_start ());
+          stream_idx++;
+        }
+      }
+
+      /* Stop the demux */
+      demux->cancelled = TRUE;
+      gst_dash_demux_stop (demux);
+
+      /* Wait for streaming to finish */
+      g_static_rec_mutex_lock (&demux->stream_lock);
+
+      /* Clear the buffering queue */
+      /* FIXME: allow seeking in the buffering queue */
+      gst_dash_demux_clear_queue (demux);
+
+      //GST_MPD_CLIENT_LOCK (demux->client);
+      GST_DEBUG_OBJECT (demux, "Seeking to sequence %d", current_sequence);
+      /* Update the current sequence on all streams */
+      gst_mpd_client_set_segment_index_for_all_streams (demux->client,
+          current_sequence);
+      /* Calculate offset in the next fragment */
+      demux->position = gst_mpd_client_get_current_position (demux->client);
+      demux->position_shift = start - demux->position;
+      demux->need_segment = TRUE;
+      //GST_MPD_CLIENT_UNLOCK (demux->client);
+
+      if (flags & GST_SEEK_FLAG_FLUSH) {
+        GST_DEBUG_OBJECT (demux, "Sending flush stop on all pad");
+        stream_idx = 0;
+        while (stream_idx < nb_active_stream) {
+          gst_pad_push_event (demux->srcpad[stream_idx],
+              gst_event_new_flush_stop ());
+          stream_idx++;
+        }
+      }
+
+      /* Restart the demux */
+      demux->cancelled = FALSE;
+      gst_dash_demux_resume_download_task (demux);
+      gst_dash_demux_resume_stream_task (demux);
+      g_static_rec_mutex_unlock (&demux->stream_lock);
+
+      return TRUE;
+    }
+    default:
+      break;
+  }
+
+  return gst_pad_event_default (pad, event);
+}
+
+static gboolean
+gst_dash_demux_setup_all_streams (GstDashDemux * demux)
+{
+  GList *listLang = NULL;
+  guint i, nb_audio;
+  gchar *lang;
+
+  GST_MPD_CLIENT_LOCK (demux->client);
+  /* clean old active stream list, if any */
+  gst_active_streams_free (demux->client);
+
+  if (!gst_mpd_client_setup_streaming (demux->client, GST_STREAM_VIDEO, ""))
+    GST_INFO_OBJECT (demux, "No video adaptation set found");
+
+  nb_audio =
+      gst_mpdparser_get_list_and_nb_of_audio_language (demux->client,
+      &listLang);
+  if (nb_audio == 0)
+    nb_audio = 1;
+  GST_INFO_OBJECT (demux, "Number of language is=%d", nb_audio);
+
+  for (i = 0; i < nb_audio; i++) {
+    lang = (gchar *) g_list_nth_data (listLang, i);
+    if (gst_mpdparser_get_nb_adaptationSet (demux->client) > 1)
+      if (!gst_mpd_client_setup_streaming (demux->client, GST_STREAM_AUDIO,
+              lang))
+        GST_INFO_OBJECT (demux, "No audio adaptation set found");
+
+    if (gst_mpdparser_get_nb_adaptationSet (demux->client) > nb_audio)
+      if (!gst_mpd_client_setup_streaming (demux->client,
+              GST_STREAM_APPLICATION, lang))
+        GST_INFO_OBJECT (demux, "No application adaptation set found");
+  }
+  GST_MPD_CLIENT_UNLOCK (demux->client);
+
+  return TRUE;
+}
+
+static gboolean
+gst_dash_demux_sink_event (GstPad * pad, GstEvent * event)
+{
+  GstDashDemux *demux = GST_DASH_DEMUX (gst_pad_get_parent (pad));
+
+  switch (event->type) {
+    case GST_EVENT_EOS:{
+      gchar *manifest;
+      GstQuery *query;
+      gboolean res;
+
+      if (demux->manifest == NULL) {
+        GST_WARNING_OBJECT (demux, "Received EOS without a manifest.");
+        break;
+      }
+
+      GST_DEBUG_OBJECT (demux, "Got EOS on the sink pad: manifest fetched");
+
+      if (demux->client)
+        gst_mpd_client_free (demux->client);
+      demux->client = gst_mpd_client_new ();
+
+      query = gst_query_new_uri ();
+      res = gst_pad_peer_query (pad, query);
+      if (res) {
+        gst_query_parse_uri (query, &demux->client->mpd_uri);
+        GST_DEBUG_OBJECT (demux, "Fetched MPD file at URI: %s",
+            demux->client->mpd_uri);
+      } else {
+        GST_WARNING_OBJECT (demux, "MPD URI query failed.");
+      }
+      gst_query_unref (query);
+
+      manifest = (gchar *) GST_BUFFER_DATA (demux->manifest);
+      if (manifest == NULL) {
+        GST_WARNING_OBJECT (demux, "Error validating the manifest.");
+      } else if (!gst_mpd_parse (demux->client, manifest,
+              GST_BUFFER_SIZE (demux->manifest))) {
+        /* In most cases, this will happen if we set a wrong url in the
+         * source element and we have received the 404 HTML response instead of
+         * the manifest */
+        GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid manifest."),
+            (NULL));
+        return FALSE;
+      }
+      gst_buffer_unref (demux->manifest);
+      demux->manifest = NULL;
+
+      if (!gst_mpd_client_setup_media_presentation (demux->client)) {
+        GST_ELEMENT_ERROR (demux, STREAM, DECODE,
+            ("Incompatible manifest file."), (NULL));
+        return FALSE;
+      }
+
+      /* setup video, audio and subtitle streams, starting from first Period */
+      if (!gst_mpd_client_set_period_index (demux->client, 0) ||
+          !gst_dash_demux_setup_all_streams (demux))
+        return FALSE;
+
+      /* start playing from the first segment */
+      gst_mpd_client_set_segment_index_for_all_streams (demux->client, 0);
+
+      /* Send duration message */
+      if (!gst_mpd_client_is_live (demux->client)) {
+        GstClockTime duration =
+            gst_mpd_client_get_media_presentation_duration (demux->client);
+
+        if (duration != GST_CLOCK_TIME_NONE) {
+          GST_DEBUG_OBJECT (demux,
+              "Sending duration message : %" GST_TIME_FORMAT,
+              GST_TIME_ARGS (duration));
+          gst_element_post_message (GST_ELEMENT (demux),
+              gst_message_new_duration (GST_OBJECT (demux), GST_FORMAT_TIME,
+                  duration));
+        } else {
+          GST_DEBUG_OBJECT (demux,
+              "mediaPresentationDuration unknown, can not send the duration message");
+        }
+      }
+      gst_dash_demux_resume_download_task (demux);
+      gst_dash_demux_resume_stream_task (demux);
+      gst_event_unref (event);
+      return TRUE;
+    }
+    case GST_EVENT_NEWSEGMENT:
+      /* Swallow newsegments, we'll push our own */
+      gst_event_unref (event);
+      return TRUE;
+    default:
+      break;
+  }
+
+  return gst_pad_event_default (pad, event);
+}
+
+static gboolean
+gst_dash_demux_src_query (GstPad * pad, GstQuery * query)
+{
+  GstDashDemux *dashdemux;
+  gboolean ret = FALSE;
+
+  if (query == NULL)
+    return FALSE;
+
+  dashdemux = GST_DASH_DEMUX (gst_pad_get_element_private (pad));
+
+  switch (query->type) {
+    case GST_QUERY_DURATION:{
+      GstClockTime duration = -1;
+      GstFormat fmt;
+
+      gst_query_parse_duration (query, &fmt, NULL);
+      if (fmt == GST_FORMAT_TIME) {
+        duration =
+            gst_mpd_client_get_media_presentation_duration (dashdemux->client);
+        if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0) {
+          gst_query_set_duration (query, GST_FORMAT_TIME, duration);
+          ret = TRUE;
+        }
+      }
+      GST_DEBUG_OBJECT (dashdemux,
+          "GST_QUERY_DURATION returns %s with duration %" GST_TIME_FORMAT,
+          ret ? "TRUE" : "FALSE", GST_TIME_ARGS (duration));
+      break;
+    }
+    case GST_QUERY_SEEKING:{
+      GstFormat fmt;
+      gint64 stop = -1;
+
+      gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
+      GST_DEBUG_OBJECT (dashdemux, "Received GST_QUERY_SEEKING with format %d",
+          fmt);
+      if (fmt == GST_FORMAT_TIME) {
+        GstClockTime duration;
+
+        duration =
+            gst_mpd_client_get_media_presentation_duration (dashdemux->client);
+        if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0)
+          stop = duration;
+
+        gst_query_set_seeking (query, fmt,
+            !gst_mpd_client_is_live (dashdemux->client), 0, stop);
+        ret = TRUE;
+        GST_DEBUG_OBJECT (dashdemux, "GST_QUERY_SEEKING returning with stop : %"
+            GST_TIME_FORMAT, GST_TIME_ARGS (stop));
+      }
+      break;
+    }
+    case GST_QUERY_URI: {
+      /* forwarding uri */
+      GST_DEBUG("URI query recevied in DASH demux.....");
+        gboolean res;
+        res = gst_pad_query_default (pad,query);
+        if(res)
+          GST_DEBUG("forwarding URI is done successfully!!...");
+      ret = TRUE;
+      break;
+    }
+    default:{
+      // By default, do not forward queries upstream
+      break;
+    }
+  }
+
+  return ret;
+}
+
+static GstFlowReturn
+gst_dash_demux_pad (GstPad * pad, GstBuffer * buf)
+{
+  GstDashDemux *demux = GST_DASH_DEMUX (gst_pad_get_parent (pad));
+
+  if (demux->manifest == NULL)
+    demux->manifest = buf;
+  else
+    demux->manifest = gst_buffer_join (demux->manifest, buf);
+
+  gst_object_unref (demux);
+
+  return GST_FLOW_OK;
+}
+
+static void
+gst_dash_demux_stop (GstDashDemux * demux)
+{
+  gst_uri_downloader_cancel (demux->downloader);
+
+  if (GST_TASK_STATE (demux->download_task) != GST_TASK_STOPPED) {
+    GST_TASK_SIGNAL (demux->download_task);
+    gst_task_stop (demux->download_task);
+  }
+  if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) {
+    GST_TASK_SIGNAL (demux->stream_task);
+    gst_task_stop (demux->stream_task);
+  }
+}
+#ifdef DASHDEMUX_MODIFICATION
+static void
+_update_caps(GstDashDemux * demux, guint nb_adaptation_set)
+{
+  guint i = 0;
+  GstCaps *caps;
+
+  /* Create and activate new pads */
+  i = 0;
+  while (i < nb_adaptation_set) {
+    caps = gst_pad_get_caps(demux->srcpad[i]);
+    if(caps){
+      caps = gst_caps_make_writable(caps);
+      gst_caps_replace(&caps,demux->output_caps[i]);
+    }
+    else{
+      caps = demux->output_caps[i];
+    }
+    gst_pad_use_fixed_caps (demux->srcpad[i]);
+    gst_pad_set_caps (demux->srcpad[i], caps);
+    gst_caps_unref(caps);
+    i++;
+  }
+}
+
+static void
+_add_pads(GstDashDemux * demux, guint nb_adaptation_set)
+{
+  guint i = 0;
+
+  /* Create and activate new pads */
+  i = 0;
+  while (i < nb_adaptation_set) {
+    demux->srcpad[i] = gst_pad_new_from_static_template (&srctemplate, NULL);
+    gst_pad_set_event_function (demux->srcpad[i],
+        GST_DEBUG_FUNCPTR (gst_dash_demux_src_event));
+    gst_pad_set_query_function (demux->srcpad[i],
+        GST_DEBUG_FUNCPTR (gst_dash_demux_src_query));
+    gst_pad_set_element_private (demux->srcpad[i], demux);
+    gst_pad_set_active (demux->srcpad[i], TRUE);
+    gst_pad_set_caps (demux->srcpad[i], demux->output_caps[i]);
+    gst_caps_unref(demux->output_caps[i]);
+    gst_element_add_pad (GST_ELEMENT (demux), demux->srcpad[i]);
+    i++;
+  }
+  /* Send 'no-more-pads' to have decodebin create the new group */
+  gst_element_no_more_pads (GST_ELEMENT (demux));
+}
+
+static gboolean
+_needs_caps_update (GstDashDemux * demux, GList * fragment)
+{
+
+  gboolean update_caps = FALSE;
+  guint i = 0;
+  while (i < g_list_length (fragment)) {
+    GstFragment *newFragment = g_list_nth_data (fragment, i);
+    if (newFragment == NULL) {
+      continue;
+    }
+    GstCaps *srccaps = NULL;
+    demux->output_caps[i] = gst_fragment_get_caps (newFragment);
+    if (G_LIKELY (demux->srcpad[i]))
+      srccaps = gst_pad_get_negotiated_caps (demux->srcpad[i]);
+    if (G_UNLIKELY (!srccaps
+            || (!gst_caps_is_equal_fixed (demux->output_caps[i], srccaps))
+            || demux->need_segment)) {
+      update_caps = TRUE;
+    }
+    if (G_LIKELY (srccaps))
+      gst_caps_unref (srccaps);
+    i++;
+  }
+  return update_caps;
+}
+
+#else
+/* switch_pads:
+ *
+ * Called when switching from one set of representations to another, but
+ * only if one of the new representations requires different downstream
+ * elements (see the next function).
+ *
+ * This function first creates the new pads, then sends a no-more-pads
+ * event (that will tell decodebin to create a new group), then sends
+ * EOS on the old pads to trigger the group switch.
+ *
+ */
+static void
+switch_pads (GstDashDemux * demux, guint nb_adaptation_set)
+{
+  GstPad *oldpad[MAX_LANGUAGES];
+  guint i = 0;
+  /* Remember old pads */
+  while (i < nb_adaptation_set) {
+    oldpad[i] = demux->srcpad[i];
+    if (oldpad[i]) {
+      GST_DEBUG_OBJECT (demux,
+          "Switching pads (oldpad:%p)" GST_PTR_FORMAT, oldpad[i]);
+    }
+    i++;
+  }
+  /* Create and activate new pads */
+  i = 0;
+  while (i < nb_adaptation_set) {
+    demux->srcpad[i] = gst_pad_new_from_static_template (&srctemplate, NULL);
+    gst_pad_set_event_function (demux->srcpad[i],
+        GST_DEBUG_FUNCPTR (gst_dash_demux_src_event));
+    gst_pad_set_query_function (demux->srcpad[i],
+        GST_DEBUG_FUNCPTR (gst_dash_demux_src_query));
+    gst_pad_set_element_private (demux->srcpad[i], demux);
+    gst_pad_set_active (demux->srcpad[i], TRUE);
+    gst_pad_set_caps (demux->srcpad[i], demux->output_caps[i]);
+    gst_element_add_pad (GST_ELEMENT (demux), demux->srcpad[i]);
+    i++;
+  }
+  /* Send 'no-more-pads' to have decodebin create the new group */
+  gst_element_no_more_pads (GST_ELEMENT (demux));
+  /* Push out EOS on all old pads to switch to the new group */
+  i = 0;
+  while (i < nb_adaptation_set) {
+    if (oldpad[i]) {
+      gst_pad_push_event (oldpad[i], gst_event_new_eos ());
+      gst_pad_set_active (oldpad[i], FALSE);
+      gst_element_remove_pad (GST_ELEMENT (demux), oldpad[i]);
+    }
+    i++;
+  }
+}
+
+/* needs_pad_switch:
+ *
+ * Figure out if the newly selected representations require a new set
+ * of demuxers and decoders or if we can carry on with the existing ones.
+ *
+ * Basically, we look at the list of fragments we need to push downstream,
+ * and compare their caps with those of the corresponding src pads.
+ *
+ * As soon as one fragment requires a new set of caps, we need to switch
+ * all decoding pads to recreate a whole decoding group as we cannot
+ * move pads between groups (FIXME: or can we ?).
+ *
+ * FIXME: redundant with need_add_header
+ *
+ */
+static gboolean
+needs_pad_switch (GstDashDemux * demux, GList * fragment)
+{
+
+  gboolean switch_pad = FALSE;
+  guint i = 0;
+  while (i < g_list_length (fragment)) {
+    GstFragment *newFragment = g_list_nth_data (fragment, i);
+    if (newFragment == NULL) {
+      continue;
+    }
+    GstCaps *srccaps = NULL;
+    demux->output_caps[i] = gst_fragment_get_caps (newFragment);
+    if (G_LIKELY (demux->srcpad[i]))
+      srccaps = gst_pad_get_negotiated_caps (demux->srcpad[i]);
+    if (G_UNLIKELY (!srccaps
+            || (!gst_caps_is_equal_fixed (demux->output_caps[i], srccaps))
+            || demux->need_segment)) {
+      switch_pad = TRUE;
+    }
+    if (G_LIKELY (srccaps))
+      gst_caps_unref (srccaps);
+    i++;
+  }
+  return switch_pad;
+}
+#endif
+
+/* gst_dash_demux_stream_loop:
+ *
+ * Loop for the "stream' task that pushes fragments to the src pads.
+ *
+ * Startup:
+ * The task is started as soon as we have received the manifest and
+ * waits for the first fragment to be downloaded and pushed in the
+ * queue. Once this fragment has been pushed, the task pauses itself
+ * until actual playback begins.
+ *
+ * During playback:
+ * The task pushes fragments downstream at regular intervals based on
+ * the fragment duration. If it detects a queue underrun, it sends
+ * a buffering event to tell the main application to pause.
+ *
+ * Teardown:
+ * The task is stopped when we have reached the end of the manifest
+ * and emptied our queue.
+ *
+ */
+static void
+gst_dash_demux_stream_loop (GstDashDemux * demux)
+{
+  GList *listfragment;
+  GstFlowReturn ret;
+  GstBufferList *buffer_list;
+  guint nb_adaptation_set = 0;
+  GstActiveStream *stream;
+
+  /* Wait until the next scheduled push downstream */
+  if (g_cond_timed_wait (GST_TASK_GET_COND (demux->stream_task),
+          demux->stream_timed_lock, &demux->next_push)) {
+    goto quit;
+  }
+
+  if (g_queue_is_empty (demux->queue)) {
+    if (demux->end_of_manifest)
+      goto end_of_manifest;
+
+    return;
+  }
+
+  if (GST_STATE (demux) == GST_STATE_PLAYING) {
+    if (!demux->end_of_manifest
+        && gst_dash_demux_get_buffering_time (demux) <
+        demux->min_buffering_time) {
+      /* Warn we are below our threshold: this will eventually pause
+       * the pipeline */
+      gst_element_post_message (GST_ELEMENT (demux),
+          gst_message_new_buffering (GST_OBJECT (demux),
+              100 * gst_dash_demux_get_buffering_ratio (demux)));
+    }
+  }
+  listfragment = g_queue_pop_head (demux->queue);
+  nb_adaptation_set = g_list_length (listfragment);
+#ifdef DASHDEMUX_MODIFICATION
+  /* Figure out if we need to create pads or update caps */
+  gboolean caps_changed = _needs_caps_update (demux, listfragment);
+  if (caps_changed) {
+    if(demux->srcpad[0] == NULL)
+    {
+      _add_pads(demux,nb_adaptation_set);
+      demux->need_segment = TRUE;
+    }else{
+      _update_caps(demux,nb_adaptation_set);
+    }
+  }
+#else
+  /* Figure out if we need to create/switch pads */
+  gboolean switch_pad = needs_pad_switch (demux, listfragment);
+  if (switch_pad) {
+    switch_pads (demux, nb_adaptation_set);
+    demux->need_segment = TRUE;
+  }
+#endif
+  guint i = 0;
+  for (i = 0; i < nb_adaptation_set; i++) {
+    GstFragment *fragment = g_list_nth_data (listfragment, i);
+    stream = gst_mpdparser_get_active_stream_by_index (demux->client, i);
+    if (demux->need_segment) {
+      GstClockTime start = fragment->start_time + demux->position_shift;
+      /* And send a newsegment */
+      GST_DEBUG_OBJECT (demux, "Sending new-segment. segment start:%"
+          GST_TIME_FORMAT, GST_TIME_ARGS (start));
+      gst_pad_push_event (demux->srcpad[i],
+          gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME,
+              start, GST_CLOCK_TIME_NONE, start));
+      demux->position_shift = 0;
+    }
+
+    GST_DEBUG_OBJECT (demux, "Pushing fragment #%d", fragment->index);
+    buffer_list = gst_fragment_get_buffer_list (fragment);
+    g_object_unref (fragment);
+    ret = gst_pad_push_list (demux->srcpad[i], buffer_list);
+    if ((ret != GST_FLOW_OK) && (stream->mimeType == GST_STREAM_VIDEO))
+      goto error_pushing;
+  }
+  demux->need_segment = FALSE;
+  g_list_free (listfragment);
+  GST_STATE_LOCK(demux);
+  if (GST_STATE (demux) == GST_STATE_PLAYING) {
+    /* Wait for the duration of a fragment before resuming this task */
+    g_get_current_time (&demux->next_push);
+    g_time_val_add (&demux->next_push,
+        gst_mpd_client_get_next_fragment_duration (demux->client)
+        / GST_SECOND * G_USEC_PER_SEC);
+    GST_DEBUG_OBJECT (demux, "Next push scheduled at %s",
+        g_time_val_to_iso8601 (&demux->next_push));
+  } else {
+    /* The pipeline is now set up, wait until playback begins */
+    GST_INFO_OBJECT (demux, "Pausing streaming task");
+    gst_task_pause (demux->stream_task);
+  }
+  GST_STATE_UNLOCK(demux);
+
+quit:
+  {
+    return;
+  }
+
+end_of_manifest:
+  {
+    GST_INFO_OBJECT (demux, "Reached end of manifest, sending EOS");
+    guint i = 0;
+    for (i = 0; i < gst_mpdparser_get_nb_active_stream (demux->client); i++) {
+      gst_pad_push_event (demux->srcpad[i], gst_event_new_eos ());
+    }
+    GST_INFO_OBJECT (demux, "Stopped streaming task");
+    gst_task_stop (demux->stream_task);
+    return;
+  }
+
+error_pushing:
+  {
+    /* FIXME: handle error */
+    GST_ERROR_OBJECT (demux,
+        "Error pushing buffer: %s... terminating the demux",
+        gst_flow_get_name (ret));
+    gst_dash_demux_stop (demux);
+    return;
+  }
+}
+
+static void
+gst_dash_demux_reset (GstDashDemux * demux, gboolean dispose)
+{
+  demux->end_of_period = FALSE;
+  demux->end_of_manifest = FALSE;
+  demux->cancelled = FALSE;
+
+  guint i = 0;
+  for (i = 0; i < MAX_LANGUAGES; i++)
+    if (demux->input_caps[i]) {
+      gst_caps_unref (demux->input_caps[i]);
+      demux->input_caps[i] = NULL;
+    }
+
+  if (demux->manifest) {
+    gst_buffer_unref (demux->manifest);
+    demux->manifest = NULL;
+  }
+  if (demux->client) {
+    gst_mpd_client_free (demux->client);
+    demux->client = NULL;
+  }
+  if (!dispose) {
+    demux->client = gst_mpd_client_new ();
+  }
+
+  gst_dash_demux_clear_queue (demux);
+
+  demux->last_manifest_update = GST_CLOCK_TIME_NONE;
+  demux->position = 0;
+  demux->position_shift = 0;
+  demux->need_segment = TRUE;
+}
+
+static GstClockTime
+gst_dash_demux_get_buffering_time (GstDashDemux * demux)
+{
+  GstClockTime buffer_time = 0;
+  GList *listfragment;
+  GstFragment *first_fragment, *last_fragment;
+
+  if (g_queue_is_empty (demux->queue))
+    return 0;
+
+  /* get first fragment */
+  listfragment = g_queue_peek_head (demux->queue);
+  first_fragment = listfragment->data;
+  /* get last fragment */
+  listfragment = g_queue_peek_tail (demux->queue);
+  last_fragment = listfragment->data;
+
+  if (first_fragment && last_fragment) {
+    buffer_time = last_fragment->stop_time - first_fragment->start_time;
+  }
+
+  return buffer_time;
+}
+
+static float
+gst_dash_demux_get_buffering_ratio (GstDashDemux * demux)
+{
+  float buffering_time = gst_dash_demux_get_buffering_time (demux);
+  if (buffering_time >= demux->min_buffering_time) {
+    return 1.0;
+  } else
+    return buffering_time / demux->min_buffering_time;
+}
+
+static GstBuffer *
+gst_dash_demux_merge_buffer_list (GstFragment * fragment)
+{
+  GstBufferList *list;
+  GstBufferListIterator *it;
+  GstBuffer *buffer, *ret = NULL;
+  GstAdapter *adapter;
+  gsize size;
+
+  adapter = gst_adapter_new ();
+  list = gst_fragment_get_buffer_list (fragment);
+  it = gst_buffer_list_iterate (list);
+  while (gst_buffer_list_iterator_next_group (it)) {
+    while ((buffer = gst_buffer_list_iterator_next (it)) != NULL) {
+      gst_adapter_push (adapter, gst_buffer_ref (buffer));
+    }
+  }
+  gst_buffer_list_iterator_free (it);
+  gst_buffer_list_unref (list);
+  size = gst_adapter_available (adapter);
+  if (size > 0)
+    ret = gst_adapter_take_buffer (adapter, size);
+  GST_DEBUG ("Extracted a buffer of size %d from the fragment", size);
+  g_object_unref (adapter);
+
+  return ret;
+}
+
+/* gst_dash_demux_download_loop:
+ *
+ * Loop for the "download' task that fetches fragments based on the
+ * selected representations.
+ *
+ * Startup:
+ *
+ * The task is started from the stream loop.
+ *
+ * During playback:
+ *
+ * It sequentially fetches fragments corresponding to the current
+ * representations and pushes them into a queue.
+ *
+ * It tries to maintain the number of queued items within a predefined
+ * range: if the queue is full, it will pause, checking every 100 ms if
+ * it needs to restart downloading fragments.
+ *
+ * When a new set of fragments has been downloaded, it evaluates the
+ * download time to check if we can or should switch to a different
+ * set of representations.
+ *
+ * Teardown:
+ *
+ * The task will exit when it encounters an error or when the end of the
+ * manifest has been reached.
+ *
+ */
+void
+gst_dash_demux_download_loop (GstDashDemux * demux)
+{
+  GstClock *clock = gst_element_get_clock (GST_ELEMENT (demux));
+  gint64 update_period = demux->client->mpd_node->minimumUpdatePeriod;
+
+  /* Wait until the next scheduled download */
+  if (g_cond_timed_wait (GST_TASK_GET_COND (demux->download_task),
+          demux->download_timed_lock, &demux->next_download)) {
+    goto quit;
+  }
+
+  if (clock && gst_mpd_client_is_live (demux->client)
+      && demux->client->mpd_uri != NULL && update_period != -1) {
+    GstFragment *download;
+    GstBuffer *buffer;
+    GstClockTime duration, now = gst_clock_get_time (clock);
+
+    /* init reference time for manifest file updates */
+    if (!GST_CLOCK_TIME_IS_VALID (demux->last_manifest_update))
+      demux->last_manifest_update = now;
+
+    /* update the manifest file */
+    if (now >= demux->last_manifest_update + update_period * GST_MSECOND) {
+      GST_DEBUG_OBJECT (demux, "Updating manifest file from URL %s",
+          demux->client->mpd_uri);
+      download =
+          gst_uri_downloader_fetch_uri (demux->downloader,
+          demux->client->mpd_uri);
+      if (download == NULL) {
+        GST_WARNING_OBJECT (demux,
+            "Failed to update the manifest file from URL %s",
+            demux->client->mpd_uri);
+      } else {
+        buffer = gst_dash_demux_merge_buffer_list (download);
+        g_object_unref (download);
+        /* parse the manifest file */
+        if (buffer == NULL) {
+          GST_WARNING_OBJECT (demux, "Error validating the manifest.");
+        } else if (!gst_mpd_parse (demux->client,
+                (gchar *) GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer))) {
+          /* In most cases, this will happen if we set a wrong url in the
+           * source element and we have received the 404 HTML response instead of
+           * the manifest */
+          GST_WARNING_OBJECT (demux, "Error parsing the manifest.");
+          gst_buffer_unref (buffer);
+        } else {
+          GstActiveStream *stream;
+          guint segment_index;
+
+          gst_buffer_unref (buffer);
+          stream = gst_mpdparser_get_active_stream_by_index (demux->client, 0);
+          segment_index = gst_mpd_client_get_segment_index (stream);
+          /* setup video, audio and subtitle streams, starting from first Period */
+          if (!gst_mpd_client_setup_media_presentation (demux->client) ||
+              !gst_mpd_client_set_period_index (demux->client,
+                  gst_mpd_client_get_period_index (demux->client))
+              || !gst_dash_demux_setup_all_streams (demux)) {
+            GST_DEBUG_OBJECT (demux,
+                "Error setting up the updated manifest file");
+            goto end_of_manifest;
+          }
+          /* continue playing from the the next segment */
+          /* FIXME: support multiple streams with different segment duration */
+          gst_mpd_client_set_segment_index_for_all_streams (demux->client,
+              segment_index);
+
+          /* Send an updated duration message */
+          duration =
+              gst_mpd_client_get_media_presentation_duration (demux->client);
+
+          if (duration != GST_CLOCK_TIME_NONE) {
+            GST_DEBUG_OBJECT (demux,
+                "Sending duration message : %" GST_TIME_FORMAT,
+                GST_TIME_ARGS (duration));
+            gst_element_post_message (GST_ELEMENT (demux),
+                gst_message_new_duration (GST_OBJECT (demux), GST_FORMAT_TIME,
+                    duration));
+          } else {
+            GST_DEBUG_OBJECT (demux,
+                "mediaPresentationDuration unknown, can not send the duration message");
+          }
+          demux->last_manifest_update += update_period * GST_MSECOND;
+          GST_DEBUG_OBJECT (demux, "Manifest file successfully updated");
+        }
+      }
+    }
+  }
+
+
+  /* Target buffering time MUST at least exceeds mimimum buffering time
+   * by the duration of a fragment, but SHOULD NOT exceed maximum
+   * buffering time */
+  GstClockTime target_buffering_time =
+      demux->min_buffering_time +
+      gst_mpd_client_get_next_fragment_duration (demux->client);
+  if (demux->max_buffering_time > target_buffering_time)
+    target_buffering_time = demux->max_buffering_time;
+  if (!demux->end_of_manifest
+      && gst_dash_demux_get_buffering_time (demux) < target_buffering_time) {
+    if (GST_STATE (demux) != GST_STATE_PLAYING) {
+      /* Signal our buffering status (this will eventually restart the
+       * pipeline when we have reached 100 %) */
+      gst_element_post_message (GST_ELEMENT (demux),
+          gst_message_new_buffering (GST_OBJECT (demux),
+              100 * gst_dash_demux_get_buffering_ratio (demux)));
+    }
+
+    /* try to switch to another set of representations if needed */
+    gst_dash_demux_select_representations (demux,
+        demux->bandwidth_usage * demux->dnl_rate *
+        gst_dash_demux_get_buffering_ratio (demux));
+
+    /* fetch the next fragment */
+    while (!gst_dash_demux_get_next_fragment_set (demux)) {
+      if (demux->end_of_period) {
+        GST_INFO_OBJECT (demux, "Reached the end of the Period");
+        /* setup video, audio and subtitle streams, starting from the next Period */
+        if (!gst_mpd_client_set_period_index (demux->client,
+                gst_mpd_client_get_period_index (demux->client) + 1)
+            || !gst_dash_demux_setup_all_streams (demux)) {
+          GST_INFO_OBJECT (demux, "Reached the end of the manifest file");
+          demux->end_of_manifest = TRUE;
+          if (GST_STATE (demux) != GST_STATE_PLAYING) {
+            /* Restart the pipeline regardless of the current buffering level */
+            gst_element_post_message (GST_ELEMENT (demux),
+                gst_message_new_buffering (GST_OBJECT (demux), 100));
+          }
+          gst_task_start (demux->stream_task);
+          goto end_of_manifest;
+        }
+        /* start playing from the first segment of the new period */
+        gst_mpd_client_set_segment_index_for_all_streams (demux->client, 0);
+        demux->end_of_period = FALSE;
+      } else if (!demux->cancelled) {
+        demux->client->update_failed_count++;
+        if (demux->client->update_failed_count < DEFAULT_FAILED_COUNT) {
+          GST_WARNING_OBJECT (demux, "Could not fetch the next fragment");
+          goto quit;
+        } else {
+          goto error_downloading;
+        }
+      } else {
+        goto quit;
+      }
+    }
+    GST_INFO_OBJECT (demux, "Internal buffering : %" PRIu64 " s",
+        gst_dash_demux_get_buffering_time (demux) / GST_SECOND);
+    demux->client->update_failed_count = 0;
+  } else {
+    /* schedule the next download in 100 ms */
+    g_get_current_time (&demux->next_download);
+    g_time_val_add (&demux->next_download, 100000);
+  }
+
+quit:
+  {
+    return;
+  }
+
+end_of_manifest:
+  {
+    GST_INFO_OBJECT (demux, "Stopped download task");
+    gst_task_stop (demux->download_task);
+    return;
+  }
+
+error_downloading:
+  {
+    GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND,
+        ("Could not fetch the next fragment"), (NULL));
+    gst_dash_demux_stop (demux);
+    return;
+  }
+}
+
+static void
+gst_dash_demux_pause_stream_task (GstDashDemux * demux)
+{
+  /* Send a signal to the stream task so that it pauses itself */
+  GST_TASK_SIGNAL (demux->stream_task);
+  /* Pause it explicitly (if it was not in the COND) */
+  gst_task_pause (demux->stream_task);
+}
+
+static void
+gst_dash_demux_resume_stream_task (GstDashDemux * demux)
+{
+  g_get_current_time (&demux->next_push);
+  gst_task_start (demux->stream_task);
+}
+
+static void
+gst_dash_demux_resume_download_task (GstDashDemux * demux)
+{
+  g_get_current_time (&demux->next_download);
+  gst_task_start (demux->download_task);
+}
+
+/* gst_dash_demux_select_representations:
+ *
+ * Select the most appropriate media representations based on a target
+ * bitrate.
+ *
+ * FIXME: all representations are selected against the same bitrate, but
+ * they will share the same bandwidth. This only works today because the
+ * audio representations bitrate usage is negligible as compared to the
+ * video representation one.
+ *
+ * Returns TRUE if a new set of representations has been selected
+ */
+static gboolean
+gst_dash_demux_select_representations (GstDashDemux * demux, guint64 bitrate)
+{
+  GstActiveStream *stream = NULL;
+  GList *rep_list = NULL;
+  gint new_index;
+  gboolean ret = FALSE;
+
+  guint i = 0;
+  while (i < gst_mpdparser_get_nb_active_stream (demux->client)) {
+    stream = gst_mpdparser_get_active_stream_by_index (demux->client, i);
+    if (!stream)
+      return FALSE;
+
+    /* retrieve representation list */
+    if (stream->cur_adapt_set)
+      rep_list = stream->cur_adapt_set->Representations;
+    if (!rep_list)
+      return FALSE;
+
+    /* get representation index with current max_bandwidth */
+    new_index =
+        gst_mpdparser_get_rep_idx_with_max_bandwidth (rep_list, bitrate);
+
+    /* if no representation has the required bandwidth, take the lowest one */
+    if (new_index == -1)
+      new_index = 0;
+
+    if (new_index != stream->representation_idx) {
+      GST_MPD_CLIENT_LOCK (demux->client);
+      ret =
+          gst_mpd_client_setup_representation (demux->client, stream,
+          g_list_nth_data (rep_list, new_index));
+      GST_MPD_CLIENT_UNLOCK (demux->client);
+      if (ret) {
+        GST_INFO_OBJECT (demux, "Switching bitrate to %d",
+            stream->cur_representation->bandwidth);
+      } else {
+        GST_WARNING_OBJECT (demux,
+            "Can not switch representation, aborting...");
+      }
+    }
+    i++;
+  }
+  return ret;
+}
+
+static GstFragment *
+gst_dash_demux_get_next_header (GstDashDemux * demux, guint stream_idx)
+{
+  const gchar *initializationURL;
+  gchar *next_header_uri;
+  GstFragment *fragment;
+
+  if (!gst_mpd_client_get_next_header (demux->client, &initializationURL,
+          stream_idx))
+    return NULL;
+
+  if (strncmp (initializationURL, "http://", 7) != 0) {
+    next_header_uri =
+        g_strconcat (gst_mpdparser_get_baseURL (demux->client),
+        initializationURL, NULL);
+  } else {
+    next_header_uri = g_strdup (initializationURL);
+  }
+
+  GST_INFO_OBJECT (demux, "Fetching header %s", next_header_uri);
+
+  fragment = gst_uri_downloader_fetch_uri (demux->downloader, next_header_uri);
+  g_free (next_header_uri);
+
+  return fragment;
+}
+
+static GstBufferListItem
+gst_dash_demux_add_buffer_cb (GstBuffer ** buffer,
+    guint group, guint idx, gpointer user_data)
+{
+  GstFragment *frag = GST_FRAGMENT (user_data);
+  /* This buffer still belongs to the original fragment */
+  /* so we need to increase refcount */
+  gst_fragment_add_buffer (frag, gst_buffer_ref (*buffer));
+  return GST_BUFFER_LIST_CONTINUE;
+}
+
+/* Since we cannot add headers after the chunk has been downloaded, we have to recreate a new fragment */
+static GstFragment *
+gst_dash_demux_prepend_header (GstDashDemux * demux,
+    GstFragment * frag, GstFragment * header)
+{
+  GstFragment *res = gst_fragment_new ();
+  res->name = g_strdup (frag->name);
+  res->download_start_time = frag->download_start_time;
+  res->download_stop_time = frag->download_stop_time;
+  res->start_time = frag->start_time;
+  res->stop_time = frag->stop_time;
+  res->index = frag->index;
+  res->discontinuous = frag->discontinuous;
+
+  GstBufferList *list;
+  list = gst_fragment_get_buffer_list (header);
+  gst_buffer_list_foreach (list, gst_dash_demux_add_buffer_cb, res);
+  gst_buffer_list_unref (list);
+  list = gst_fragment_get_buffer_list (frag);
+  gst_buffer_list_foreach (list, gst_dash_demux_add_buffer_cb, res);
+  gst_buffer_list_unref (list);
+
+  res->completed = TRUE;
+
+  return res;
+}
+
+static GstCaps *
+gst_dash_demux_get_video_input_caps (GstDashDemux * demux,
+    GstActiveStream * stream)
+{
+  guint width = 0, height = 0;
+  const gchar *mimeType = NULL;
+  GstCaps *caps = NULL;
+
+  if (stream == NULL)
+    return NULL;
+#ifdef DASHDEMUX_MODIFICATION
+  /* caps need to inlcude resolution  */
+    width = gst_mpd_client_get_video_stream_width (stream);
+    height = gst_mpd_client_get_video_stream_height (stream);
+#else
+  /* if bitstreamSwitching is true we dont need to swich pads on resolution change */  
+  if (!gst_mpd_client_get_bitstream_switching_flag (stream)) {
+    width = gst_mpd_client_get_video_stream_width (stream);
+    height = gst_mpd_client_get_video_stream_height (stream);
+  }
+#endif
+  mimeType = gst_mpd_client_get_stream_mimeType (stream);
+  if (mimeType == NULL)
+    return NULL;
+
+  caps = gst_caps_new_simple (mimeType, NULL);
+  if (width > 0 && height > 0) {
+    gst_caps_set_simple (caps, "width", G_TYPE_INT, width, "height",
+        G_TYPE_INT, height, NULL);
+  }
+
+/*  add ContentProtection to caps  */
+  if ( stream->cur_adapt_set->RepresentationBase->ContentProtection != NULL){
+    GList *list;
+    GstDescriptorType *ContentProtectionDesc;
+
+    list = g_list_first (stream->cur_adapt_set->RepresentationBase->ContentProtection);
+    ContentProtectionDesc = (GstDescriptorType *) list->data;
+    gchar *schemeIdUri = ContentProtectionDesc->schemeIdUri;
+    gchar *msprPro = ContentProtectionDesc->msprPro;
+
+  if ( (schemeIdUri != NULL) && (msprPro != NULL) ){
+    gst_caps_set_simple (caps, "contentprotection_scheme_iduri", G_TYPE_STRING, schemeIdUri, "mspr:pro", G_TYPE_STRING, msprPro, NULL);
+  }
+ }
+  return caps;
+}
+
+static GstCaps *
+gst_dash_demux_get_audio_input_caps (GstDashDemux * demux,
+    GstActiveStream * stream)
+{
+  guint rate = 0, channels = 0;
+  const gchar *mimeType;
+  GstCaps *caps = NULL;
+
+  if (stream == NULL)
+    return NULL;
+
+  /* if bitstreamSwitching is true we dont need to swich pads on rate/channels change */
+  if (!gst_mpd_client_get_bitstream_switching_flag (stream)) {
+    channels = gst_mpd_client_get_audio_stream_num_channels (stream);
+    rate = gst_mpd_client_get_audio_stream_rate (stream);
+  }
+  mimeType = gst_mpd_client_get_stream_mimeType (stream);
+  if (mimeType == NULL)
+    return NULL;
+
+  caps = gst_caps_new_simple (mimeType, NULL);
+  if (rate > 0) {
+    gst_caps_set_simple (caps, "rate", G_TYPE_INT, rate, NULL);
+  }
+  if (channels > 0) {
+    gst_caps_set_simple (caps, "channels", G_TYPE_INT, channels, NULL);
+  }
+
+/*  add ContentProtection to caps  */
+  if ( stream->cur_adapt_set->RepresentationBase->ContentProtection != NULL){
+    GList *list;
+    GstDescriptorType *ContentProtectionDesc;
+
+    list = g_list_first (stream->cur_adapt_set->RepresentationBase->ContentProtection);
+    ContentProtectionDesc = (GstDescriptorType *) list->data;
+    gchar *schemeIdUri = ContentProtectionDesc->schemeIdUri;
+    gchar *msprPro = ContentProtectionDesc->msprPro;
+
+  if ( (schemeIdUri != NULL) && (msprPro != NULL) ){
+    gst_caps_set_simple (caps, "contentprotection_scheme_iduri", G_TYPE_STRING, schemeIdUri, "mspr:pro", G_TYPE_STRING, msprPro, NULL);
+  }
+ }
+  return caps;
+}
+
+static GstCaps *
+gst_dash_demux_get_application_input_caps (GstDashDemux * demux,
+    GstActiveStream * stream)
+{
+  const gchar *mimeType;
+  GstCaps *caps = NULL;
+
+  if (stream == NULL)
+    return NULL;
+
+  mimeType = gst_mpd_client_get_stream_mimeType (stream);
+  if (mimeType == NULL)
+    return NULL;
+
+  caps = gst_caps_new_simple (mimeType, NULL);
+
+  return caps;
+}
+
+static GstCaps *
+gst_dash_demux_get_input_caps (GstDashDemux * demux, GstActiveStream * stream)
+{
+  switch (stream->mimeType) {
+    case GST_STREAM_VIDEO:
+      return gst_dash_demux_get_video_input_caps (demux, stream);
+    case GST_STREAM_AUDIO:
+      return gst_dash_demux_get_audio_input_caps (demux, stream);
+    case GST_STREAM_APPLICATION:
+      return gst_dash_demux_get_application_input_caps (demux, stream);
+    default:
+      return GST_CAPS_NONE;
+  }
+}
+
+static gboolean
+need_add_header (GstDashDemux * demux)
+{
+  GstActiveStream *stream;
+  GstCaps *caps;
+  guint stream_idx = 0;
+  gboolean switch_caps = FALSE;
+  while (stream_idx < gst_mpdparser_get_nb_active_stream (demux->client)) {
+    stream =
+        gst_mpdparser_get_active_stream_by_index (demux->client, stream_idx);
+    if (stream == NULL)
+      return FALSE;
+    caps = gst_dash_demux_get_input_caps (demux, stream);
+    if (!demux->input_caps[stream_idx]
+        || !gst_caps_is_equal (caps, demux->input_caps[stream_idx])) {
+      switch_caps = TRUE;
+      gst_caps_unref (caps);
+      break;
+    }
+    gst_caps_unref (caps);
+    stream_idx++;
+  }
+  return switch_caps;
+}
+
+/* gst_dash_demux_get_next_fragment_set:
+ *
+ * Get the next set of fragments for the current representations.
+ *
+ * This function uses the generic URI downloader API.
+ *
+ * Returns FALSE if an error occured while downloading fragments
+ *
+ */
+static gboolean
+gst_dash_demux_get_next_fragment_set (GstDashDemux * demux)
+{
+  GstActiveStream *stream;
+  GstFragment *download, *header;
+  GList *fragment_set;
+  gchar *next_fragment_uri;
+  GstClockTime duration;
+  GstClockTime timestamp;
+  gboolean discont;
+  GTimeVal now;
+  GTimeVal start;
+  GstClockTime diff;
+  guint64 size_buffer = 0;
+
+  g_get_current_time (&start);
+  /* Figure out if we will need to switch pads, thus requiring a new
+   * header to initialize the new decoding chain
+   * FIXME: redundant with needs_pad_switch */
+  gboolean need_header = need_add_header (demux);
+  guint stream_idx = 0;
+  fragment_set = NULL;
+  /* Get the fragment corresponding to each stream index */
+  while (stream_idx < gst_mpdparser_get_nb_active_stream (demux->client)) {
+    if (!gst_mpd_client_get_next_fragment (demux->client,
+            stream_idx, &discont, &next_fragment_uri, &duration, &timestamp)) {
+      GST_INFO_OBJECT (demux, "This Period doesn't contain more fragments");
+      demux->end_of_period = TRUE;
+      return FALSE;
+    }
+
+    GST_INFO_OBJECT (demux, "Fetching next fragment %s", next_fragment_uri);
+
+    download = gst_uri_downloader_fetch_uri (demux->downloader,
+        next_fragment_uri);
+    g_free (next_fragment_uri);
+
+    if (download == NULL)
+      return FALSE;
+
+    download->start_time = timestamp;
+    download->stop_time = timestamp + duration;
+
+    stream =
+        gst_mpdparser_get_active_stream_by_index (demux->client, stream_idx);
+    if (stream == NULL)
+      return FALSE;
+
+    download->index = gst_mpd_client_get_segment_index (stream) - 1;
+
+    GstCaps *caps = gst_dash_demux_get_input_caps (demux, stream);
+
+    if (need_header) {
+      /* Store the new input caps for that stream */
+      gst_caps_replace (&demux->input_caps[stream_idx], caps);
+      GST_INFO_OBJECT (demux, "Input source caps: %" GST_PTR_FORMAT,
+          demux->input_caps[stream_idx]);
+      /* We need to fetch a new header */
+      if ((header = gst_dash_demux_get_next_header (demux, stream_idx)) == NULL) {
+        GST_INFO_OBJECT (demux, "Unable to fetch header");
+      } else {
+        /* Replace fragment with a new one including the header */
+        GstFragment *new_fragment =
+            gst_dash_demux_prepend_header (demux, download, header);
+        g_object_unref (header);
+        g_object_unref (download);
+        download = new_fragment;
+      }
+    } else
+      gst_caps_unref (caps);
+
+    gst_fragment_set_caps (download, demux->input_caps[stream_idx]);
+    fragment_set = g_list_append (fragment_set, download);
+    size_buffer += gst_fragment_get_buffer_size (download);
+    stream_idx++;
+  }
+  /* Push fragment set into the queue */
+  g_queue_push_tail (demux->queue, fragment_set);
+  /* Wake the download task up */
+  GST_TASK_SIGNAL (demux->download_task);
+  g_get_current_time (&now);
+  diff = (GST_TIMEVAL_TO_TIME (now) - GST_TIMEVAL_TO_TIME (start));
+  demux->dnl_rate = (size_buffer * 8) / ((double) diff / GST_SECOND);
+  GST_INFO_OBJECT (demux,
+      "Download rate = %" PRIu64 " Kbits/s (%" PRIu64 " Ko in %.2f s)",
+      demux->dnl_rate / 1000, size_buffer / 1024, ((double) diff / GST_SECOND));
+  return TRUE;
+}
diff --git a/wearable/dashdemux/src/gstdashdemux.h b/wearable/dashdemux/src/gstdashdemux.h
new file mode 100755 (executable)
index 0000000..ec5d8ec
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * DASH demux plugin for GStreamer
+ *
+ * gstdashdemux.h
+ *
+ * Copyright (C) 2012 Orange
+ *
+ * Authors:
+ *   David Corvoysier <david.corvoysier@orange.com>
+ *   Hamid Zakari <hamid.zakari@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library (COPYING); if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_DASH_DEMUX_H__
+#define __GST_DASH_DEMUX_H__
+#define DASHDEMUX_MODIFICATION
+#include <gst/gst.h>
+#include <gst/base/gstadapter.h>
+#include <gst/gst.h>
+#include <gst/base/gstadapter.h>
+#include "gstmpdparser.h"
+#include "gstfragmented.h"
+#include "gsturidownloader.h"
+
+G_BEGIN_DECLS
+#define GST_TYPE_DASH_DEMUX \
+        (gst_dash_demux_get_type())
+#define GST_DASH_DEMUX(obj) \
+        (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DASH_DEMUX,GstDashDemux))
+#define GST_DASH_DEMUX_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DASH_DEMUX,GstDashDemuxClass))
+#define GST_IS_DASH_DEMUX(obj) \
+        (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DASH_DEMUX))
+#define GST_IS_DASH_DEMUX_CLASS(klass) \
+        (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DASH_DEMUX))
+//
+typedef struct _GstDashDemux GstDashDemux;
+typedef struct _GstDashDemuxClass GstDashDemuxClass;
+#define MAX_LANGUAGES 20
+/**
+ * GstDashDemux:
+ *
+ * Opaque #GstDashDemux data structure.
+ */
+struct _GstDashDemux
+{
+  GstElement parent;
+  GstPad *sinkpad;
+  GstPad *srcpad[MAX_LANGUAGES];        /*Video/Audio/Application src pad */
+  GstCaps *output_caps[MAX_LANGUAGES];  /*Video/Audio/Application output buf caps */
+  GstCaps *input_caps[MAX_LANGUAGES];   /*Video/Audio/Application input caps */
+
+  GstBuffer *manifest;
+  GstUriDownloader *downloader;
+  GstMpdClient *client;         /* MPD client */
+  GQueue *queue;                /* Video/Audio/Application List of fragment storing the fetched fragments */
+  gboolean end_of_period;
+  gboolean end_of_manifest;
+
+  /* Properties */
+  GstClockTime min_buffering_time;      /* Minimum buffering time accumulated before playback */
+  GstClockTime max_buffering_time;      /* Maximum buffering time accumulated during playback */
+  gfloat bandwidth_usage;       /* Percentage of the available bandwidth to use       */
+  guint64 max_bitrate;          /* max of bitrate supported by target decoder         */
+
+  /* Streaming task */
+  GstTask *stream_task;
+  GStaticRecMutex stream_lock;
+  GMutex *stream_timed_lock;
+  GTimeVal next_push;           /* Time of the next push */
+
+  /* Download task */
+  GstTask *download_task;
+  GStaticRecMutex download_lock;
+  gboolean cancelled;
+  GMutex *download_timed_lock;
+  GTimeVal next_download;       /* Time of the next download */
+
+  /* Manifest update */
+  GstClockTime last_manifest_update;
+
+  /* Position in the stream */
+  GstClockTime position;
+  GstClockTime position_shift;
+  gboolean need_segment;
+  /* Download rate */
+  guint64 dnl_rate;
+};
+
+struct _GstDashDemuxClass
+{
+  GstElementClass parent_class;
+};
+
+GType gst_dash_demux_get_type (void);
+
+G_END_DECLS
+#endif /* __GST_DASH_DEMUX_H__ */
diff --git a/wearable/dashdemux/src/gstfragment.c b/wearable/dashdemux/src/gstfragment.c
new file mode 100755 (executable)
index 0000000..c820c8f
--- /dev/null
@@ -0,0 +1,281 @@
+/* GStreamer
+ * Copyright (C) 2011 Andoni Morales Alastruey <ylatuya@gmail.com>
+ *
+ * gstfragment.c:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include <gst/base/gsttypefindhelper.h>
+#include "glibcompat.h"
+#include "gstfragmented.h"
+#include "gstfragment.h"
+
+#define GST_CAT_DEFAULT fragmented_debug
+
+#define GST_FRAGMENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_FRAGMENT, GstFragmentPrivate))
+
+enum
+{
+  PROP_0,
+  PROP_INDEX,
+  PROP_NAME,
+  PROP_DURATION,
+  PROP_DISCONTINOUS,
+  PROP_BUFFER_LIST,
+  PROP_CAPS,
+  PROP_LAST
+};
+
+struct _GstFragmentPrivate
+{
+  GstBufferList *buffer_list;
+  guint64 size;
+  GstBufferListIterator *buffer_iterator;
+  GstCaps *caps;
+  G_MUTEX lock;
+};
+
+G_DEFINE_TYPE (GstFragment, gst_fragment, G_TYPE_OBJECT);
+
+static void gst_fragment_dispose (GObject * object);
+static void gst_fragment_finalize (GObject * object);
+
+static void
+gst_fragment_set_property (GObject * object,
+    guint property_id, const GValue * value, GParamSpec * pspec)
+{
+  GstFragment *fragment = GST_FRAGMENT (object);
+
+  switch (property_id) {
+    case PROP_CAPS:
+      gst_fragment_set_caps (fragment, g_value_get_boxed (value));
+      break;
+
+    default:
+      /* We don't have any other property... */
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static void
+gst_fragment_get_property (GObject * object,
+    guint property_id, GValue * value, GParamSpec * pspec)
+{
+  GstFragment *fragment = GST_FRAGMENT (object);
+
+  switch (property_id) {
+    case PROP_INDEX:
+      g_value_set_uint (value, fragment->index);
+      break;
+
+    case PROP_NAME:
+      g_value_set_string (value, fragment->name);
+      break;
+
+    case PROP_DURATION:
+      g_value_set_uint64 (value, fragment->stop_time - fragment->start_time);
+      break;
+
+    case PROP_DISCONTINOUS:
+      g_value_set_boolean (value, fragment->discontinuous);
+      break;
+
+    case PROP_BUFFER_LIST:
+      g_value_set_object (value, gst_fragment_get_buffer_list (fragment));
+      break;
+
+    case PROP_CAPS:
+      g_value_set_boxed (value, gst_fragment_get_caps (fragment));
+      break;
+
+    default:
+      /* We don't have any other property... */
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+
+
+static void
+gst_fragment_class_init (GstFragmentClass * klass)
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (GstFragmentPrivate));
+
+  gobject_class->set_property = gst_fragment_set_property;
+  gobject_class->get_property = gst_fragment_get_property;
+  gobject_class->dispose = gst_fragment_dispose;
+  gobject_class->finalize = gst_fragment_finalize;
+
+  g_object_class_install_property (gobject_class, PROP_INDEX,
+      g_param_spec_uint ("index", "Index", "Index of the fragment", 0,
+          G_MAXUINT, 0, G_PARAM_READABLE));
+
+  g_object_class_install_property (gobject_class, PROP_NAME,
+      g_param_spec_string ("name", "Name",
+          "Name of the fragment (eg:fragment-12.ts)", NULL, G_PARAM_READABLE));
+
+  g_object_class_install_property (gobject_class, PROP_DISCONTINOUS,
+      g_param_spec_boolean ("discontinuous", "Discontinous",
+          "Whether this fragment has a discontinuity or not",
+          FALSE, G_PARAM_READABLE));
+
+  g_object_class_install_property (gobject_class, PROP_DURATION,
+      g_param_spec_uint64 ("duration", "Fragment duration",
+          "Duration of the fragment", 0, G_MAXUINT64, 0, G_PARAM_READABLE));
+
+  g_object_class_install_property (gobject_class, PROP_BUFFER_LIST,
+      g_param_spec_object ("buffer-list", "Buffer List",
+          "A list with the fragment's buffers", GST_TYPE_FRAGMENT,
+          G_PARAM_READABLE));
+
+  g_object_class_install_property (gobject_class, PROP_CAPS,
+      g_param_spec_boxed ("caps", "Fragment caps",
+          "The caps of the fragment's buffer. (NULL = detect)", GST_TYPE_CAPS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gst_fragment_init (GstFragment * fragment)
+{
+  GstFragmentPrivate *priv;
+
+  fragment->priv = priv = GST_FRAGMENT_GET_PRIVATE (fragment);
+
+  G_MUTEX_INIT (fragment->priv->lock);
+  priv->buffer_list = gst_buffer_list_new ();
+  priv->size = 0;
+  priv->buffer_iterator = gst_buffer_list_iterate (priv->buffer_list);
+  gst_buffer_list_iterator_add_group (priv->buffer_iterator);
+  fragment->download_start_time = g_get_real_time ();
+  fragment->start_time = 0;
+  fragment->stop_time = 0;
+  fragment->index = 0;
+  fragment->name = g_strdup ("");
+  fragment->completed = FALSE;
+  fragment->discontinuous = FALSE;
+}
+
+GstFragment *
+gst_fragment_new (void)
+{
+  return GST_FRAGMENT (g_object_new (GST_TYPE_FRAGMENT, NULL));
+}
+
+static void
+gst_fragment_finalize (GObject * gobject)
+{
+  GstFragment *fragment = GST_FRAGMENT (gobject);
+
+  g_free (fragment->name);
+  G_MUTEX_CLEAR (fragment->priv->lock);
+
+  G_OBJECT_CLASS (gst_fragment_parent_class)->finalize (gobject);
+}
+
+void
+gst_fragment_dispose (GObject * object)
+{
+  GstFragmentPrivate *priv = GST_FRAGMENT (object)->priv;
+
+  if (priv->buffer_list != NULL) {
+    gst_buffer_list_iterator_free (priv->buffer_iterator);
+    gst_buffer_list_unref (priv->buffer_list);
+    priv->buffer_list = NULL;
+    priv->size = 0;
+  }
+
+  if (priv->caps != NULL) {
+    gst_caps_unref (priv->caps);
+    priv->caps = NULL;
+  }
+
+  G_OBJECT_CLASS (gst_fragment_parent_class)->dispose (object);
+}
+
+GstBufferList *
+gst_fragment_get_buffer_list (GstFragment * fragment)
+{
+  g_return_val_if_fail (fragment != NULL, NULL);
+
+  if (!fragment->completed)
+    return NULL;
+
+  gst_buffer_list_ref (fragment->priv->buffer_list);
+  return fragment->priv->buffer_list;
+}
+
+void
+gst_fragment_set_caps (GstFragment * fragment, GstCaps * caps)
+{
+  g_return_if_fail (fragment != NULL);
+
+  G_MUTEX_LOCK (fragment->priv->lock);
+  gst_caps_replace (&fragment->priv->caps, caps);
+  G_MUTEX_UNLOCK (fragment->priv->lock);
+}
+
+GstCaps *
+gst_fragment_get_caps (GstFragment * fragment)
+{
+  g_return_val_if_fail (fragment != NULL, NULL);
+
+  if (!fragment->completed)
+    return NULL;
+
+  G_MUTEX_LOCK (fragment->priv->lock);
+  if (fragment->priv->caps == NULL) {
+    GstBuffer *buf = gst_buffer_list_get (fragment->priv->buffer_list, 0, 0);
+    fragment->priv->caps = gst_type_find_helper_for_buffer (NULL, buf, NULL);
+  }
+  gst_caps_ref (fragment->priv->caps);
+  G_MUTEX_UNLOCK (fragment->priv->lock);
+
+  return fragment->priv->caps;
+}
+
+guint64
+gst_fragment_get_buffer_size (GstFragment * fragment)
+{
+  g_return_val_if_fail (fragment != NULL, 0);
+
+  if (!fragment->completed)
+    return 0;
+  return fragment->priv->size;
+}
+
+
+
+gboolean
+gst_fragment_add_buffer (GstFragment * fragment, GstBuffer * buffer)
+{
+  g_return_val_if_fail (fragment != NULL, FALSE);
+  g_return_val_if_fail (buffer != NULL, FALSE);
+
+  if (fragment->completed) {
+    GST_WARNING ("Fragment is completed, could not add more buffers");
+    return FALSE;
+  }
+
+  gst_buffer_list_iterator_add (fragment->priv->buffer_iterator, buffer);
+  fragment->priv->size = fragment->priv->size + GST_BUFFER_SIZE (buffer);
+  return TRUE;
+}
diff --git a/wearable/dashdemux/src/gstfragment.h b/wearable/dashdemux/src/gstfragment.h
new file mode 100755 (executable)
index 0000000..e6f7088
--- /dev/null
@@ -0,0 +1,71 @@
+/* GStreamer
+ * Copyright (C) 2011 Andoni Morales Alastruey <ylatuya@gmail.com>
+ *
+ * gstfragment.h:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GSTFRAGMENT_H__
+#define __GSTFRAGMENT_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_FRAGMENT (gst_fragment_get_type())
+#define GST_FRAGMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FRAGMENT,GstFragment))
+#define GST_FRAGMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_FRAGMENT,GstFragmentClass))
+#define GST_IS_FRAGMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FRAGMENT))
+#define GST_IS_FRAGMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FRAGMENT))
+
+typedef struct _GstFragment GstFragment;
+typedef struct _GstFragmentPrivate GstFragmentPrivate;
+typedef struct _GstFragmentClass GstFragmentClass;
+
+struct _GstFragment
+{
+  GObject parent;
+
+  gchar * name;                 /* Name of the fragment */
+  gboolean completed;           /* Whether the fragment is complete or not */
+  guint64 download_start_time;  /* Epoch time when the download started */
+  guint64 download_stop_time;   /* Epoch time when the download finished */
+  guint64 start_time;           /* Start time of the fragment */
+  guint64 stop_time;            /* Stop time of the fragment */
+  gboolean index;               /* Index of the fragment */
+  gboolean discontinuous;       /* Whether this fragment is discontinuous or not */
+
+  GstFragmentPrivate *priv;
+};
+
+struct _GstFragmentClass
+{
+  GObjectClass parent_class;
+};
+
+GType gst_fragment_get_type (void);
+
+guint64 gst_fragment_get_buffer_size (GstFragment * fragment);
+GstBufferList * gst_fragment_get_buffer_list (GstFragment *fragment);
+void gst_fragment_set_caps (GstFragment * fragment, GstCaps * caps);
+GstCaps * gst_fragment_get_caps (GstFragment * fragment);
+gboolean gst_fragment_add_buffer (GstFragment *fragment, GstBuffer *buffer);
+GstFragment * gst_fragment_new (void);
+
+G_END_DECLS
+#endif /* __GSTFRAGMENT_H__ */
diff --git a/wearable/dashdemux/src/gstfragmented.h b/wearable/dashdemux/src/gstfragmented.h
new file mode 100755 (executable)
index 0000000..0214a93
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __GST_FRAGMENTED_H__
+#define __GST_FRAGMENTED_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+GST_DEBUG_CATEGORY_EXTERN (fragmented_debug);
+
+#define LOG_CAPS(obj, caps) GST_DEBUG_OBJECT (obj, "%s: %" GST_PTR_FORMAT, #caps, caps)
+
+G_END_DECLS
+
+#endif /* __GST_FRAGMENTED_H__ */
+
diff --git a/wearable/dashdemux/src/gstmpdparser.c b/wearable/dashdemux/src/gstmpdparser.c
new file mode 100755 (executable)
index 0000000..474a9ac
--- /dev/null
@@ -0,0 +1,3499 @@
+/*
+ * DASH MPD parsing library
+ *
+ * gstmpdparser.c
+ *
+ * Copyright (C) 2012 STMicroelectronics
+ *
+ * Authors:
+ *   Gianluca Gennari <gennarone@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library (COPYING); if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <string.h>
+#include <libxml/tree.h>
+#include "gstfragmented.h"
+#include "gstmpdparser.h"
+
+#define GST_CAT_DEFAULT fragmented_debug
+
+/* Property parsing */
+static gchar *gst_mpdparser_get_xml_prop_string (xmlNode * a_node,
+    const gchar * property);
+static gchar **gst_mpdparser_get_xml_prop_string_vector_type (xmlNode * a_node,
+    const gchar * property);
+static guint gst_mpdparser_get_xml_prop_unsigned_integer (xmlNode * a_node,
+    const gchar * property, guint default_val);
+static guint *gst_mpdparser_get_xml_prop_uint_vector_type (xmlNode * a_node,
+    const gchar * property, guint * size);
+static gdouble gst_mpdparser_get_xml_prop_double (xmlNode * a_node,
+    const gchar * property);
+static gboolean gst_mpdparser_get_xml_prop_boolean (xmlNode * a_node,
+    const gchar * property);
+static GstMPDFileType gst_mpdparser_get_xml_prop_type (xmlNode * a_node,
+    const gchar * property);
+static GstSAPType gst_mpdparser_get_xml_prop_SAP_type (xmlNode * a_node,
+    const gchar * property);
+static GstRange *gst_mpdparser_get_xml_prop_range (xmlNode * a_node,
+    const gchar * property);
+static GstRatio *gst_mpdparser_get_xml_prop_ratio (xmlNode * a_node,
+    const gchar * property);
+static GstFrameRate *gst_mpdparser_get_xml_prop_framerate (xmlNode * a_node,
+    const gchar * property);
+static GstConditionalUintType *gst_mpdparser_get_xml_prop_cond_uint (xmlNode *
+    a_node, const gchar * property);
+static GstDateTime *gst_mpdparser_get_xml_prop_dateTime (xmlNode * a_node,
+    const gchar * property);
+static gint64 gst_mpdparser_get_xml_prop_duration (xmlNode * a_node,
+    const gchar * property);
+static gchar *gst_mpdparser_get_xml_node_content (xmlNode * a_node);
+static gchar *gst_mpdparser_get_xml_node_namespace (xmlNode * a_node,
+    const gchar * prefix);
+
+/* XML node parsing */
+static void gst_mpdparser_parse_baseURL_node (GList ** list, xmlNode * a_node);
+static void gst_mpdparser_parse_descriptor_type_node (GList ** list,
+    xmlNode * a_node);
+static void gst_mpdparser_parse_content_component_node (GList ** list,
+    xmlNode * a_node);
+static void gst_mpdparser_parse_location_node (GList ** list, xmlNode * a_node);
+static void gst_mpdparser_parse_subrepresentation_node (GList ** list,
+    xmlNode * a_node);
+static void gst_mpdparser_parse_segment_url_node (GList ** list,
+    xmlNode * a_node);
+static void gst_mpdparser_parse_url_type_node (GstURLType ** pointer,
+    xmlNode * a_node);
+static void gst_mpdparser_parse_seg_base_type_ext (GstSegmentBaseType **
+    pointer, xmlNode * a_node);
+static void gst_mpdparser_parse_s_node (GList ** list, xmlNode * a_node);
+static void gst_mpdparser_parse_segment_timeline_node (GstSegmentTimelineNode **
+    pointer, xmlNode * a_node);
+static void gst_mpdparser_parse_mult_seg_base_type_ext (GstMultSegmentBaseType
+    ** pointer, xmlNode * a_node);
+static void gst_mpdparser_parse_segment_list_node (GstSegmentListNode **
+    pointer, xmlNode * a_node);
+static void
+gst_mpdparser_parse_representation_base_type (GstRepresentationBaseType **
+    pointer, xmlNode * a_node);
+static void gst_mpdparser_parse_representation_node (GList ** list,
+    xmlNode * a_node);
+static void gst_mpdparser_parse_adaptation_set_node (GList ** list,
+    xmlNode * a_node);
+static void gst_mpdparser_parse_subset_node (GList ** list, xmlNode * a_node);
+static void gst_mpdparser_parse_segment_template_node (GstSegmentTemplateNode **
+    pointer, xmlNode * a_node);
+static void gst_mpdparser_parse_period_node (GList ** list, xmlNode * a_node);
+static void gst_mpdparser_parse_program_info_node (GList ** list,
+    xmlNode * a_node);
+static void gst_mpdparser_parse_metrics_range_node (GList ** list,
+    xmlNode * a_node);
+static void gst_mpdparser_parse_metrics_node (GList ** list, xmlNode * a_node);
+static void gst_mpdparser_parse_root_node (GstMPDNode ** pointer,
+    xmlNode * a_node);
+
+/* Helper functions */
+static gint convert_to_millisecs (gint decimals, gint pos);
+static int strncmp_ext (const char *s1, const char *s2);
+static GstStreamPeriod *gst_mpdparser_get_stream_period (GstMpdClient * client);
+static gchar *gst_mpdparser_parse_baseURL (GstMpdClient * client);
+static gchar *gst_mpdparser_get_segmentURL_for_range (gchar * url,
+    GstRange * range);
+static gchar *gst_mpdparser_get_mediaURL (GstMpdClient * client,
+    GstSegmentURLNode * segmentURL);
+static gchar *gst_mpdparser_get_initializationURL (GstURLType *
+    InitializationURL);
+static gchar *gst_mpdparser_build_URL_from_template (const gchar * url_template,
+    const gchar * id, guint number, guint bandwidth, guint time);
+static gboolean gst_mpd_client_add_media_segment (GstActiveStream * stream,
+    GstSegmentURLNode * url_node, guint number, guint start,
+    GstClockTime start_time, GstClockTime duration);
+static const gchar *gst_mpdparser_mimetype_to_caps (const gchar * mimeType);
+static GstClockTime gst_mpd_client_get_segment_duration (GstMpdClient * client);
+static void gst_mpd_client_set_segment_index (GstActiveStream * stream,
+    guint segment_idx);
+
+/* Adaptation Set */
+static GstAdaptationSetNode
+    *gst_mpdparser_get_first_adapt_set_with_mimeType (GList * AdaptationSets,
+    const gchar * mimeType);
+static GstAdaptationSetNode
+    *gst_mpdparser_get_adapt_set_with_mimeType_and_idx (GList * AdaptationSets,
+    const gchar * mimeType, gint idx);
+static GstAdaptationSetNode
+    *gst_mpdparser_get_first_adapt_set_with_mimeType_and_lang (GList *
+    AdaptationSets, const gchar * mimeType, const gchar * lang);
+
+/* Representation */
+static GstRepresentationNode *gst_mpdparser_get_lowest_representation (GList *
+    Representations);
+#if 0
+static GstRepresentationNode *gst_mpdparser_get_highest_representation (GList *
+    Representations);
+static GstRepresentationNode
+    *gst_mpdparser_get_representation_with_max_bandwidth (GList *
+    Representations, gint max_bandwidth);
+#endif
+static GstSegmentBaseType *gst_mpdparser_get_segment_base (GstPeriodNode *
+    Period, GstAdaptationSetNode * AdaptationSet,
+    GstRepresentationNode * Representation);
+static GstSegmentListNode *gst_mpdparser_get_segment_list (GstPeriodNode *
+    Period, GstAdaptationSetNode * AdaptationSet,
+    GstRepresentationNode * Representation);
+
+/* Memory management */
+static void gst_mpdparser_free_mpd_node (GstMPDNode * mpd_node);
+static void gst_mpdparser_free_prog_info_node (GstProgramInformationNode *
+    prog_info_node);
+static void gst_mpdparser_free_metrics_node (GstMetricsNode * metrics_node);
+static void gst_mpdparser_free_metrics_range_node (GstMetricsRangeNode *
+    metrics_range_node);
+static void gst_mpdparser_free_period_node (GstPeriodNode * period_node);
+static void gst_mpdparser_free_subset_node (GstSubsetNode * subset_node);
+static void gst_mpdparser_free_segment_template_node (GstSegmentTemplateNode *
+    segment_template_node);
+static void
+gst_mpdparser_free_representation_base_type (GstRepresentationBaseType *
+    representation_base);
+static void gst_mpdparser_free_adaptation_set_node (GstAdaptationSetNode *
+    adaptation_set_node);
+static void gst_mpdparser_free_representation_node (GstRepresentationNode *
+    representation_node);
+static void gst_mpdparser_free_subrepresentation_node (GstSubRepresentationNode
+    * subrep_node);
+static void gst_mpdparser_free_s_node (GstSNode * s_node);
+static void gst_mpdparser_free_segment_timeline_node (GstSegmentTimelineNode *
+    seg_timeline);
+static void gst_mpdparser_free_url_type_node (GstURLType * url_type_node);
+static void gst_mpdparser_free_seg_base_type_ext (GstSegmentBaseType *
+    seg_base_type);
+static void gst_mpdparser_free_mult_seg_base_type_ext (GstMultSegmentBaseType *
+    mult_seg_base_type);
+static void gst_mpdparser_free_segment_list_node (GstSegmentListNode *
+    segment_list_node);
+static void gst_mpdparser_free_segment_url_node (GstSegmentURLNode *
+    segment_url);
+static void gst_mpdparser_free_base_url_node (GstBaseURL * base_url_node);
+static void gst_mpdparser_free_descriptor_type_node (GstDescriptorType *
+    descriptor_type);
+static void gst_mpdparser_free_content_component_node (GstContentComponentNode *
+    content_component_node);
+static void gst_mpdparser_free_stream_period (GstStreamPeriod * stream_period);
+static void gst_mpdparser_free_media_segment (GstMediaSegment * media_segment);
+static void gst_mpdparser_free_active_stream (GstActiveStream * active_stream);
+
+/* functions to parse node namespaces, content and properties */
+static gchar *
+gst_mpdparser_get_xml_prop_string (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    GST_LOG (" - %s: %s", property, prop_string);
+  }
+
+  return (gchar *) prop_string;
+}
+
+static gchar **
+gst_mpdparser_get_xml_prop_string_vector_type (xmlNode * a_node,
+    const gchar * property)
+{
+  xmlChar *prop_string;
+  gchar **prop_string_vector = NULL;
+  guint i = 0;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    prop_string_vector = g_strsplit ((gchar *) prop_string, " ", -1);
+    if (!prop_string_vector) {
+      GST_WARNING ("Scan of string vector property failed!");
+      return NULL;
+    }
+    GST_LOG (" - %s:", property);
+    while (prop_string_vector[i]) {
+      GST_LOG ("    %s", prop_string_vector[i]);
+      i++;
+    }
+    xmlFree (prop_string);
+  }
+
+  return prop_string_vector;
+}
+
+static guint
+gst_mpdparser_get_xml_prop_unsigned_integer (xmlNode * a_node,
+    const gchar * property, guint default_val)
+{
+  xmlChar *prop_string;
+  guint prop_unsigned_integer = default_val;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    if (sscanf ((gchar *) prop_string, "%u", &prop_unsigned_integer)) {
+      GST_LOG (" - %s: %u", property, prop_unsigned_integer);
+    } else {
+      GST_WARNING
+          ("failed to parse unsigned integer property %s from xml string %s",
+          property, prop_string);
+    }
+    xmlFree (prop_string);
+  }
+
+  return prop_unsigned_integer;
+}
+
+static guint *
+gst_mpdparser_get_xml_prop_uint_vector_type (xmlNode * a_node,
+    const gchar * property, guint * size)
+{
+  xmlChar *prop_string;
+  gchar **str_vector;
+  guint *prop_uint_vector = NULL, i;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    str_vector = g_strsplit ((gchar *) prop_string, " ", -1);
+    if (!str_vector) {
+      GST_WARNING ("Scan of uint vector property failed!");
+      return NULL;
+    }
+    *size = g_strv_length (str_vector);
+    prop_uint_vector = g_malloc (*size * sizeof (guint));
+    if (!prop_uint_vector) {
+      GST_WARNING ("Array allocation failed!");
+    } else {
+      GST_LOG (" - %s:", property);
+      for (i = 0; i < *size; i++) {
+        if (sscanf ((gchar *) str_vector[i], "%u", &prop_uint_vector[i])) {
+          GST_LOG ("    %u", prop_uint_vector[i]);
+        } else {
+          GST_WARNING
+              ("failed to parse uint vector type property %s from xml string %s",
+              property, str_vector[i]);
+        }
+      }
+    }
+    xmlFree (prop_string);
+    g_strfreev (str_vector);
+  }
+
+  return prop_uint_vector;
+}
+
+static gdouble
+gst_mpdparser_get_xml_prop_double (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  gdouble prop_double = 0;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    if (sscanf ((gchar *) prop_string, "%lf", &prop_double)) {
+      GST_LOG (" - %s: %lf", property, prop_double);
+    } else {
+      GST_WARNING ("failed to parse double property %s from xml string %s",
+          property, prop_string);
+    }
+    xmlFree (prop_string);
+  }
+
+  return prop_double;
+}
+
+static gboolean
+gst_mpdparser_get_xml_prop_boolean (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  gboolean prop_bool = FALSE;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    if (xmlStrcmp (prop_string, (xmlChar *) "false") == 0) {
+      GST_LOG (" - %s: false", property);
+    } else if (xmlStrcmp (prop_string, (xmlChar *) "true") == 0) {
+      GST_LOG (" - %s: true", property);
+      prop_bool = TRUE;
+    } else {
+      GST_WARNING ("failed to parse boolean property %s from xml string %s",
+          property, prop_string);
+    }
+    xmlFree (prop_string);
+  }
+
+  return prop_bool;
+}
+
+static GstMPDFileType
+gst_mpdparser_get_xml_prop_type (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  GstMPDFileType prop_type = GST_MPD_FILE_TYPE_STATIC;  /* default */
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    if (xmlStrcmp (prop_string, (xmlChar *) "OnDemand") == 0
+        || xmlStrcmp (prop_string, (xmlChar *) "static") == 0) {
+      GST_LOG (" - %s: static", property);
+      prop_type = GST_MPD_FILE_TYPE_STATIC;
+    } else if (xmlStrcmp (prop_string, (xmlChar *) "Live") == 0
+        || xmlStrcmp (prop_string, (xmlChar *) "dynamic") == 0) {
+      GST_LOG (" - %s: dynamic", property);
+      prop_type = GST_MPD_FILE_TYPE_DYNAMIC;
+    } else {
+      GST_WARNING ("failed to parse MPD type property %s from xml string %s",
+          property, prop_string);
+    }
+    xmlFree (prop_string);
+  }
+
+  return prop_type;
+}
+
+static GstSAPType
+gst_mpdparser_get_xml_prop_SAP_type (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  guint prop_SAP_type = 0;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    if (sscanf ((gchar *) prop_string, "%u", &prop_SAP_type)
+        && prop_SAP_type <= 6) {
+      GST_LOG (" - %s: %u", property, prop_SAP_type);
+    } else {
+      GST_WARNING
+          ("failed to parse unsigned integer property %s from xml string %s",
+          property, prop_string);
+    }
+    xmlFree (prop_string);
+  }
+
+  return (GstSAPType) prop_SAP_type;
+}
+
+static GstRange *
+gst_mpdparser_get_xml_prop_range (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  GstRange *prop_range = NULL;
+  guint64 first_byte_pos = 0, last_byte_pos = 0;
+  guint len, pos;
+  gchar *str;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    len = xmlStrlen (prop_string);
+    str = (gchar *) prop_string;
+    GST_TRACE ("range: %s, len %d", str, len);
+
+    /* read "-" */
+    pos = strcspn (str, "-");
+    if (pos >= len) {
+      GST_TRACE ("pos %d >= len %d", pos, len);
+      goto error;
+    }
+    /* read first_byte_pos */
+    if (pos != 0) {
+      if (sscanf (str, "%llu", &first_byte_pos) != 1) {
+        goto error;
+      }
+    }
+    /* read last_byte_pos */
+    if (pos < (len - 1)) {
+      if (sscanf (str + pos + 1, "%llu", &last_byte_pos) != 1) {
+        goto error;
+      }
+    }
+    /* malloc return data structure */
+    prop_range = g_slice_new0 (GstRange);
+    if (prop_range == NULL) {
+      GST_WARNING ("Allocation of GstRange failed!");
+      goto error;
+    }
+    prop_range->first_byte_pos = first_byte_pos;
+    prop_range->last_byte_pos = last_byte_pos;
+    GST_LOG (" - %s: %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT,
+        property, first_byte_pos, last_byte_pos);
+    xmlFree (prop_string);
+  }
+
+  return prop_range;
+
+error:
+  GST_WARNING ("failed to parse property %s from xml string %s", property,
+      prop_string);
+  return NULL;
+}
+
+static GstRatio *
+gst_mpdparser_get_xml_prop_ratio (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  GstRatio *prop_ratio = NULL;
+  guint num = 0, den = 1;
+  guint len, pos;
+  gchar *str;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    len = xmlStrlen (prop_string);
+    str = (gchar *) prop_string;
+    GST_TRACE ("ratio: %s, len %d", str, len);
+
+    /* read ":" */
+    pos = strcspn (str, ":");
+    if (pos >= len) {
+      GST_TRACE ("pos %d >= len %d", pos, len);
+      goto error;
+    }
+    /* read num */
+    if (pos != 0) {
+      if (sscanf (str, "%u", &num) != 1) {
+        goto error;
+      }
+    }
+    /* read den */
+    if (pos < (len - 1)) {
+      if (sscanf (str + pos + 1, "%u", &den) != 1) {
+        goto error;
+      }
+    }
+    /* malloc return data structure */
+    prop_ratio = g_slice_new0 (GstRatio);
+    if (prop_ratio == NULL) {
+      GST_WARNING ("Allocation of GstRatio failed!");
+      goto error;
+    }
+    prop_ratio->num = num;
+    prop_ratio->den = den;
+    GST_LOG (" - %s: %u:%u", property, num, den);
+    xmlFree (prop_string);
+  }
+
+  return prop_ratio;
+
+error:
+  GST_WARNING ("failed to parse property %s from xml string %s", property,
+      prop_string);
+  return NULL;
+}
+
+static GstFrameRate *
+gst_mpdparser_get_xml_prop_framerate (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  GstFrameRate *prop_framerate = NULL;
+  guint num = 0, den = 1;
+  guint len, pos;
+  gchar *str;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    len = xmlStrlen (prop_string);
+    str = (gchar *) prop_string;
+    GST_TRACE ("framerate: %s, len %d", str, len);
+
+    /* read "/" if available */
+    pos = strcspn (str, "/");
+    /* read num */
+    if (pos != 0) {
+      if (sscanf (str, "%u", &num) != 1) {
+        goto error;
+      }
+    }
+    /* read den (if available) */
+    if (pos < (len - 1)) {
+      if (sscanf (str + pos + 1, "%u", &den) != 1) {
+        goto error;
+      }
+    }
+    /* alloc return data structure */
+    prop_framerate = g_slice_new0 (GstFrameRate);
+    if (prop_framerate == NULL) {
+      GST_WARNING ("Allocation of GstFrameRate failed!");
+      goto error;
+    }
+    prop_framerate->num = num;
+    prop_framerate->den = den;
+    if (den == 1)
+      GST_LOG (" - %s: %u", property, num);
+    else
+      GST_LOG (" - %s: %u/%u", property, num, den);
+    xmlFree (prop_string);
+  }
+
+  return prop_framerate;
+
+error:
+  GST_WARNING ("failed to parse property %s from xml string %s", property,
+      prop_string);
+  return NULL;
+}
+
+static GstConditionalUintType *
+gst_mpdparser_get_xml_prop_cond_uint (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  GstConditionalUintType *prop_cond_uint = NULL;
+  gchar *str;
+  gboolean flag;
+  guint val;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    str = (gchar *) prop_string;
+    GST_TRACE ("conditional uint: %s", str);
+
+    if (strcmp (str, "false") == 0) {
+      flag = FALSE;
+      val = 0;
+    } else if (strcmp (str, "true") == 0) {
+      flag = TRUE;
+      val = 0;
+    } else {
+      flag = TRUE;
+      if (sscanf (str, "%u", &val) != 1)
+        goto error;
+    }
+
+    /* alloc return data structure */
+    prop_cond_uint = g_slice_new0 (GstConditionalUintType);
+    if (prop_cond_uint == NULL) {
+      GST_WARNING ("Allocation of GstConditionalUintType failed!");
+      goto error;
+    }
+    prop_cond_uint->flag = flag;
+    prop_cond_uint->value = val;
+    GST_LOG (" - %s: flag=%s val=%u", property, flag ? "true" : "false", val);
+    xmlFree (prop_string);
+  }
+
+  return prop_cond_uint;
+
+error:
+  GST_WARNING ("failed to parse property %s from xml string %s", property,
+      prop_string);
+  return NULL;
+}
+
+/*
+  DateTime Data Type
+
+  The dateTime data type is used to specify a date and a time.
+
+  The dateTime is specified in the following form "YYYY-MM-DDThh:mm:ss" where:
+
+    * YYYY indicates the year
+    * MM indicates the month
+    * DD indicates the day
+    * T indicates the start of the required time section
+    * hh indicates the hour
+    * mm indicates the minute
+    * ss indicates the second
+
+  Note: All components are required!
+*/
+
+static GstDateTime *
+gst_mpdparser_get_xml_prop_dateTime (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  gchar *str;
+  gint ret, len, pos;
+  gint year, month, day, hour, minute, second;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    len = xmlStrlen (prop_string);
+    str = (gchar *) prop_string;
+    GST_TRACE ("dateTime: %s, len %d", str, len);
+    /* parse year */
+    ret = sscanf (str, "%d", &year);
+    if (ret != 1)
+      goto error;
+    pos = strcspn (str, "-");
+    str += (pos + 1);
+    GST_TRACE (" - year %d", year);
+    /* parse month */
+    ret = sscanf (str, "%d", &month);
+    if (ret != 1)
+      goto error;
+    pos = strcspn (str, "-");
+    str += (pos + 1);
+    GST_TRACE (" - month %d", month);
+    /* parse day */
+    ret = sscanf (str, "%d", &day);
+    if (ret != 1)
+      goto error;
+    pos = strcspn (str, "T");
+    str += (pos + 1);
+    GST_TRACE (" - day %d", day);
+    /* parse hour */
+    ret = sscanf (str, "%d", &hour);
+    if (ret != 1)
+      goto error;
+    pos = strcspn (str, ":");
+    str += (pos + 1);
+    GST_TRACE (" - hour %d", hour);
+    /* parse minute */
+    ret = sscanf (str, "%d", &minute);
+    if (ret != 1)
+      goto error;
+    pos = strcspn (str, ":");
+    str += (pos + 1);
+    GST_TRACE (" - minute %d", minute);
+    /* parse second */
+    ret = sscanf (str, "%d", &second);
+    if (ret != 1)
+      goto error;
+    GST_TRACE (" - second %d", second);
+
+    GST_LOG (" - %s: %4d/%02d/%02d %02d:%02d:%02d", property,
+        year, month, day, hour, minute, second);
+
+    return gst_date_time_new (0, year, month, day, hour, minute, second);
+  }
+
+  return NULL;
+
+error:
+  GST_WARNING ("failed to parse property %s from xml string %s", property,
+      prop_string);
+  return NULL;
+}
+
+/*
+  Duration Data Type
+
+  The duration data type is used to specify a time interval.
+
+  The time interval is specified in the following form "-PnYnMnDTnHnMnS" where:
+
+    * - indicates the negative sign (optional)
+    * P indicates the period (required)
+    * nY indicates the number of years
+    * nM indicates the number of months
+    * nD indicates the number of days
+    * T indicates the start of a time section (required if you are going to specify hours, minutes, or seconds)
+    * nH indicates the number of hours
+    * nM indicates the number of minutes
+    * nS indicates the number of seconds
+*/
+
+/* this function computes decimals * 10 ^ (3 - pos) */
+static gint
+convert_to_millisecs (gint decimals, gint pos)
+{
+  gint num = 1, den = 1, i = 3 - pos;
+
+  while (i < 0) {
+    den *= 10;
+    i++;
+  }
+  while (i > 0) {
+    num *= 10;
+    i--;
+  }
+  /* if i == 0 we have exactly 3 decimals and nothing to do */
+  return decimals * num / den;
+}
+
+static gint64
+gst_mpdparser_get_xml_prop_duration (xmlNode * a_node, const gchar * property)
+{
+  xmlChar *prop_string;
+  gchar *str;
+  gint64 prop_duration = -1;
+  gint ret, read, len, pos, posT;
+  gint years = 0, months = 0, days = 0, hours = 0, minutes = 0, seconds =
+      0, decimals = 0;
+  gint sign = 1;
+  gboolean have_ms = FALSE;
+
+  prop_string = xmlGetProp (a_node, (const xmlChar *) property);
+  if (prop_string) {
+    len = xmlStrlen (prop_string);
+    str = (gchar *) prop_string;
+    GST_TRACE ("duration: %s, len %d", str, len);
+    /* read "-" for sign, if present */
+    pos = strcspn (str, "-");
+    if (pos < len) {            /* found "-" */
+      if (pos != 0) {
+        GST_WARNING ("sign \"-\" non at the beginning of the string");
+        return -1;
+      }
+      GST_TRACE ("found - sign at the beginning");
+      sign = -1;
+      str++;
+      len--;
+    }
+    /* read "P" for period */
+    pos = strcspn (str, "P");
+    if (pos != 0) {
+      GST_WARNING ("P not found at the beginning of the string!");
+      return -1;
+    }
+    str++;
+    len--;
+    /* read "T" for time (if present) */
+    posT = strcspn (str, "T");
+    len -= posT;
+    if (posT > 0) {
+      /* there is some room between P and T, so there must be a period section */
+      /* read years, months, days */
+      do {
+        GST_TRACE ("parsing substring %s", str);
+        pos = strcspn (str, "YMD");
+        ret = sscanf (str, "%d", &read);
+        if (ret != 1) {
+          GST_WARNING ("can not read integer value from string %s!", str);
+          return -1;
+        }
+        switch (str[pos]) {
+          case 'Y':
+            years = read;
+            break;
+          case 'M':
+            months = read;
+            break;
+          case 'D':
+            days = read;
+            break;
+          default:
+            GST_WARNING ("unexpected char %c!", str[pos]);
+            return -1;
+            break;
+        }
+        GST_TRACE ("read number %d type %c", read, str[pos]);
+        str += (pos + 1);
+        posT -= (pos + 1);
+      } while (posT > 0);
+
+      GST_TRACE ("Y:M:D=%d:%d:%d", years, months, days);
+    }
+    /* read "T" for time (if present) */
+    /* here T is at pos == 0 */
+    str++;
+    len--;
+    pos = 0;
+    if (pos < len) {
+      /* T found, there is a time section */
+      /* read hours, minutes, seconds, cents of second */
+      do {
+        GST_TRACE ("parsing substring %s", str);
+        pos = strcspn (str, "HMS,.");
+        ret = sscanf (str, "%d", &read);
+        if (ret != 1) {
+          GST_WARNING ("can not read integer value from string %s!", str);
+          return -1;
+        }
+        switch (str[pos]) {
+          case 'H':
+            hours = read;
+            break;
+          case 'M':
+            minutes = read;
+            break;
+          case 'S':
+            if (have_ms) {
+              /* we have read the decimal part of the seconds */
+              decimals = convert_to_millisecs (read, pos);
+              GST_TRACE ("decimal number %d (%d digits) -> %d ms", read, pos,
+                  decimals);
+            } else {
+              /* no decimals */
+              seconds = read;
+            }
+            break;
+          case '.':
+          case ',':
+            /* we have read the integer part of a decimal number in seconds */
+            seconds = read;
+            have_ms = TRUE;
+            break;
+          default:
+            GST_WARNING ("unexpected char %c!", str[pos]);
+            return -1;
+            break;
+        }
+        GST_TRACE ("read number %d type %c", read, str[pos]);
+        str += pos + 1;
+        len -= (pos + 1);
+      } while (len > 0);
+
+      GST_TRACE ("H:M:S.MS=%d:%d:%d.%03d", hours, minutes, seconds, decimals);
+    }
+
+    xmlFree (prop_string);
+    prop_duration =
+        sign * ((((((gint64) years * 365 + months * 30 + days) * 24 +
+                    hours) * 60 + minutes) * 60 + seconds) * 1000 + decimals);
+    GST_LOG (" - %s: %" G_GINT64_FORMAT, property, prop_duration);
+  }
+
+  return prop_duration;
+}
+
+static gchar *
+gst_mpdparser_get_xml_node_content (xmlNode * a_node)
+{
+  xmlChar *content = NULL;
+
+  content = xmlNodeGetContent (a_node);
+  if (content) {
+    GST_LOG (" - %s: %s", a_node->name, content);
+  }
+
+  return (gchar *) content;
+}
+
+static gchar *
+gst_mpdparser_get_xml_node_namespace (xmlNode * a_node, const gchar * prefix)
+{
+  xmlNs *curr_ns;
+  gchar *namespace = NULL;
+
+  if (prefix == NULL) {
+    /* return the default namespace */
+    namespace = g_strdup ((gchar *) a_node->ns->href);
+    if (namespace) {
+      GST_LOG (" - default namespace: %s", namespace);
+    }
+  } else {
+    /* look for the specified prefix in the namespace list */
+    for (curr_ns = a_node->ns; curr_ns; curr_ns = curr_ns->next) {
+      if (xmlStrcmp (curr_ns->prefix, (xmlChar *) prefix) == 0) {
+        namespace = g_strdup ((gchar *) curr_ns->href);
+        if (namespace) {
+          GST_LOG (" - %s namespace: %s", curr_ns->prefix, curr_ns->href);
+        }
+      }
+    }
+  }
+
+  return namespace;
+}
+
+static void
+gst_mpdparser_parse_baseURL_node (GList ** list, xmlNode * a_node)
+{
+  GstBaseURL *new_base_url;
+
+  new_base_url = g_slice_new0 (GstBaseURL);
+  if (new_base_url == NULL) {
+    GST_WARNING ("Allocation of BaseURL node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_base_url);
+
+  GST_LOG ("content of BaseURL node:");
+  new_base_url->baseURL = gst_mpdparser_get_xml_node_content (a_node);
+
+  GST_LOG ("attributes of BaseURL node:");
+  new_base_url->serviceLocation =
+      gst_mpdparser_get_xml_prop_string (a_node, "serviceLocation");
+  new_base_url->byteRange =
+      gst_mpdparser_get_xml_prop_string (a_node, "byteRange");
+}
+
+static void
+gst_mpdparser_parse_descriptor_type_node (GList ** list, xmlNode * a_node)
+{
+  GstDescriptorType *new_descriptor;
+
+  new_descriptor = g_slice_new0 (GstDescriptorType);
+  if (new_descriptor == NULL) {
+    GST_WARNING ("Allocation of DescriptorType node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_descriptor);
+
+  GST_LOG ("attributes of %s node:", a_node->name);
+  new_descriptor->schemeIdUri =
+      gst_mpdparser_get_xml_prop_string (a_node, "schemeIdUri");
+  new_descriptor->value = gst_mpdparser_get_xml_prop_string (a_node, "value");
+
+ /* For adding ContentProtection to caps , get string of <mspr:pro> */
+  if(xmlStrcmp (a_node->name,(xmlChar *) "ContentProtection") == 0) {
+    if (a_node->children->next){
+      if(xmlStrcmp (a_node->children->next->name,(xmlChar *) "pro") == 0){
+        if (a_node->children->next->type == XML_ELEMENT_NODE) {
+          new_descriptor->msprPro = gst_mpdparser_get_xml_node_content (a_node->children->next);
+          }
+        }
+      }
+    }
+}
+
+static void
+gst_mpdparser_parse_content_component_node (GList ** list, xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstContentComponentNode *new_content_component;
+
+  new_content_component = g_slice_new0 (GstContentComponentNode);
+  if (new_content_component == NULL) {
+    GST_WARNING ("Allocation of ContentComponent node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_content_component);
+
+  GST_LOG ("attributes of ContentComponent node:");
+  new_content_component->id =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "id", 0);
+  new_content_component->lang =
+      gst_mpdparser_get_xml_prop_string (a_node, "lang");
+  new_content_component->contentType =
+      gst_mpdparser_get_xml_prop_string (a_node, "contentType");
+  new_content_component->par = gst_mpdparser_get_xml_prop_ratio (a_node, "par");
+
+  /* explore children nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "Accessibility") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&new_content_component->
+            Accessibility, cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Role") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&new_content_component->Role,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Rating") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&new_content_component->
+            Rating, cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Viewpoint") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&new_content_component->
+            Viewpoint, cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_location_node (GList ** list, xmlNode * a_node)
+{
+  gchar *location;
+
+  GST_LOG ("content of Location node:");
+  location = gst_mpdparser_get_xml_node_content (a_node);
+
+  *list = g_list_append (*list, location);
+}
+
+static void
+gst_mpdparser_parse_subrepresentation_node (GList ** list, xmlNode * a_node)
+{
+  GstSubRepresentationNode *new_subrep;
+
+  new_subrep = g_slice_new0 (GstSubRepresentationNode);
+  if (new_subrep == NULL) {
+    GST_WARNING ("Allocation of SubRepresentation node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_subrep);
+
+  GST_LOG ("attributes of SubRepresentation node:");
+  new_subrep->level =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "level", 0);
+  new_subrep->dependencyLevel =
+      gst_mpdparser_get_xml_prop_uint_vector_type (a_node, "dependencyLevel",
+      &new_subrep->size);
+  new_subrep->bandwidth =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "bandwidth", 0);
+  new_subrep->contentComponent =
+      gst_mpdparser_get_xml_prop_string_vector_type (a_node,
+      "contentComponent");
+
+  /* RepresentationBase extension */
+  gst_mpdparser_parse_representation_base_type (&new_subrep->RepresentationBase,
+      a_node);
+}
+
+static void
+gst_mpdparser_parse_segment_url_node (GList ** list, xmlNode * a_node)
+{
+  GstSegmentURLNode *new_segment_url;
+
+  new_segment_url = g_slice_new0 (GstSegmentURLNode);
+  if (new_segment_url == NULL) {
+    GST_WARNING ("Allocation of SegmentURL node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_segment_url);
+
+  GST_LOG ("attributes of SegmentURL node:");
+  new_segment_url->media = gst_mpdparser_get_xml_prop_string (a_node, "media");
+  new_segment_url->mediaRange =
+      gst_mpdparser_get_xml_prop_range (a_node, "mediaRange");
+  new_segment_url->index = gst_mpdparser_get_xml_prop_string (a_node, "index");
+  new_segment_url->indexRange =
+      gst_mpdparser_get_xml_prop_range (a_node, "indexRange");
+}
+
+static void
+gst_mpdparser_parse_url_type_node (GstURLType ** pointer, xmlNode * a_node)
+{
+  GstURLType *new_url_type;
+
+  gst_mpdparser_free_url_type_node (*pointer);
+  *pointer = new_url_type = g_slice_new0 (GstURLType);
+  if (new_url_type == NULL) {
+    GST_WARNING ("Allocation of URLType node failed!");
+    return;
+  }
+
+  GST_LOG ("attributes of URLType node:");
+  new_url_type->sourceURL =
+      gst_mpdparser_get_xml_prop_string (a_node, "sourceURL");
+  new_url_type->range = gst_mpdparser_get_xml_prop_range (a_node, "range");
+}
+
+static void
+gst_mpdparser_parse_seg_base_type_ext (GstSegmentBaseType ** pointer,
+    xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstSegmentBaseType *seg_base_type;
+
+  gst_mpdparser_free_seg_base_type_ext (*pointer);
+  *pointer = seg_base_type = g_slice_new0 (GstSegmentBaseType);
+  if (seg_base_type == NULL) {
+    GST_WARNING ("Allocation of SegmentBaseType node failed!");
+    return;
+  }
+
+  GST_LOG ("attributes of SegmentBaseType extension:");
+  seg_base_type->timescale =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "timescale", 0);
+  seg_base_type->presentationTimeOffset =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node,
+      "presentationTimeOffset", 0);
+  seg_base_type->indexRange =
+      gst_mpdparser_get_xml_prop_string (a_node, "indexRange");
+  seg_base_type->indexRangeExact =
+      gst_mpdparser_get_xml_prop_boolean (a_node, "indexRangeExact");
+
+  /* explore children nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "Initialization") == 0 ||
+          xmlStrcmp (cur_node->name, (xmlChar *) "Initialisation") == 0) {
+        gst_mpdparser_parse_url_type_node (&seg_base_type->Initialization,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name,
+              (xmlChar *) "RepresentationIndex") == 0) {
+        gst_mpdparser_parse_url_type_node (&seg_base_type->RepresentationIndex,
+            cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_s_node (GList ** list, xmlNode * a_node)
+{
+  GstSNode *new_s_node;
+
+  new_s_node = g_slice_new0 (GstSNode);
+  if (new_s_node == NULL) {
+    GST_WARNING ("Allocation of S node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_s_node);
+
+  GST_LOG ("attributes of S node:");
+  new_s_node->t = gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "t", 0);
+  new_s_node->d = gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "d", 0);
+  new_s_node->r = gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "r", 0);
+}
+
+static void
+gst_mpdparser_parse_segment_timeline_node (GstSegmentTimelineNode ** pointer,
+    xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstSegmentTimelineNode *new_seg_timeline;
+
+  gst_mpdparser_free_segment_timeline_node (*pointer);
+  *pointer = new_seg_timeline = g_slice_new0 (GstSegmentTimelineNode);
+  if (new_seg_timeline == NULL) {
+    GST_WARNING ("Allocation of SegmentTimeline node failed!");
+    return;
+  }
+
+  /* explore children nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "S") == 0) {
+        gst_mpdparser_parse_s_node (&new_seg_timeline->S, cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_mult_seg_base_type_ext (GstMultSegmentBaseType ** pointer,
+    xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstMultSegmentBaseType *mult_seg_base_type;
+
+  gst_mpdparser_free_mult_seg_base_type_ext (*pointer);
+  *pointer = mult_seg_base_type = g_slice_new0 (GstMultSegmentBaseType);
+  if (mult_seg_base_type == NULL) {
+    GST_WARNING ("Allocation of MultipleSegmentBaseType node failed!");
+    return;
+  }
+
+  GST_LOG ("attributes of MultipleSegmentBaseType extension:");
+  mult_seg_base_type->duration =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "duration", 0);
+  mult_seg_base_type->startNumber =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "startNumber", 1);
+
+  GST_LOG ("extension of MultipleSegmentBaseType extension:");
+  gst_mpdparser_parse_seg_base_type_ext (&mult_seg_base_type->SegBaseType,
+      a_node);
+
+  /* explore children nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentTimeline") == 0) {
+        gst_mpdparser_parse_segment_timeline_node (&mult_seg_base_type->
+            SegmentTimeline, cur_node);
+      } else if (xmlStrcmp (cur_node->name,
+              (xmlChar *) "BitstreamSwitching") == 0) {
+        gst_mpdparser_parse_url_type_node (&mult_seg_base_type->
+            BitstreamSwitching, cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_segment_list_node (GstSegmentListNode ** pointer,
+    xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstSegmentListNode *new_segment_list;
+
+  gst_mpdparser_free_segment_list_node (*pointer);
+  *pointer = new_segment_list = g_slice_new0 (GstSegmentListNode);
+  if (new_segment_list == NULL) {
+    GST_WARNING ("Allocation of SegmentList node failed!");
+    return;
+  }
+
+  GST_LOG ("extension of SegmentList node:");
+  gst_mpdparser_parse_mult_seg_base_type_ext (&new_segment_list->
+      MultSegBaseType, a_node);
+
+  /* explore children nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentURL") == 0) {
+        gst_mpdparser_parse_segment_url_node (&new_segment_list->SegmentURL,
+            cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_representation_base_type (GstRepresentationBaseType **
+    pointer, xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstRepresentationBaseType *representation_base;
+
+  gst_mpdparser_free_representation_base_type (*pointer);
+  *pointer = representation_base = g_slice_new0 (GstRepresentationBaseType);
+  if (representation_base == NULL) {
+    GST_WARNING ("Allocation of RepresentationBaseType node failed!");
+    return;
+  }
+
+  GST_LOG ("attributes of RepresentationBaseType extension:");
+  representation_base->profiles =
+      gst_mpdparser_get_xml_prop_string (a_node, "profiles");
+  representation_base->width =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "width", 0);
+  representation_base->height =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "height", 0);
+  representation_base->sar = gst_mpdparser_get_xml_prop_ratio (a_node, "sar");
+  representation_base->frameRate =
+      gst_mpdparser_get_xml_prop_framerate (a_node, "frameRate");
+  representation_base->audioSamplingRate =
+      gst_mpdparser_get_xml_prop_string (a_node, "audioSamplingRate");
+  representation_base->mimeType =
+      gst_mpdparser_get_xml_prop_string (a_node, "mimeType");
+  representation_base->segmentProfiles =
+      gst_mpdparser_get_xml_prop_string (a_node, "segmentProfiles");
+  representation_base->codecs =
+      gst_mpdparser_get_xml_prop_string (a_node, "codecs");
+  representation_base->maximumSAPPeriod =
+      gst_mpdparser_get_xml_prop_double (a_node, "maximumSAPPeriod");
+  representation_base->startWithSAP =
+      gst_mpdparser_get_xml_prop_SAP_type (a_node, "startWithSAP");
+  representation_base->maxPlayoutRate =
+      gst_mpdparser_get_xml_prop_double (a_node, "maxPlayoutRate");
+  representation_base->codingDependency =
+      gst_mpdparser_get_xml_prop_boolean (a_node, "codingDependency");
+  representation_base->scanType =
+      gst_mpdparser_get_xml_prop_string (a_node, "scanType");
+
+  /* explore children nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "FramePacking") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&representation_base->
+            FramePacking, cur_node);
+      } else if (xmlStrcmp (cur_node->name,
+              (xmlChar *) "AudioChannelConfiguration") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&representation_base->
+            AudioChannelConfiguration, cur_node);
+      } else if (xmlStrcmp (cur_node->name,
+              (xmlChar *) "ContentProtection") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&representation_base->
+            ContentProtection, cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_representation_node (GList ** list, xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstRepresentationNode *new_representation;
+
+  new_representation = g_slice_new0 (GstRepresentationNode);
+  if (new_representation == NULL) {
+    GST_WARNING ("Allocation of Representation node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_representation);
+
+  GST_LOG ("attributes of Representation node:");
+  new_representation->id = gst_mpdparser_get_xml_prop_string (a_node, "id");
+  new_representation->bandwidth =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "bandwidth", 0);
+  new_representation->qualityRanking =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "qualityRanking", 0);
+  new_representation->dependencyId =
+      gst_mpdparser_get_xml_prop_string_vector_type (a_node, "dependencyId");
+  new_representation->mediaStreamStructureId =
+      gst_mpdparser_get_xml_prop_string_vector_type (a_node,
+      "mediaStreamStructureId");
+
+  /* RepresentationBase extension */
+  gst_mpdparser_parse_representation_base_type (&new_representation->
+      RepresentationBase, a_node);
+
+  /* explore children nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentBase") == 0) {
+        gst_mpdparser_parse_seg_base_type_ext (&new_representation->SegmentBase,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentTemplate") == 0) {
+        gst_mpdparser_parse_segment_template_node (&new_representation->
+            SegmentTemplate, cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentList") == 0) {
+        gst_mpdparser_parse_segment_list_node (&new_representation->SegmentList,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "BaseURL") == 0) {
+        gst_mpdparser_parse_baseURL_node (&new_representation->BaseURLs,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name,
+              (xmlChar *) "SubRepresentation") == 0) {
+        gst_mpdparser_parse_subrepresentation_node (&new_representation->
+            SubRepresentations, cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_adaptation_set_node (GList ** list, xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstAdaptationSetNode *new_adap_set;
+
+  new_adap_set = g_slice_new0 (GstAdaptationSetNode);
+  if (new_adap_set == NULL) {
+    GST_WARNING ("Allocation of AdaptationSet node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_adap_set);
+
+  GST_LOG ("attributes of AdaptationSet node:");
+  new_adap_set->id =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "id", 0);
+  new_adap_set->group =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "group", 0);
+  new_adap_set->lang = gst_mpdparser_get_xml_prop_string (a_node, "lang");
+  new_adap_set->contentType =
+      gst_mpdparser_get_xml_prop_string (a_node, "contentType");
+  new_adap_set->par = gst_mpdparser_get_xml_prop_ratio (a_node, "par");
+  new_adap_set->minBandwidth =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "minBandwidth", 0);
+  new_adap_set->maxBandwidth =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "maxBandwidth", 0);
+  new_adap_set->minWidth =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "minWidth", 0);
+  new_adap_set->maxWidth =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "maxWidth", 0);
+  new_adap_set->minHeight =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "minHeight", 0);
+  new_adap_set->maxHeight =
+      gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "maxHeight", 0);
+  new_adap_set->minFrameRate =
+      gst_mpdparser_get_xml_prop_framerate (a_node, "minFrameRate");
+  new_adap_set->maxFrameRate =
+      gst_mpdparser_get_xml_prop_framerate (a_node, "maxFrameRate");
+  new_adap_set->segmentAlignment =
+      gst_mpdparser_get_xml_prop_cond_uint (a_node, "segmentAlignment");
+  new_adap_set->subsegmentAlignment =
+      gst_mpdparser_get_xml_prop_cond_uint (a_node, "subsegmentAlignment");
+  new_adap_set->subsegmentStartsWithSAP =
+      gst_mpdparser_get_xml_prop_SAP_type (a_node, "subsegmentStartsWithSAP");
+  new_adap_set->bitstreamSwitching =
+      gst_mpdparser_get_xml_prop_boolean (a_node, "bitstreamSwitching");
+
+  /* RepresentationBase extension */
+  gst_mpdparser_parse_representation_base_type (&new_adap_set->
+      RepresentationBase, a_node);
+
+  /* explore children nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "Accessibility") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&new_adap_set->Accessibility,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Role") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&new_adap_set->Role,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Rating") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&new_adap_set->Rating,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Viewpoint") == 0) {
+        gst_mpdparser_parse_descriptor_type_node (&new_adap_set->Viewpoint,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Representation") == 0) {
+        gst_mpdparser_parse_representation_node (&new_adap_set->Representations,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "BaseURL") == 0) {
+        gst_mpdparser_parse_baseURL_node (&new_adap_set->BaseURLs, cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentBase") == 0) {
+        gst_mpdparser_parse_seg_base_type_ext (&new_adap_set->SegmentBase,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentList") == 0) {
+        gst_mpdparser_parse_segment_list_node (&new_adap_set->SegmentList,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name,
+              (xmlChar *) "ContentComponent") == 0) {
+        gst_mpdparser_parse_content_component_node (&new_adap_set->
+            ContentComponents, cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentTemplate") == 0) {
+        gst_mpdparser_parse_segment_template_node (&new_adap_set->
+            SegmentTemplate, cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_subset_node (GList ** list, xmlNode * a_node)
+{
+  GstSubsetNode *new_subset;
+
+  new_subset = g_slice_new0 (GstSubsetNode);
+  if (new_subset == NULL) {
+    GST_WARNING ("Allocation of Subset node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_subset);
+
+  GST_LOG ("attributes of Subset node:");
+  new_subset->contains =
+      gst_mpdparser_get_xml_prop_uint_vector_type (a_node, "contains",
+      &new_subset->size);
+}
+
+static void
+gst_mpdparser_parse_segment_template_node (GstSegmentTemplateNode ** pointer,
+    xmlNode * a_node)
+{
+  GstSegmentTemplateNode *new_segment_template;
+
+  gst_mpdparser_free_segment_template_node (*pointer);
+  *pointer = new_segment_template = g_slice_new0 (GstSegmentTemplateNode);
+  if (new_segment_template == NULL) {
+    GST_WARNING ("Allocation of SegmentTemplate node failed!");
+    return;
+  }
+
+  GST_LOG ("extension of SegmentTemplate node:");
+  gst_mpdparser_parse_mult_seg_base_type_ext (&new_segment_template->
+      MultSegBaseType, a_node);
+
+  GST_LOG ("attributes of SegmentTemplate node:");
+  new_segment_template->media =
+      gst_mpdparser_get_xml_prop_string (a_node, "media");
+  new_segment_template->index =
+      gst_mpdparser_get_xml_prop_string (a_node, "index");
+  new_segment_template->initialization =
+      gst_mpdparser_get_xml_prop_string (a_node, "initialization");
+  new_segment_template->bitstreamSwitching =
+      gst_mpdparser_get_xml_prop_string (a_node, "bitstreamSwitching");
+}
+
+static void
+gst_mpdparser_parse_period_node (GList ** list, xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstPeriodNode *new_period;
+
+  new_period = g_slice_new0 (GstPeriodNode);
+  if (new_period == NULL) {
+    GST_WARNING ("Allocation of Period node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_period);
+
+  GST_LOG ("attributes of Period node:");
+  new_period->id = gst_mpdparser_get_xml_prop_string (a_node, "id");
+  new_period->start = gst_mpdparser_get_xml_prop_duration (a_node, "start");
+  new_period->duration =
+      gst_mpdparser_get_xml_prop_duration (a_node, "duration");
+  new_period->bitstreamSwitching =
+      gst_mpdparser_get_xml_prop_boolean (a_node, "bitstreamSwitching");
+
+  /* explore children nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "AdaptationSet") == 0) {
+        gst_mpdparser_parse_adaptation_set_node (&new_period->AdaptationSets,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentBase") == 0) {
+        gst_mpdparser_parse_seg_base_type_ext (&new_period->SegmentBase,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentList") == 0) {
+        gst_mpdparser_parse_segment_list_node (&new_period->SegmentList,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "SegmentTemplate") == 0) {
+        gst_mpdparser_parse_segment_template_node (&new_period->SegmentTemplate,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Subset") == 0) {
+        gst_mpdparser_parse_subset_node (&new_period->Subsets, cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "BaseURL") == 0) {
+        gst_mpdparser_parse_baseURL_node (&new_period->BaseURLs, cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_program_info_node (GList ** list, xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstProgramInformationNode *new_prog_info;
+
+  new_prog_info = g_slice_new0 (GstProgramInformationNode);
+  if (new_prog_info == NULL) {
+    GST_WARNING ("Allocation of ProgramInfo node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_prog_info);
+
+  GST_LOG ("attributes of ProgramInformation node:");
+  new_prog_info->lang = gst_mpdparser_get_xml_prop_string (a_node, "lang");
+  new_prog_info->moreInformationURL =
+      gst_mpdparser_get_xml_prop_string (a_node, "moreInformationURL");
+
+  /* explore children nodes */
+  GST_LOG ("children of ProgramInformation node:");
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "Title") == 0) {
+        new_prog_info->Title = gst_mpdparser_get_xml_node_content (cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Source") == 0) {
+        new_prog_info->Source = gst_mpdparser_get_xml_node_content (cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Copyright") == 0) {
+        new_prog_info->Copyright =
+            gst_mpdparser_get_xml_node_content (cur_node);
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_metrics_range_node (GList ** list, xmlNode * a_node)
+{
+  GstMetricsRangeNode *new_metrics_range;
+
+  new_metrics_range = g_slice_new0 (GstMetricsRangeNode);
+  if (new_metrics_range == NULL) {
+    GST_WARNING ("Allocation of Metrics Range node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_metrics_range);
+
+  GST_LOG ("attributes of Metrics Range node:");
+  new_metrics_range->starttime =
+      gst_mpdparser_get_xml_prop_duration (a_node, "starttime");
+  new_metrics_range->duration =
+      gst_mpdparser_get_xml_prop_duration (a_node, "duration");
+}
+
+static void
+gst_mpdparser_parse_metrics_node (GList ** list, xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstMetricsNode *new_metrics;
+
+  new_metrics = g_slice_new0 (GstMetricsNode);
+  if (new_metrics == NULL) {
+    GST_WARNING ("Allocation of Metrics node failed!");
+    return;
+  }
+  *list = g_list_append (*list, new_metrics);
+
+  GST_LOG ("attributes of Metrics node:");
+  new_metrics->metrics = gst_mpdparser_get_xml_prop_string (a_node, "metrics");
+
+  /* explore children nodes */
+  GST_LOG ("children of Metrics node:");
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "Range") == 0) {
+        gst_mpdparser_parse_metrics_range_node (&new_metrics->MetricsRanges,
+            cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Reporting") == 0) {
+        /* No reporting scheme is specified in this part of ISO/IEC 23009.
+         * It is expected that external specifications may define formats
+         * and delivery for the reporting data. */
+        GST_LOG (" - Reporting node found (unknown structure)");
+      }
+    }
+  }
+}
+
+static void
+gst_mpdparser_parse_root_node (GstMPDNode ** pointer, xmlNode * a_node)
+{
+  xmlNode *cur_node;
+  GstMPDNode *new_mpd;
+
+  gst_mpdparser_free_mpd_node (*pointer);
+  *pointer = new_mpd = g_slice_new0 (GstMPDNode);
+  if (new_mpd == NULL) {
+    GST_WARNING ("Allocation of MPD node failed!");
+    return;
+  }
+
+  GST_LOG ("namespaces of root MPD node:");
+  new_mpd->default_namespace =
+      gst_mpdparser_get_xml_node_namespace (a_node, NULL);
+  new_mpd->namespace_xsi = gst_mpdparser_get_xml_node_namespace (a_node, "xsi");
+  new_mpd->namespace_ext = gst_mpdparser_get_xml_node_namespace (a_node, "ext");
+
+  GST_LOG ("attributes of root MPD node:");
+  new_mpd->schemaLocation =
+      gst_mpdparser_get_xml_prop_string (a_node, "schemaLocation");
+  new_mpd->id = gst_mpdparser_get_xml_prop_string (a_node, "id");
+  new_mpd->profiles = gst_mpdparser_get_xml_prop_string (a_node, "profiles");
+  new_mpd->type = gst_mpdparser_get_xml_prop_type (a_node, "type");
+  new_mpd->availabilityStartTime =
+      gst_mpdparser_get_xml_prop_dateTime (a_node, "availabilityStartTime");
+  new_mpd->availabilityEndTime =
+      gst_mpdparser_get_xml_prop_dateTime (a_node, "availabilityEndTime");
+  new_mpd->mediaPresentationDuration =
+      gst_mpdparser_get_xml_prop_duration (a_node, "mediaPresentationDuration");
+  new_mpd->minimumUpdatePeriod =
+      gst_mpdparser_get_xml_prop_duration (a_node, "minimumUpdatePeriod");
+  new_mpd->minBufferTime =
+      gst_mpdparser_get_xml_prop_duration (a_node, "minBufferTime");
+  new_mpd->timeShiftBufferDepth =
+      gst_mpdparser_get_xml_prop_duration (a_node, "timeShiftBufferDepth");
+  new_mpd->suggestedPresentationDelay =
+      gst_mpdparser_get_xml_prop_duration (a_node,
+      "suggestedPresentationDelay");
+  new_mpd->maxSegmentDuration =
+      gst_mpdparser_get_xml_prop_duration (a_node, "maxSegmentDuration");
+  new_mpd->maxSubsegmentDuration =
+      gst_mpdparser_get_xml_prop_duration (a_node, "maxSubsegmentDuration");
+
+  /* explore children Period nodes */
+  for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
+    if (cur_node->type == XML_ELEMENT_NODE) {
+      if (xmlStrcmp (cur_node->name, (xmlChar *) "Period") == 0) {
+        gst_mpdparser_parse_period_node (&new_mpd->Periods, cur_node);
+      } else if (xmlStrcmp (cur_node->name,
+              (xmlChar *) "ProgramInformation") == 0) {
+        gst_mpdparser_parse_program_info_node (&new_mpd->ProgramInfo, cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "BaseURL") == 0) {
+        gst_mpdparser_parse_baseURL_node (&new_mpd->BaseURLs, cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Location") == 0) {
+        gst_mpdparser_parse_location_node (&new_mpd->Locations, cur_node);
+      } else if (xmlStrcmp (cur_node->name, (xmlChar *) "Metrics") == 0) {
+        gst_mpdparser_parse_metrics_node (&new_mpd->Metrics, cur_node);
+      }
+    }
+  }
+}
+
+/* comparison functions */
+static int
+strncmp_ext (const char *s1, const char *s2)
+{
+  if (s1 == NULL && s2 == NULL)
+    return 0;
+  if (s1 == NULL && s2 != NULL)
+    return 1;
+  if (s2 == NULL && s1 != NULL)
+    return 1;
+  return strncmp (s1, s2, strlen (s2));
+}
+
+/* navigation functions */
+static GstAdaptationSetNode *
+gst_mpdparser_get_first_adapt_set_with_mimeType (GList * AdaptationSets,
+    const gchar * mimeType)
+{
+  GList *list;
+  GstAdaptationSetNode *adapt_set;
+
+  if (AdaptationSets == NULL)
+    return NULL;
+
+  for (list = g_list_first (AdaptationSets); list; list = g_list_next (list)) {
+    adapt_set = (GstAdaptationSetNode *) list->data;
+    if (adapt_set) {
+      gchar *this_mimeType = NULL;
+      GstRepresentationNode *rep;
+      rep =
+          gst_mpdparser_get_lowest_representation (adapt_set->Representations);
+      if (rep->RepresentationBase)
+        this_mimeType = rep->RepresentationBase->mimeType;
+      if (!this_mimeType && adapt_set->RepresentationBase) {
+        this_mimeType = adapt_set->RepresentationBase->mimeType;
+      }
+      if (strncmp_ext (this_mimeType, mimeType) == 0)
+        return adapt_set;
+    }
+  }
+
+  return NULL;
+}
+
+/* if idx < 0, returns the highest adaptation set with the given mimeType
+ * if idx >= 0, returns the highest adaptation set with the given mimeType and an index <= idx
+ */
+static GstAdaptationSetNode *
+gst_mpdparser_get_adapt_set_with_mimeType_and_idx (GList * AdaptationSets,
+    const gchar * mimeType, gint idx)
+{
+  GList *list;
+  GstAdaptationSetNode *adapt_set, *selected = NULL;
+  gint i = 0;
+
+  if (AdaptationSets == NULL)
+    return NULL;
+
+  for (list = g_list_first (AdaptationSets); list; list = g_list_next (list)) {
+    adapt_set = (GstAdaptationSetNode *) list->data;
+    if (adapt_set) {
+      gchar *this_mimeType = NULL;
+      GstRepresentationNode *rep;
+      rep =
+          gst_mpdparser_get_lowest_representation (adapt_set->Representations);
+      if (rep->RepresentationBase)
+        this_mimeType = rep->RepresentationBase->mimeType;
+      if (!this_mimeType && adapt_set->RepresentationBase) {
+        this_mimeType = adapt_set->RepresentationBase->mimeType;
+      }
+      if (strncmp_ext (this_mimeType, mimeType) == 0) {
+        if (idx < 0 || i <= idx)
+          selected = adapt_set;
+        i++;
+      }
+    }
+  }
+
+  return selected;
+}
+
+static GstAdaptationSetNode *
+gst_mpdparser_get_first_adapt_set_with_mimeType_and_lang (GList *
+    AdaptationSets, const gchar * mimeType, const gchar * lang)
+{
+  GList *list;
+  GstAdaptationSetNode *adapt_set;
+
+  if (AdaptationSets == NULL)
+    return NULL;
+
+  for (list = g_list_first (AdaptationSets); list; list = g_list_next (list)) {
+    adapt_set = (GstAdaptationSetNode *) list->data;
+    if (adapt_set) {
+      GstRepresentationNode *rep;
+      gchar *this_lang = adapt_set->lang;
+      gchar *this_mimeType = NULL;
+      rep =
+          gst_mpdparser_get_lowest_representation (adapt_set->Representations);
+      if (rep->RepresentationBase)
+        this_mimeType = rep->RepresentationBase->mimeType;
+      if (!this_mimeType && adapt_set->RepresentationBase) {
+        this_mimeType = adapt_set->RepresentationBase->mimeType;
+      }
+      if (strncmp_ext (this_mimeType, mimeType) == 0
+          && strncmp_ext (this_lang, lang) == 0)
+        return adapt_set;
+    }
+  }
+
+  return NULL;
+}
+
+static GstRepresentationNode *
+gst_mpdparser_get_lowest_representation (GList * Representations)
+{
+  GList *list = NULL;
+
+  if (Representations == NULL)
+    return NULL;
+
+  list = g_list_first (Representations);
+
+  return list ? (GstRepresentationNode *) list->data : NULL;
+}
+
+#if 0
+static GstRepresentationNode *
+gst_mpdparser_get_highest_representation (GList * Representations)
+{
+  GList *list = NULL;
+
+  if (Representations == NULL)
+    return NULL;
+
+  list = g_list_last (Representations);
+
+  return list ? (GstRepresentationNode *) list->data : NULL;
+}
+
+static GstRepresentationNode *
+gst_mpdparser_get_representation_with_max_bandwidth (GList * Representations,
+    gint max_bandwidth)
+{
+  GList *list = NULL;
+  GstRepresentationNode *representation, *best_rep = NULL;
+
+  if (Representations == NULL)
+    return NULL;
+
+  if (max_bandwidth <= 0)       /* 0 => get highest representation available */
+    return gst_mpdparser_get_highest_representation (Representations);
+
+  for (list = g_list_first (Representations); list; list = g_list_next (list)) {
+    representation = (GstRepresentationNode *) list->data;
+    if (representation && representation->bandwidth <= max_bandwidth) {
+      best_rep = representation;
+    }
+  }
+
+  return best_rep;
+}
+#endif
+
+static GstSegmentBaseType *
+gst_mpdparser_get_segment_base (GstPeriodNode * Period,
+    GstAdaptationSetNode * AdaptationSet,
+    GstRepresentationNode * Representation)
+{
+  GstSegmentBaseType *SegmentBase = NULL;
+
+  if (Representation && Representation->SegmentBase
+      && Representation->SegmentBase->Initialization) {
+    SegmentBase = Representation->SegmentBase;
+  } else if (AdaptationSet && AdaptationSet->SegmentBase
+      && AdaptationSet->SegmentBase->Initialization) {
+    SegmentBase = AdaptationSet->SegmentBase;
+  } else if (Period && Period->SegmentBase
+      && Period->SegmentBase->Initialization) {
+    SegmentBase = Period->SegmentBase;
+  }
+  /* the SegmentBase element could be encoded also inside a SegmentList element */
+  if (SegmentBase == NULL) {
+    if (Representation && Representation->SegmentList
+        && Representation->SegmentList->MultSegBaseType
+        && Representation->SegmentList->MultSegBaseType->SegBaseType
+        && Representation->SegmentList->MultSegBaseType->SegBaseType->
+        Initialization) {
+      SegmentBase = Representation->SegmentList->MultSegBaseType->SegBaseType;
+    } else if (AdaptationSet && AdaptationSet->SegmentList
+        && AdaptationSet->SegmentList->MultSegBaseType
+        && AdaptationSet->SegmentList->MultSegBaseType->SegBaseType
+        && AdaptationSet->SegmentList->MultSegBaseType->SegBaseType->
+        Initialization) {
+      SegmentBase = AdaptationSet->SegmentList->MultSegBaseType->SegBaseType;
+    } else if (Period && Period->SegmentList
+        && Period->SegmentList->MultSegBaseType
+        && Period->SegmentList->MultSegBaseType->SegBaseType
+        && Period->SegmentList->MultSegBaseType->SegBaseType->Initialization) {
+      SegmentBase = Period->SegmentList->MultSegBaseType->SegBaseType;
+    }
+  }
+
+  return SegmentBase;
+}
+
+gint
+gst_mpdparser_get_rep_idx_with_max_bandwidth (GList * Representations,
+    gint max_bandwidth)
+{
+  GList *list = NULL, *best = NULL;
+  GstRepresentationNode *representation;
+
+  if (Representations == NULL)
+    return -1;
+
+  if (max_bandwidth <= 0)       /* 0 => get lowest representation available */
+    return 0;
+
+  for (list = g_list_first (Representations); list; list = g_list_next (list)) {
+    representation = (GstRepresentationNode *) list->data;
+    if (representation && representation->bandwidth <= max_bandwidth) {
+      best = list;
+    }
+  }
+
+  return best ? g_list_position (Representations, best) : -1;
+}
+
+static GstSegmentListNode *
+gst_mpdparser_get_segment_list (GstPeriodNode * Period,
+    GstAdaptationSetNode * AdaptationSet,
+    GstRepresentationNode * Representation)
+{
+  GstSegmentListNode *SegmentList = NULL;
+
+  if (Representation && Representation->SegmentList) {
+    SegmentList = Representation->SegmentList;
+  } else if (AdaptationSet && AdaptationSet->SegmentList) {
+    SegmentList = AdaptationSet->SegmentList;
+  } else {
+    SegmentList = Period->SegmentList;
+  }
+
+  return SegmentList;
+}
+
+/* memory management functions */
+static void
+gst_mpdparser_free_mpd_node (GstMPDNode * mpd_node)
+{
+  if (mpd_node) {
+    g_free (mpd_node->default_namespace);
+    g_free (mpd_node->namespace_xsi);
+    g_free (mpd_node->namespace_ext);
+    g_free (mpd_node->schemaLocation);
+    g_free (mpd_node->id);
+    g_free (mpd_node->profiles);
+    if (mpd_node->availabilityStartTime)
+      gst_date_time_unref (mpd_node->availabilityStartTime);
+    if (mpd_node->availabilityEndTime)
+      gst_date_time_unref (mpd_node->availabilityEndTime);
+    g_list_foreach (mpd_node->ProgramInfo,
+        (GFunc) gst_mpdparser_free_prog_info_node, NULL);
+    g_list_free (mpd_node->ProgramInfo);
+    g_list_foreach (mpd_node->BaseURLs,
+        (GFunc) gst_mpdparser_free_base_url_node, NULL);
+    g_list_free (mpd_node->BaseURLs);
+    g_list_foreach (mpd_node->Locations, (GFunc) g_free, NULL);
+    g_list_free (mpd_node->Locations);
+    g_list_foreach (mpd_node->Periods, (GFunc) gst_mpdparser_free_period_node,
+        NULL);
+    g_list_free (mpd_node->Periods);
+    g_list_foreach (mpd_node->Metrics, (GFunc) gst_mpdparser_free_metrics_node,
+        NULL);
+    g_list_free (mpd_node->Metrics);
+    g_slice_free (GstMPDNode, mpd_node);
+  }
+}
+
+static void
+gst_mpdparser_free_prog_info_node (GstProgramInformationNode * prog_info_node)
+{
+  if (prog_info_node) {
+    g_free (prog_info_node->lang);
+    g_free (prog_info_node->moreInformationURL);
+    g_free (prog_info_node->Title);
+    g_free (prog_info_node->Source);
+    g_free (prog_info_node->Copyright);
+    g_slice_free (GstProgramInformationNode, prog_info_node);
+  }
+}
+
+static void
+gst_mpdparser_free_metrics_node (GstMetricsNode * metrics_node)
+{
+  if (metrics_node) {
+    g_free (metrics_node->metrics);
+    g_list_foreach (metrics_node->MetricsRanges,
+        (GFunc) gst_mpdparser_free_metrics_range_node, NULL);
+    g_list_free (metrics_node->MetricsRanges);
+  }
+}
+
+static void
+gst_mpdparser_free_metrics_range_node (GstMetricsRangeNode * metrics_range_node)
+{
+  if (metrics_range_node) {
+    g_slice_free (GstMetricsRangeNode, metrics_range_node);
+  }
+}
+
+static void
+gst_mpdparser_free_period_node (GstPeriodNode * period_node)
+{
+  if (period_node) {
+    g_free (period_node->id);
+    gst_mpdparser_free_seg_base_type_ext (period_node->SegmentBase);
+    gst_mpdparser_free_segment_list_node (period_node->SegmentList);
+    gst_mpdparser_free_segment_template_node (period_node->SegmentTemplate);
+    g_list_foreach (period_node->AdaptationSets,
+        (GFunc) gst_mpdparser_free_adaptation_set_node, NULL);
+    g_list_free (period_node->AdaptationSets);
+    g_list_foreach (period_node->Subsets,
+        (GFunc) gst_mpdparser_free_subset_node, NULL);
+    g_list_free (period_node->Subsets);
+    g_list_foreach (period_node->BaseURLs,
+        (GFunc) gst_mpdparser_free_base_url_node, NULL);
+    g_list_free (period_node->BaseURLs);
+    g_slice_free (GstPeriodNode, period_node);
+  }
+}
+
+static void
+gst_mpdparser_free_subset_node (GstSubsetNode * subset_node)
+{
+  if (subset_node) {
+    g_free (subset_node->contains);
+    g_slice_free (GstSubsetNode, subset_node);
+  }
+}
+
+static void
+gst_mpdparser_free_segment_template_node (GstSegmentTemplateNode *
+    segment_template_node)
+{
+  if (segment_template_node) {
+    g_free (segment_template_node->media);
+    g_free (segment_template_node->index);
+    g_free (segment_template_node->initialization);
+    g_free (segment_template_node->bitstreamSwitching);
+    /* MultipleSegmentBaseType extension */
+    gst_mpdparser_free_mult_seg_base_type_ext
+        (segment_template_node->MultSegBaseType);
+    g_slice_free (GstSegmentTemplateNode, segment_template_node);
+  }
+}
+
+static void
+gst_mpdparser_free_representation_base_type (GstRepresentationBaseType *
+    representation_base)
+{
+  if (representation_base) {
+    g_free (representation_base->profiles);
+    g_slice_free (GstRatio, representation_base->sar);
+    g_slice_free (GstFrameRate, representation_base->frameRate);
+    g_free (representation_base->audioSamplingRate);
+    g_free (representation_base->mimeType);
+    g_free (representation_base->segmentProfiles);
+    g_free (representation_base->codecs);
+    g_free (representation_base->scanType);
+    g_list_foreach (representation_base->FramePacking,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (representation_base->FramePacking);
+    g_list_foreach (representation_base->AudioChannelConfiguration,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (representation_base->AudioChannelConfiguration);
+    g_list_foreach (representation_base->ContentProtection,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (representation_base->ContentProtection);
+    g_slice_free (GstRepresentationBaseType, representation_base);
+  }
+}
+
+static void
+gst_mpdparser_free_adaptation_set_node (GstAdaptationSetNode *
+    adaptation_set_node)
+{
+  if (adaptation_set_node) {
+    g_free (adaptation_set_node->lang);
+    g_free (adaptation_set_node->contentType);
+    g_slice_free (GstRatio, adaptation_set_node->par);
+    g_slice_free (GstFrameRate, adaptation_set_node->minFrameRate);
+    g_slice_free (GstFrameRate, adaptation_set_node->maxFrameRate);
+    g_slice_free (GstConditionalUintType,
+        adaptation_set_node->segmentAlignment);
+    g_slice_free (GstConditionalUintType,
+        adaptation_set_node->subsegmentAlignment);
+    g_list_foreach (adaptation_set_node->Accessibility,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (adaptation_set_node->Accessibility);
+    g_list_foreach (adaptation_set_node->Role,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (adaptation_set_node->Role);
+    g_list_foreach (adaptation_set_node->Rating,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (adaptation_set_node->Rating);
+    g_list_foreach (adaptation_set_node->Viewpoint,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (adaptation_set_node->Viewpoint);
+    gst_mpdparser_free_representation_base_type
+        (adaptation_set_node->RepresentationBase);
+    gst_mpdparser_free_seg_base_type_ext (adaptation_set_node->SegmentBase);
+    gst_mpdparser_free_segment_list_node (adaptation_set_node->SegmentList);
+    gst_mpdparser_free_segment_template_node (adaptation_set_node->
+        SegmentTemplate);
+    g_list_foreach (adaptation_set_node->BaseURLs,
+        (GFunc) gst_mpdparser_free_base_url_node, NULL);
+    g_list_free (adaptation_set_node->BaseURLs);
+    g_list_foreach (adaptation_set_node->Representations,
+        (GFunc) gst_mpdparser_free_representation_node, NULL);
+    g_list_free (adaptation_set_node->Representations);
+    g_list_foreach (adaptation_set_node->ContentComponents,
+        (GFunc) gst_mpdparser_free_content_component_node, NULL);
+    g_list_free (adaptation_set_node->ContentComponents);
+    g_slice_free (GstAdaptationSetNode, adaptation_set_node);
+  }
+}
+
+static void
+gst_mpdparser_free_representation_node (GstRepresentationNode *
+    representation_node)
+{
+  if (representation_node) {
+    g_free (representation_node->id);
+    g_strfreev (representation_node->dependencyId);
+    g_strfreev (representation_node->mediaStreamStructureId);
+    gst_mpdparser_free_representation_base_type
+        (representation_node->RepresentationBase);
+    g_list_foreach (representation_node->SubRepresentations,
+        (GFunc) gst_mpdparser_free_subrepresentation_node, NULL);
+    g_list_free (representation_node->SubRepresentations);
+    gst_mpdparser_free_seg_base_type_ext (representation_node->SegmentBase);
+    gst_mpdparser_free_segment_template_node (representation_node->
+        SegmentTemplate);
+    gst_mpdparser_free_segment_list_node (representation_node->SegmentList);
+    g_list_foreach (representation_node->BaseURLs,
+        (GFunc) gst_mpdparser_free_base_url_node, NULL);
+    g_list_free (representation_node->BaseURLs);
+    g_slice_free (GstRepresentationNode, representation_node);
+  }
+}
+
+static void
+gst_mpdparser_free_subrepresentation_node (GstSubRepresentationNode *
+    subrep_node)
+{
+  if (subrep_node) {
+    gst_mpdparser_free_representation_base_type (subrep_node->
+        RepresentationBase);
+    g_free (subrep_node->dependencyLevel);
+    g_strfreev (subrep_node->contentComponent);
+  }
+}
+
+static void
+gst_mpdparser_free_s_node (GstSNode * s_node)
+{
+  if (s_node) {
+    g_slice_free (GstSNode, s_node);
+  }
+}
+
+static void
+gst_mpdparser_free_segment_timeline_node (GstSegmentTimelineNode * seg_timeline)
+{
+  if (seg_timeline) {
+    g_list_foreach (seg_timeline->S, (GFunc) gst_mpdparser_free_s_node, NULL);
+    g_list_free (seg_timeline->S);
+    g_slice_free (GstSegmentTimelineNode, seg_timeline);
+  }
+}
+
+static void
+gst_mpdparser_free_url_type_node (GstURLType * url_type_node)
+{
+  if (url_type_node) {
+    g_free (url_type_node->sourceURL);
+    g_slice_free (GstRange, url_type_node->range);
+    g_slice_free (GstURLType, url_type_node);
+  }
+}
+
+static void
+gst_mpdparser_free_seg_base_type_ext (GstSegmentBaseType * seg_base_type)
+{
+  if (seg_base_type) {
+    g_free (seg_base_type->indexRange);
+    gst_mpdparser_free_url_type_node (seg_base_type->Initialization);
+    gst_mpdparser_free_url_type_node (seg_base_type->RepresentationIndex);
+    g_slice_free (GstSegmentBaseType, seg_base_type);
+  }
+}
+
+static void
+gst_mpdparser_free_mult_seg_base_type_ext (GstMultSegmentBaseType *
+    mult_seg_base_type)
+{
+  if (mult_seg_base_type) {
+    /* SegmentBaseType extension */
+    gst_mpdparser_free_seg_base_type_ext (mult_seg_base_type->SegBaseType);
+    gst_mpdparser_free_segment_timeline_node
+        (mult_seg_base_type->SegmentTimeline);
+    gst_mpdparser_free_url_type_node (mult_seg_base_type->BitstreamSwitching);
+    g_slice_free (GstMultSegmentBaseType, mult_seg_base_type);
+  }
+}
+
+static void
+gst_mpdparser_free_segment_list_node (GstSegmentListNode * segment_list_node)
+{
+  if (segment_list_node) {
+    g_list_foreach (segment_list_node->SegmentURL,
+        (GFunc) gst_mpdparser_free_segment_url_node, NULL);
+    g_list_free (segment_list_node->SegmentURL);
+    /* MultipleSegmentBaseType extension */
+    gst_mpdparser_free_mult_seg_base_type_ext
+        (segment_list_node->MultSegBaseType);
+    g_slice_free (GstSegmentListNode, segment_list_node);
+  }
+}
+
+static void
+gst_mpdparser_free_segment_url_node (GstSegmentURLNode * segment_url)
+{
+  if (segment_url) {
+    g_free (segment_url->media);
+    g_slice_free (GstRange, segment_url->mediaRange);
+    g_free (segment_url->index);
+    g_slice_free (GstRange, segment_url->indexRange);
+    g_slice_free (GstSegmentURLNode, segment_url);
+  }
+}
+
+static void
+gst_mpdparser_free_base_url_node (GstBaseURL * base_url_node)
+{
+  if (base_url_node) {
+    g_free (base_url_node->baseURL);
+    g_free (base_url_node->serviceLocation);
+    g_free (base_url_node->byteRange);
+    g_slice_free (GstBaseURL, base_url_node);
+  }
+}
+
+static void
+gst_mpdparser_free_descriptor_type_node (GstDescriptorType * descriptor_type)
+{
+  if (descriptor_type) {
+    g_free (descriptor_type->schemeIdUri);
+    g_free (descriptor_type->value);
+  }
+}
+
+static void
+gst_mpdparser_free_content_component_node (GstContentComponentNode *
+    content_component_node)
+{
+  if (content_component_node) {
+    g_free (content_component_node->lang);
+    g_free (content_component_node->contentType);
+    g_slice_free (GstRatio, content_component_node->par);
+    g_list_foreach (content_component_node->Accessibility,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (content_component_node->Accessibility);
+    g_list_foreach (content_component_node->Role,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (content_component_node->Role);
+    g_list_foreach (content_component_node->Rating,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (content_component_node->Rating);
+    g_list_foreach (content_component_node->Viewpoint,
+        (GFunc) gst_mpdparser_free_descriptor_type_node, NULL);
+    g_list_free (content_component_node->Viewpoint);
+    g_slice_free (GstContentComponentNode, content_component_node);
+  }
+}
+
+static void
+gst_mpdparser_free_stream_period (GstStreamPeriod * stream_period)
+{
+  if (stream_period) {
+    g_slice_free (GstStreamPeriod, stream_period);
+  }
+}
+
+static void
+gst_mpdparser_free_media_segment (GstMediaSegment * media_segment)
+{
+  if (media_segment) {
+    g_slice_free (GstMediaSegment, media_segment);
+  }
+}
+
+static void
+gst_mpdparser_free_active_stream (GstActiveStream * active_stream)
+{
+  if (active_stream) {
+    g_list_foreach (active_stream->segments,
+        (GFunc) gst_mpdparser_free_media_segment, NULL);
+    g_list_free (active_stream->segments);
+    g_slice_free (GstActiveStream, active_stream);
+  }
+}
+
+static gchar *
+gst_mpdparser_get_segmentURL_for_range (gchar * url, GstRange * range)
+{
+  gchar *segmentURL;
+
+  if (range) {
+    gchar *range_suffix;
+    range_suffix =
+        g_strdup_printf ("?range=%llu-%llu", range->first_byte_pos,
+        range->last_byte_pos);
+    segmentURL = g_strconcat (url, range_suffix, NULL);
+    g_free (range_suffix);
+  } else {
+    segmentURL = g_strdup (url);
+  }
+
+  return segmentURL;
+}
+
+static gchar *
+gst_mpdparser_get_mediaURL (GstMpdClient * client,
+    GstSegmentURLNode * segmentURL)
+{
+  const gchar *url_prefix;
+
+  g_return_val_if_fail (client != NULL, NULL);
+  g_return_val_if_fail (segmentURL != NULL, NULL);
+
+  url_prefix =
+      segmentURL->media ? segmentURL->
+      media : gst_mpdparser_get_baseURL (client);
+  g_return_val_if_fail (url_prefix != NULL, NULL);
+
+  return gst_mpdparser_get_segmentURL_for_range (url_prefix,
+      segmentURL->mediaRange);//if not present @media attribute, it is mapped to baseURL
+}
+
+static gchar *
+gst_mpdparser_get_initializationURL (GstURLType * InitializationURL)
+{
+  g_return_val_if_fail (InitializationURL != NULL, NULL);
+  g_return_val_if_fail (InitializationURL->sourceURL != NULL, NULL);
+
+  return gst_mpdparser_get_segmentURL_for_range (InitializationURL->sourceURL,
+      InitializationURL->range);
+}
+
+static gchar *
+gst_mpdparser_build_URL_from_template (const gchar * url_template,
+    const gchar * id, guint number, guint bandwidth, guint time)
+{
+  static gchar default_format[] = "%01d";
+  gchar **tokens, *token, *ret, *format;
+  gint i, num_tokens;
+  gboolean last_token_par = TRUE;       /* last token was a parameter */
+
+  g_return_val_if_fail (url_template != NULL, NULL);
+  tokens = g_strsplit_set (url_template, "$", -1);
+  if (!tokens) {
+    GST_WARNING ("Scan of URL template failed!");
+    return NULL;
+  }
+  num_tokens = g_strv_length (tokens);
+
+  for (i = 0; i < num_tokens; i++) {
+    token = tokens[i];
+    format = default_format;
+
+    if (!g_strcmp0 (token, "RepresentationID")) {
+      tokens[i] = g_strdup_printf ("%s", id);
+      g_free (token);
+      last_token_par = TRUE;
+    } else if (!strncmp (token, "Number", 6)) {
+      if (strlen (token) > 6) {
+        format = token + 6;     /* format tag */
+      }
+      tokens[i] = g_strdup_printf (format, number);
+      g_free (token);
+      last_token_par = TRUE;
+    } else if (!strncmp (token, "Bandwidth", 9)) {
+      if (strlen (token) > 9) {
+        format = token + 9;     /* format tag */
+      }
+      tokens[i] = g_strdup_printf (format, bandwidth);
+      g_free (token);
+      last_token_par = TRUE;
+    } else if (!strncmp (token, "Time", 4)) {
+      if (strlen (token) > 4) {
+        format = token + 4;     /* format tag */
+      }
+      tokens[i] = g_strdup_printf (format, time);
+      g_free (token);
+      last_token_par = TRUE;
+    } else if (!g_strcmp0 (token, "")) {
+      if (!last_token_par) {
+        tokens[i] = g_strdup_printf ("%s", "$");
+        g_free (token);
+        last_token_par = TRUE;
+      }
+    } else {
+      last_token_par = FALSE;
+    }
+  }
+
+  ret = g_strjoinv (NULL, tokens);
+  g_strfreev (tokens);
+
+  return ret;
+}
+
+static GstStreamPeriod *
+gst_mpdparser_get_stream_period (GstMpdClient * client)
+{
+  g_return_val_if_fail (client != NULL, NULL);
+  g_return_val_if_fail (client->periods != NULL, NULL);
+
+  return g_list_nth_data (client->periods, client->period_idx);
+}
+
+/* select a stream and extract the baseURL (if present) */
+static gchar *
+gst_mpdparser_parse_baseURL (GstMpdClient * client)
+{
+  GstActiveStream *stream;
+  GstStreamPeriod *stream_period;
+  GstBaseURL *baseURL;
+  GList *list;
+  static gchar *baseURL_array[5];
+  static gchar empty[] = "";
+  gchar *ret = NULL;
+
+  stream =
+      gst_mpdparser_get_active_stream_by_index (client, client->stream_idx);
+  g_return_val_if_fail (stream != NULL, empty);
+  stream_period = gst_mpdparser_get_stream_period (client);
+  g_return_val_if_fail (stream_period != NULL, empty);
+  g_return_val_if_fail (stream_period->period != NULL, empty);
+
+  baseURL_array[0] = baseURL_array[1] = baseURL_array[2] = baseURL_array[3] =
+      empty;
+  baseURL_array[4] = NULL;
+
+  /* FIXME: this simple implementation is not fully compliant with RFC 3986 */
+  if ((list = client->mpd_node->BaseURLs) != NULL) {
+    baseURL = g_list_nth_data (list, stream->baseURL_idx);
+    if (!baseURL) {
+      baseURL = list->data;
+    }
+    baseURL_array[0] = baseURL->baseURL;
+  }
+  if ((list = stream_period->period->BaseURLs) != NULL) {
+    baseURL = g_list_nth_data (list, stream->baseURL_idx);
+    if (!baseURL) {
+      baseURL = list->data;
+    }
+    baseURL_array[1] = baseURL->baseURL;
+  }
+  if ((list = stream->cur_adapt_set->BaseURLs) != NULL) {
+    baseURL = g_list_nth_data (list, stream->baseURL_idx);
+    if (!baseURL) {
+      baseURL = list->data;
+    }
+    baseURL_array[2] = baseURL->baseURL;
+  }
+  if ((list = stream->cur_representation->BaseURLs) != NULL) {
+    baseURL = g_list_nth_data (list, stream->baseURL_idx);
+    if (!baseURL) {
+      baseURL = list->data;
+    }
+    baseURL_array[3] = baseURL->baseURL;
+  }
+
+  ret = g_strjoinv (NULL, baseURL_array);
+  /* get base URI from MPD file URI, if the "http" scheme is missing */
+  if (client->mpd_uri != NULL && strncmp (ret, "http://", 7) != 0) {
+    gchar *last_sep, *tmp1, *tmp2;
+    last_sep = strrchr (client->mpd_uri, '/');
+    if (last_sep) {
+      tmp1 = g_strndup (client->mpd_uri, last_sep - client->mpd_uri + 1);
+      tmp2 = ret;
+      GST_DEBUG ("Got base URI from MPD file URI %s", tmp1);
+      ret = g_strconcat (tmp1, tmp2, NULL);
+      g_free (tmp1);
+      g_free (tmp2);
+    }
+  }
+
+  GST_DEBUG ("selected baseURL with index %d: %s", stream->baseURL_idx, ret);
+
+  return ret;
+}
+
+static GstClockTime
+gst_mpd_client_get_segment_duration (GstMpdClient * client)
+{
+  GstActiveStream *stream;
+  GstStreamPeriod *stream_period;
+  GstMultSegmentBaseType *base = NULL;
+  GstClockTime duration;
+  guint timescale;
+
+  stream =
+      gst_mpdparser_get_active_stream_by_index (client, client->stream_idx);
+  g_return_val_if_fail (stream != NULL, GST_CLOCK_TIME_NONE);
+  stream_period = gst_mpdparser_get_stream_period (client);
+  g_return_val_if_fail (stream_period != NULL, GST_CLOCK_TIME_NONE);
+
+  if (stream->cur_segment_list) {
+    base = stream->cur_segment_list->MultSegBaseType;
+  } else if (stream->cur_seg_template) {
+    base = stream->cur_seg_template->MultSegBaseType;
+  }
+
+  if (base == NULL || base->SegBaseType == NULL) {
+    /* this may happen when we have a single segment */
+    duration = stream_period->duration;
+  } else {
+    duration = base->duration * GST_SECOND;
+    timescale = base->SegBaseType->timescale;
+
+    if (timescale > 1)
+      duration /= timescale;
+  }
+
+  return duration;
+}
+
+/*****************************/
+/******* API functions *******/
+/*****************************/
+
+GstMpdClient *
+gst_mpd_client_new ()
+{
+  GstMpdClient *client;
+
+  client = g_new0 (GstMpdClient, 1);
+  client->lock = g_mutex_new ();
+
+  return client;
+}
+
+void
+gst_active_streams_free (GstMpdClient * client)
+{
+  if (client->active_streams) {
+    g_list_foreach (client->active_streams,
+        (GFunc) gst_mpdparser_free_active_stream, NULL);
+    g_list_free (client->active_streams);
+    client->active_streams = NULL;
+  }
+}
+
+void
+gst_mpd_client_free (GstMpdClient * client)
+{
+  g_return_if_fail (client != NULL);
+
+  if (client->mpd_node)
+    gst_mpdparser_free_mpd_node (client->mpd_node);
+
+  if (client->periods) {
+    g_list_foreach (client->periods,
+        (GFunc) gst_mpdparser_free_stream_period, NULL);
+    g_list_free (client->periods);
+  }
+
+  gst_active_streams_free (client);
+
+  if (client->lock)
+    g_mutex_free (client->lock);
+
+  g_free (client->mpd_uri);
+
+  g_free (client);
+}
+
+gboolean
+gst_mpd_parse (GstMpdClient * client, const gchar * data, gint size)
+{
+  if (data) {
+    xmlDocPtr doc;
+    xmlNode *root_element = NULL;
+
+    GST_DEBUG ("MPD file fully buffered, start parsing...");
+
+    GST_MPD_CLIENT_LOCK (client);
+    /* parse the complete MPD file into a tree (using the libxml2 default parser API) */
+
+    /* this initialize the library and check potential ABI mismatches
+     * between the version it was compiled for and the actual shared
+     * library used
+     */
+    LIBXML_TEST_VERSION
+        /* parse "data" into a document (which is a libxml2 tree structure xmlDoc) */
+        doc = xmlReadMemory (data, size, "noname.xml", NULL, 0);
+    if (doc == NULL) {
+      GST_ERROR ("failed to parse the MPD file");
+      GST_MPD_CLIENT_UNLOCK (client);
+      return FALSE;
+    } else {
+      /* get the root element node */
+      root_element = xmlDocGetRootElement (doc);
+
+      if (root_element->type != XML_ELEMENT_NODE
+          || xmlStrcmp (root_element->name, (xmlChar *) "MPD") != 0) {
+        GST_ERROR
+            ("can not find the root element MPD, failed to parse the MPD file");
+      } else {
+        /* now we can parse the MPD root node and all children nodes, recursively */
+        gst_mpdparser_parse_root_node (&client->mpd_node, root_element);
+      }
+      /* free the document */
+      xmlFreeDoc (doc);
+      /* cleanup function for the XML library */
+      xmlCleanupParser ();
+      /* dump XML library memory for debugging */
+      xmlMemoryDump ();
+    }
+    GST_MPD_CLIENT_UNLOCK (client);
+
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+const gchar *
+gst_mpdparser_get_baseURL (GstMpdClient * client)
+{
+  GstActiveStream *stream;
+
+  g_return_val_if_fail (client != NULL, NULL);
+  g_return_val_if_fail (client->active_streams != NULL, NULL);
+  stream = g_list_nth_data (client->active_streams, client->stream_idx);
+  g_return_val_if_fail (stream != NULL, NULL);
+
+  return stream->baseURL;
+}
+
+GstMediaSegment *
+gst_mpdparser_get_chunk_by_index (GstMpdClient * client, guint indexStream,
+    guint indexChunk)
+{
+  GstActiveStream *stream;
+
+  /* select stream */
+  g_return_val_if_fail (client != NULL, NULL);
+  g_return_val_if_fail (client->active_streams != NULL, NULL);
+  stream = g_list_nth_data (client->active_streams, indexStream);
+  g_return_val_if_fail (stream != NULL, NULL);
+
+  return (GstMediaSegment *) g_list_nth_data (stream->segments, indexChunk);
+}
+
+static gboolean
+gst_mpd_client_add_media_segment (GstActiveStream * stream,
+    GstSegmentURLNode * url_node, guint number, guint start,
+    GstClockTime start_time, GstClockTime duration)
+{
+  GstMediaSegment *media_segment;
+
+  media_segment = g_slice_new0 (GstMediaSegment);
+  if (media_segment == NULL) {
+    GST_WARNING ("Allocation of GstMediaSegment struct failed!");
+    return FALSE;
+  }
+  stream->segments = g_list_append (stream->segments, media_segment);
+  media_segment->SegmentURL = url_node;
+  media_segment->number = number;
+  media_segment->start = start;
+  media_segment->start_time = start_time;
+  media_segment->duration = duration;
+
+  return TRUE;
+}
+
+gboolean
+gst_mpd_client_setup_representation (GstMpdClient * client,
+    GstActiveStream * stream, GstRepresentationNode * representation)
+{
+  GstStreamPeriod *stream_period;
+  GList *rep_list;
+  GstClockTime PeriodStart, PeriodEnd, start_time, duration;
+  GstMediaSegment *last_media_segment;
+  guint i, start;
+
+  if (stream->cur_adapt_set == NULL) {
+    GST_WARNING ("No valid AdaptationSet node in the MPD file, aborting...");
+    return FALSE;
+  }
+
+  rep_list = stream->cur_adapt_set->Representations;
+  stream->cur_representation = representation;
+  stream->representation_idx = g_list_index (rep_list, representation);
+
+  /* clean the old segment list, if any */
+  if (stream->segments) {
+    g_list_foreach (stream->segments,
+        (GFunc) gst_mpdparser_free_media_segment, NULL);
+    g_list_free (stream->segments);
+    stream->segments = NULL;
+  }
+
+  stream_period = gst_mpdparser_get_stream_period (client);
+  g_return_val_if_fail (stream_period != NULL, FALSE);
+  g_return_val_if_fail (stream_period->period != NULL, FALSE);
+
+  PeriodStart = stream_period->start;
+  if (GST_CLOCK_TIME_IS_VALID (stream_period->duration))
+    PeriodEnd = stream_period->start + stream_period->duration;
+  else
+    PeriodEnd = GST_CLOCK_TIME_NONE;
+
+  GST_LOG ("Building segment list for Period from %" GST_TIME_FORMAT " to %"
+      GST_TIME_FORMAT, GST_TIME_ARGS (PeriodStart), GST_TIME_ARGS (PeriodEnd));
+
+  if (representation->SegmentBase != NULL
+      || representation->SegmentList != NULL) {
+    GList *SegmentURL;
+
+    /* get the first segment_base of the selected representation */
+    if ((stream->cur_segment_base =
+            gst_mpdparser_get_segment_base (stream_period->period,
+                stream->cur_adapt_set, representation)) == NULL) {
+      GST_DEBUG ("No useful SegmentBase node for the current Representation");
+    }
+
+    /* get the first segment_list of the selected representation */
+    if ((stream->cur_segment_list =
+            gst_mpdparser_get_segment_list (stream_period->period,
+                stream->cur_adapt_set, representation)) == NULL) {
+      GST_DEBUG ("No useful SegmentList node for the current Representation");
+      /* here we should have a single segment for each representation, whose URL is encoded in the baseURL element */
+      if (!gst_mpd_client_add_media_segment (stream, NULL, 1, 0, PeriodStart,
+              PeriodEnd)) {
+        return FALSE;
+      }
+    } else {
+      /* build the list of GstMediaSegment nodes from the SegmentList node */
+      SegmentURL = stream->cur_segment_list->SegmentURL;
+      if (SegmentURL == NULL) {
+        GST_WARNING
+            ("No valid list of SegmentURL nodes in the MPD file, aborting...");
+        return FALSE;
+      }
+
+      /* build segment list */
+      i = stream->cur_segment_list->MultSegBaseType->startNumber;
+      start = 0;
+      start_time = PeriodStart;
+
+      GST_LOG ("Building media segment list using a SegmentList node");
+      if (stream->cur_segment_list->MultSegBaseType->SegmentTimeline) {
+        GstSegmentTimelineNode *timeline;
+        GstSNode *S;
+        GList *list;
+
+        timeline = stream->cur_segment_list->MultSegBaseType->SegmentTimeline;
+        for (list = g_list_first (timeline->S); list; list = g_list_next (list)) {
+          guint j, timescale;
+
+          S = (GstSNode *) list->data;
+          GST_LOG ("Processing S node: d=%d r=%d t=%d", S->d, S->r, S->t);
+          duration = S->d * GST_SECOND;
+          timescale =
+              stream->cur_segment_list->MultSegBaseType->SegBaseType->timescale;
+          if (timescale > 1)
+            duration /= timescale;
+          if (S->t > 0) {
+            start = S->t;
+            start_time = S->t * GST_SECOND;
+            if (timescale > 1)
+              start_time /= timescale;
+          }
+
+          for (j = 0; j <= S->r && SegmentURL != NULL; j++) {
+            if (!gst_mpd_client_add_media_segment (stream, SegmentURL->data, i,
+                    start, start_time, duration)) {
+              return FALSE;
+            }
+            i++;
+            start += S->d;
+            start_time += duration;
+            SegmentURL = g_list_next (SegmentURL);
+          }
+        }
+      } else {
+        duration = gst_mpd_client_get_segment_duration (client);
+        if (!GST_CLOCK_TIME_IS_VALID (duration))
+          return FALSE;
+
+        while (SegmentURL) {
+          if (!gst_mpd_client_add_media_segment (stream, SegmentURL->data, i, 0,
+                  start_time, duration)) {
+            return FALSE;
+          }
+          i++;
+          start_time += duration;
+          SegmentURL = g_list_next (SegmentURL);
+        }
+      }
+    }
+  } else {
+    if (representation->SegmentTemplate != NULL) {
+      stream->cur_seg_template = representation->SegmentTemplate;
+    } else if (stream->cur_adapt_set->SegmentTemplate != NULL) {
+      stream->cur_seg_template = stream->cur_adapt_set->SegmentTemplate;
+    } else if (stream_period->period->SegmentTemplate != NULL) {
+      stream->cur_seg_template = stream_period->period->SegmentTemplate;
+    }
+
+    if (stream->cur_seg_template == NULL
+        || stream->cur_seg_template->MultSegBaseType == NULL) {
+      /* here we should have a single segment for each representation, whose URL is encoded in the baseURL element */
+      if (!gst_mpd_client_add_media_segment (stream, NULL, 1, 0, 0, PeriodEnd)) {
+        return FALSE;
+      }
+    } else {
+      /* build segment list */
+      i = stream->cur_seg_template->MultSegBaseType->startNumber;
+      start = 0;
+      start_time = PeriodStart;
+
+      GST_LOG ("Building media segment list using this template: %s",
+          stream->cur_seg_template->media);
+      if (stream->cur_seg_template->MultSegBaseType->SegmentTimeline) {
+        GstSegmentTimelineNode *timeline;
+        GstSNode *S;
+        GList *list;
+
+        timeline = stream->cur_seg_template->MultSegBaseType->SegmentTimeline;
+        for (list = g_list_first (timeline->S); list; list = g_list_next (list)) {
+          guint j, timescale;
+
+          S = (GstSNode *) list->data;
+          GST_LOG ("Processing S node: d=%d r=%d t=%d", S->d, S->r, S->t);
+          duration = S->d * GST_SECOND;
+          timescale =
+              stream->cur_seg_template->MultSegBaseType->SegBaseType->timescale;
+          if (timescale > 1)
+            duration /= timescale;
+          if (S->t > 0) {
+            start = S->t;
+            start_time = S->t * GST_SECOND;
+            if (timescale > 1)
+              start_time /= timescale;
+          }
+
+          for (j = 0; j <= S->r; j++) {
+            if (!gst_mpd_client_add_media_segment (stream, NULL, i, start,
+                    start_time, duration)) {
+              return FALSE;
+            }
+            i++;
+            start += S->d;
+            start_time += duration;
+          }
+        }
+      } else {
+        duration = gst_mpd_client_get_segment_duration (client);
+        if (!GST_CLOCK_TIME_IS_VALID (duration)
+            || !GST_CLOCK_TIME_IS_VALID (PeriodEnd))
+          return FALSE;
+
+        while (PeriodStart + start_time < PeriodEnd) {
+          if (!gst_mpd_client_add_media_segment (stream, NULL, i, 0, start_time,
+                  duration)) {
+            return FALSE;
+          }
+          i++;
+          start_time += duration;
+        }
+      }
+    }
+  }
+
+  /* check duration of last segment */
+  if(stream->segments)
+    last_media_segment = g_list_last (stream->segments)->data;
+  else
+    last_media_segment = NULL;
+  if (last_media_segment && GST_CLOCK_TIME_IS_VALID (PeriodEnd)) {
+    if (last_media_segment->start_time + last_media_segment->duration >
+        PeriodEnd) {
+      last_media_segment->duration = PeriodEnd - last_media_segment->start_time;
+      GST_LOG ("Fixed duration of last segment: %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (last_media_segment->duration));
+    }
+    GST_LOG ("Built a list of %d segments", last_media_segment->number);
+  }
+
+  g_free (stream->baseURL);
+  stream->baseURL = gst_mpdparser_parse_baseURL (client);
+
+  return TRUE;
+}
+
+gboolean
+gst_mpd_client_setup_media_presentation (GstMpdClient * client)
+{
+  GstStreamPeriod *stream_period;
+  GstPeriodNode *period_node;
+  GstClockTime start, duration;
+  GList *list, *next;
+  guint idx;
+  gboolean ret = FALSE;
+
+  g_return_val_if_fail (client != NULL, FALSE);
+  g_return_val_if_fail (client->mpd_node != NULL, FALSE);
+
+  GST_DEBUG ("Building the list of Periods in the Media Presentation");
+  GST_MPD_CLIENT_LOCK (client);
+  /* clean the old period list, if any */
+  if (client->periods) {
+    g_list_foreach (client->periods,
+        (GFunc) gst_mpdparser_free_stream_period, NULL);
+    g_list_free (client->periods);
+    client->periods = NULL;
+  }
+
+  idx = 0;
+  start = 0;
+  duration = GST_CLOCK_TIME_NONE;
+  for (list = g_list_first (client->mpd_node->Periods); list;
+      list = g_list_next (list)) {
+    period_node = (GstPeriodNode *) list->data;
+    if (period_node->start != -1) {
+      /* we have a regular period */
+      start = period_node->start * GST_MSECOND;
+    } else if (duration != GST_CLOCK_TIME_NONE) {
+      /* start time inferred from previous period, this is still a regular period */
+      start += duration;
+    } else if (idx == 0 && client->mpd_node->type == GST_MPD_FILE_TYPE_STATIC) {
+      /* first period of a static MPD file, start time is 0 */
+      start = 0;
+    } else {
+      /* this is an 'Early Available Period' */
+      goto early;
+    }
+
+    if (period_node->duration != -1) {
+      duration = period_node->duration * GST_MSECOND;
+    } else if ((next = g_list_next (list)) != NULL) {
+      /* try to infer this period duration from the start time of the next period */
+      GstPeriodNode *next_period_node = next->data;
+      if (next_period_node->start != -1) {
+        duration = next_period_node->start * GST_MSECOND - start;
+      } else {
+        /* Invalid MPD file! */
+        goto syntax_error;
+      }
+    } else if (client->mpd_node->mediaPresentationDuration != -1) {
+      /* last Period of the Media Presentation */
+      duration =
+          client->mpd_node->mediaPresentationDuration * GST_MSECOND - start;
+    } else {
+      /* Invalid MPD file! */
+      goto syntax_error;
+    }
+
+    stream_period = g_slice_new0 (GstStreamPeriod);
+    if (stream_period == NULL) {
+      goto no_mem;
+    }
+    client->periods = g_list_append (client->periods, stream_period);
+    stream_period->period = period_node;
+    stream_period->number = idx++;
+    stream_period->start = start;
+    stream_period->duration = duration;
+    ret = TRUE;
+    GST_LOG (" - added Period %d start=%" GST_TIME_FORMAT " duration=%"
+        GST_TIME_FORMAT, idx, GST_TIME_ARGS (start), GST_TIME_ARGS (duration));
+  }
+
+  GST_MPD_CLIENT_UNLOCK (client);
+  GST_DEBUG ("Found a total of %d valid Periods in the Media Presentation",
+      idx);
+  return ret;
+
+early:
+  GST_MPD_CLIENT_UNLOCK (client);
+  GST_WARNING
+      ("Found an Early Available Period, skipping the rest of the Media Presentation");
+  return ret;
+
+syntax_error:
+  GST_MPD_CLIENT_UNLOCK (client);
+  GST_WARNING
+      ("Cannot get the duration of the Period %d, skipping the rest of the Media Presentation",
+      idx);
+  return ret;
+
+no_mem:
+  GST_MPD_CLIENT_UNLOCK (client);
+  GST_WARNING ("Allocation of GstStreamPeriod struct failed!");
+  return FALSE;
+}
+
+gboolean
+gst_mpd_client_setup_streaming (GstMpdClient * client,
+    GstStreamMimeType mimeType, gchar * lang)
+{
+  GstActiveStream *stream;
+  GstStreamPeriod *stream_period;
+  GstAdaptationSetNode *adapt_set;
+  GstRepresentationNode *representation;
+  GList *rep_list = NULL;
+
+  stream_period = gst_mpdparser_get_stream_period (client);
+  if (stream_period == NULL || stream_period->period == NULL) {
+    GST_DEBUG ("No more Period nodes in the MPD file, terminating...");
+    return FALSE;
+  }
+
+  switch (mimeType) {
+    case GST_STREAM_VIDEO:
+      /* select the adaptation set for the video pipeline */
+      adapt_set =
+          gst_mpdparser_get_adapt_set_with_mimeType_and_idx (stream_period->
+          period->AdaptationSets, "video", 0);
+      if (!adapt_set) {
+        GST_INFO ("No video adaptation set found");
+        return FALSE;
+      }
+      /* retrive the list of representations */
+      rep_list = adapt_set->Representations;
+      if (!rep_list) {
+        GST_WARNING ("Can not retrieve any representation, aborting...");
+        return FALSE;
+      }
+      break;
+    case GST_STREAM_AUDIO:
+      adapt_set =
+          gst_mpdparser_get_first_adapt_set_with_mimeType_and_lang
+          (stream_period->period->AdaptationSets, "audio", lang);
+      /* if we did not found the requested audio language, get the first one */
+      if (!adapt_set)
+        adapt_set =
+            gst_mpdparser_get_first_adapt_set_with_mimeType (stream_period->
+            period->AdaptationSets, "audio");
+      if (!adapt_set) {
+        GST_INFO ("No audio adaptation set found");
+        return FALSE;
+      }
+      rep_list = adapt_set->Representations;
+      if (!rep_list) {
+        GST_WARNING ("Can not retrieve any representation, aborting...");
+        return FALSE;
+      }
+      break;
+    case GST_STREAM_APPLICATION:
+      adapt_set =
+          gst_mpdparser_get_first_adapt_set_with_mimeType_and_lang
+          (stream_period->period->AdaptationSets, "application", lang);
+      /* if we did not found the requested subtitles language, get the first one */
+      if (!adapt_set)
+        adapt_set =
+            gst_mpdparser_get_first_adapt_set_with_mimeType (stream_period->
+            period->AdaptationSets, "application");
+      if (!adapt_set) {
+        GST_INFO ("No application adaptation set found");
+        return FALSE;
+      }
+      rep_list = adapt_set->Representations;
+      if (!rep_list) {
+        GST_WARNING ("Can not retrieve any representation, aborting...");
+        return FALSE;
+      }
+      break;
+    default:
+      GST_WARNING ("Unsupported mimeType %d", mimeType);
+      return FALSE;
+  }
+
+  stream = g_slice_new0 (GstActiveStream);
+  if (stream == NULL) {
+    GST_WARNING ("Allocation of active stream struct failed!");
+    return FALSE;
+  }
+  client->active_streams = g_list_append (client->active_streams, stream);
+
+  stream->baseURL_idx = 0;
+  stream->mimeType = mimeType;
+  stream->cur_adapt_set = adapt_set;
+
+  /* retrive representation list */
+  if (stream->cur_adapt_set != NULL)
+    rep_list = stream->cur_adapt_set->Representations;
+
+#if 0
+  /* fast start */
+  representation =
+      gst_mpdparser_get_representation_with_max_bandwidth (rep_list,
+      stream->max_bandwidth);
+
+  if (!representation) {
+    GST_WARNING
+        ("Can not retrieve a representation with the requested bandwidth");
+    representation = gst_mpdparser_get_lowest_representation (rep_list);
+  }
+#else
+  /* slow start */
+  representation = gst_mpdparser_get_lowest_representation (rep_list);
+#endif
+
+  if (!representation) {
+    GST_WARNING ("No valid representation in the MPD file, aborting...");
+    return FALSE;
+  }
+
+  if (!gst_mpd_client_setup_representation (client, stream, representation))
+    return FALSE;
+
+  GST_INFO ("Successfully setup the download pipeline for mimeType %d",
+      mimeType);
+
+  return TRUE;
+}
+
+gboolean
+gst_mpd_client_get_next_fragment (GstMpdClient * client,
+    guint indexStream, gboolean * discontinuity, gchar ** uri,
+    GstClockTime * duration, GstClockTime * timestamp)
+{
+  GstActiveStream *stream = NULL;
+  GstMediaSegment *currentChunk;
+  gchar *mediaURL = NULL;
+  guint segment_idx;
+
+  /* select stream */
+  g_return_val_if_fail (client != NULL, FALSE);
+  g_return_val_if_fail (client->active_streams != NULL, FALSE);
+  stream = g_list_nth_data (client->active_streams, indexStream);
+  g_return_val_if_fail (stream != NULL, FALSE);
+  g_return_val_if_fail (stream->cur_representation != NULL, FALSE);
+  g_return_val_if_fail (discontinuity != NULL, FALSE);
+
+  GST_MPD_CLIENT_LOCK (client);
+  segment_idx = gst_mpd_client_get_segment_index (stream);
+  GST_DEBUG ("Looking for fragment sequence chunk %d", segment_idx);
+
+  currentChunk =
+      gst_mpdparser_get_chunk_by_index (client, indexStream, segment_idx);
+  if (currentChunk == NULL) {
+    GST_MPD_CLIENT_UNLOCK (client);
+    return FALSE;
+  }
+
+  if (currentChunk->SegmentURL != NULL) {
+    mediaURL = gst_mpdparser_get_mediaURL (client, currentChunk->SegmentURL);
+  } else if (stream->cur_seg_template != NULL) {
+    mediaURL =
+        gst_mpdparser_build_URL_from_template (stream->cur_seg_template->media,
+        stream->cur_representation->id, currentChunk->number,
+        stream->cur_representation->bandwidth, currentChunk->start);
+  }
+
+  *timestamp = currentChunk->start_time;
+  *duration = currentChunk->duration;
+  *discontinuity = segment_idx != currentChunk->number;
+  if (mediaURL == NULL) {
+    /* single segment with URL encoded in the baseURL syntax element */
+    *uri = g_strdup (gst_mpdparser_get_baseURL (client));
+  } else if (strncmp (mediaURL, "http://", 7) != 0) {
+    *uri = g_strconcat (gst_mpdparser_get_baseURL (client), mediaURL, NULL);
+    g_free (mediaURL);
+  } else {
+    *uri = mediaURL;
+  }
+  gst_mpd_client_set_segment_index (stream, segment_idx + 1);
+  GST_MPD_CLIENT_UNLOCK (client);
+
+  GST_DEBUG ("Loading chunk with URL %s", *uri);
+
+  return TRUE;
+}
+
+gboolean
+gst_mpd_client_get_next_header (GstMpdClient * client, const gchar ** uri,
+    guint stream_idx)
+{
+  GstActiveStream *stream;
+  GstStreamPeriod *stream_period;
+
+  stream = gst_mpdparser_get_active_stream_by_index (client, stream_idx);
+  g_return_val_if_fail (stream != NULL, FALSE);
+  g_return_val_if_fail (stream->cur_representation != NULL, FALSE);
+  stream_period = gst_mpdparser_get_stream_period (client);
+  g_return_val_if_fail (stream_period != NULL, FALSE);
+  g_return_val_if_fail (stream_period->period != NULL, FALSE);
+
+  GST_DEBUG ("Looking for current representation header");
+  GST_MPD_CLIENT_LOCK (client);
+  *uri = NULL;
+  if (stream->cur_segment_base && stream->cur_segment_base->Initialization) {
+
+    if (stream->cur_segment_base->Initialization->sourceURL == NULL) {
+      stream->cur_segment_base->Initialization->sourceURL = gst_mpdparser_get_baseURL (client);
+    }//if not present initialization @sourceURL attribute, it's mapped to baseURL
+
+    *uri =
+        gst_mpdparser_get_initializationURL (stream->cur_segment_base->
+        Initialization);
+  } else if (stream->cur_seg_template) {
+    const gchar *initialization = NULL;
+    if (stream->cur_seg_template->initialization) {
+      initialization = stream->cur_seg_template->initialization;
+    } else if (stream->cur_adapt_set->SegmentTemplate
+        && stream->cur_adapt_set->SegmentTemplate->initialization) {
+      initialization = stream->cur_adapt_set->SegmentTemplate->initialization;
+    } else if (stream_period->period->SegmentTemplate
+        && stream_period->period->SegmentTemplate->initialization) {
+      initialization = stream_period->period->SegmentTemplate->initialization;
+    }
+    *uri = gst_mpdparser_build_URL_from_template (initialization,
+        stream->cur_representation->id, 0,
+        stream->cur_representation->bandwidth, 0);
+  }
+  GST_MPD_CLIENT_UNLOCK (client);
+
+  return *uri == NULL ? FALSE : TRUE;
+}
+
+GstClockTime
+gst_mpd_client_get_current_position (GstMpdClient * client)
+{
+  GstActiveStream *stream;
+  GstMediaSegment *media_segment;
+
+  stream = g_list_nth_data (client->active_streams, client->stream_idx);
+  g_return_val_if_fail (stream != NULL, GST_CLOCK_TIME_NONE);
+
+  media_segment =
+      g_list_nth_data (stream->segments,
+      gst_mpd_client_get_segment_index (stream));
+  g_return_val_if_fail (media_segment != NULL, GST_CLOCK_TIME_NONE);
+
+  return media_segment->start_time;
+}
+
+GstClockTime
+gst_mpd_client_get_next_fragment_duration (GstMpdClient * client)
+{
+  GstActiveStream *stream;
+  GstMediaSegment *media_segment;
+
+  stream = g_list_nth_data (client->active_streams, client->stream_idx);
+  g_return_val_if_fail (stream != NULL, 0);
+
+  media_segment =
+      g_list_nth_data (stream->segments,
+      gst_mpd_client_get_segment_index (stream));
+
+  return media_segment == NULL ? 0 : media_segment->duration;
+}
+
+GstClockTime
+gst_mpd_client_get_media_presentation_duration (GstMpdClient * client)
+{
+  GstClockTime duration;
+
+  g_return_val_if_fail (client != NULL, GST_CLOCK_TIME_NONE);
+
+  GST_MPD_CLIENT_LOCK (client);
+  if (client->mpd_node->mediaPresentationDuration != -1) {
+    duration = client->mpd_node->mediaPresentationDuration * GST_MSECOND;
+  } else {
+    /* We can only get the duration for on-demand streams */
+    duration = GST_CLOCK_TIME_NONE;
+  }
+  GST_MPD_CLIENT_UNLOCK (client);
+
+  return duration;
+}
+
+gboolean
+gst_mpd_client_set_period_index (GstMpdClient * client, guint period_idx)
+{
+  GstStreamPeriod *next_stream_period;
+  gboolean ret = FALSE;
+
+  g_return_val_if_fail (client != NULL, FALSE);
+  g_return_val_if_fail (client->periods != NULL, FALSE);
+
+  GST_MPD_CLIENT_LOCK (client);
+  next_stream_period = g_list_nth_data (client->periods, period_idx);
+  if (next_stream_period != NULL) {
+    client->period_idx = period_idx;
+    ret = TRUE;
+  }
+  GST_MPD_CLIENT_UNLOCK (client);
+
+  return ret;
+}
+
+guint
+gst_mpd_client_get_period_index (GstMpdClient * client)
+{
+  guint period_idx;
+
+  g_return_val_if_fail (client != NULL, 0);
+  GST_MPD_CLIENT_LOCK (client);
+  period_idx = client->period_idx;
+  GST_MPD_CLIENT_UNLOCK (client);
+
+  return period_idx;
+}
+
+void
+gst_mpd_client_set_segment_index_for_all_streams (GstMpdClient * client,
+    guint segment_idx)
+{
+  GList *list;
+
+  g_return_if_fail (client != NULL);
+  g_return_if_fail (client->active_streams != NULL);
+
+  /* FIXME: support multiple streams with different segment duration */
+  for (list = g_list_first (client->active_streams); list;
+      list = g_list_next (list)) {
+    GstActiveStream *stream = (GstActiveStream *) list->data;
+    if (stream) {
+      stream->segment_idx = segment_idx;
+    }
+  }
+}
+
+static void
+gst_mpd_client_set_segment_index (GstActiveStream * stream, guint segment_idx)
+{
+  g_return_if_fail (stream != NULL);
+
+  stream->segment_idx = segment_idx;
+}
+
+guint
+gst_mpd_client_get_segment_index (GstActiveStream * stream)
+{
+  g_return_val_if_fail (stream != NULL, 0);
+
+  return stream->segment_idx;
+}
+
+gboolean
+gst_mpd_client_is_live (GstMpdClient * client)
+{
+  g_return_val_if_fail (client != NULL, FALSE);
+  g_return_val_if_fail (client->mpd_node != NULL, FALSE);
+
+  return client->mpd_node->type == GST_MPD_FILE_TYPE_DYNAMIC;
+}
+
+guint
+gst_mpdparser_get_nb_active_stream (GstMpdClient * client)
+{
+  g_return_val_if_fail (client != NULL, 0);
+
+  return g_list_length (client->active_streams);
+}
+
+guint
+gst_mpdparser_get_nb_adaptationSet (GstMpdClient * client)
+{
+  GstStreamPeriod *stream_period;
+
+  stream_period = gst_mpdparser_get_stream_period (client);
+  g_return_val_if_fail (stream_period != NULL, 0);
+  g_return_val_if_fail (stream_period->period != NULL, 0);
+
+  return g_list_length (stream_period->period->AdaptationSets);
+}
+
+GstActiveStream *
+gst_mpdparser_get_active_stream_by_index (GstMpdClient * client,
+    guint stream_idx)
+{
+  g_return_val_if_fail (client != NULL, NULL);
+  g_return_val_if_fail (client->active_streams != NULL, NULL);
+
+  return g_list_nth_data (client->active_streams, stream_idx);
+}
+
+static const gchar *
+gst_mpdparser_mimetype_to_caps (const gchar * mimeType)
+{
+  if (mimeType == NULL)
+    return NULL;
+  if (strcmp (mimeType, "video/mp2t") == 0) {
+    return "video/mpegts";
+  } else if (strcmp (mimeType, "video/mp4") == 0) {
+    return "video/quicktime";
+  } else if (strcmp (mimeType, "audio/mp4") == 0) {
+    return "audio/x-m4a";
+  } else
+    return mimeType;
+}
+
+const gchar *
+gst_mpd_client_get_stream_mimeType (GstActiveStream * stream)
+{
+  const gchar *mimeType;
+
+  if (stream == NULL || stream->cur_adapt_set == NULL
+      || stream->cur_representation == NULL)
+    return NULL;
+
+  mimeType = stream->cur_representation->RepresentationBase->mimeType;
+  if (mimeType == NULL) {
+    mimeType = stream->cur_adapt_set->RepresentationBase->mimeType;
+  }
+
+  return gst_mpdparser_mimetype_to_caps (mimeType);
+}
+
+const gboolean
+gst_mpd_client_get_bitstream_switching_flag (GstActiveStream * stream)
+{
+  if (stream == NULL || stream->cur_adapt_set == NULL)
+    return FALSE;
+
+  return stream->cur_adapt_set->bitstreamSwitching;
+}
+
+guint
+gst_mpd_client_get_video_stream_width (GstActiveStream * stream)
+{
+  guint width;
+
+  if (stream == NULL || stream->cur_adapt_set == NULL
+      || stream->cur_representation == NULL)
+    return 0;
+
+  width = stream->cur_representation->RepresentationBase->width;
+  if (width == 0) {
+    width = stream->cur_adapt_set->RepresentationBase->width;
+  }
+
+  return width;
+}
+
+guint
+gst_mpd_client_get_video_stream_height (GstActiveStream * stream)
+{
+  guint height;
+
+  if (stream == NULL || stream->cur_adapt_set == NULL
+      || stream->cur_representation == NULL)
+    return 0;
+
+  height = stream->cur_representation->RepresentationBase->height;
+  if (height == 0) {
+    height = stream->cur_adapt_set->RepresentationBase->height;
+  }
+
+  return height;
+}
+
+guint
+gst_mpd_client_get_audio_stream_rate (GstActiveStream * stream)
+{
+  const gchar *rate;
+
+  if (stream == NULL || stream->cur_adapt_set == NULL
+      || stream->cur_representation == NULL)
+    return 0;
+
+  rate = stream->cur_representation->RepresentationBase->audioSamplingRate;
+  if (rate == NULL) {
+    rate = stream->cur_adapt_set->RepresentationBase->audioSamplingRate;
+  }
+
+  return rate ? atoi (rate) : 0;
+}
+
+guint
+gst_mpd_client_get_audio_stream_num_channels (GstActiveStream * stream)
+{
+  if (stream == NULL || stream->cur_adapt_set == NULL
+      || stream->cur_representation == NULL)
+    return 0;
+  /* TODO: here we have to parse the AudioChannelConfiguration descriptors */
+  return 0;
+}
+
+guint
+gst_mpdparser_get_list_and_nb_of_audio_language (GstMpdClient * client,
+    GList ** lang)
+{
+  GstStreamPeriod *stream_period;
+  GstAdaptationSetNode *adapt_set;
+  GList *list;
+  gchar *this_mimeType = "audio";
+  gchar *mimeType = NULL;
+  guint nb_adapatation_set = 0;
+
+  stream_period = gst_mpdparser_get_stream_period (client);
+  g_return_val_if_fail (stream_period != NULL, 0);
+  g_return_val_if_fail (stream_period->period != NULL, 0);
+
+  for (list = g_list_first (stream_period->period->AdaptationSets); list;
+      list = g_list_next (list)) {
+    adapt_set = (GstAdaptationSetNode *) list->data;
+    if (adapt_set) {
+      gchar *this_lang = adapt_set->lang;
+      GstRepresentationNode *rep;
+      rep =
+          gst_mpdparser_get_lowest_representation (adapt_set->Representations);
+      if (rep->RepresentationBase)
+        mimeType = rep->RepresentationBase->mimeType;
+      if (!mimeType && adapt_set->RepresentationBase) {
+        mimeType = adapt_set->RepresentationBase->mimeType;
+      }
+
+      if (strncmp_ext (mimeType, this_mimeType) == 0) {
+        if (this_lang) {
+          nb_adapatation_set++;
+          *lang = g_list_append (*lang, this_lang);
+        }
+      }
+    }
+  }
+
+  return nb_adapatation_set;
+}
diff --git a/wearable/dashdemux/src/gstmpdparser.h b/wearable/dashdemux/src/gstmpdparser.h
new file mode 100755 (executable)
index 0000000..b270a3e
--- /dev/null
@@ -0,0 +1,513 @@
+/*
+ * DASH MPD parsing library
+ *
+ * gstmpdparser.h
+ *
+ * Copyright (C) 2012 STMicroelectronics
+ *
+ * Authors:
+ *   Gianluca Gennari <gennarone@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library (COPYING); if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_MPDPARSER_H__
+#define __GST_MPDPARSER_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GstMpdClient              GstMpdClient;
+typedef struct _GstActiveStream           GstActiveStream;
+typedef struct _GstStreamPeriod           GstStreamPeriod;
+typedef struct _GstMediaSegment           GstMediaSegment;
+typedef struct _GstMPDNode                GstMPDNode;
+typedef struct _GstPeriodNode             GstPeriodNode;
+typedef struct _GstRepresentationBaseType GstRepresentationBaseType;
+typedef struct _GstDescriptorType         GstDescriptorType;
+typedef struct _GstContentComponentNode   GstContentComponentNode;
+typedef struct _GstAdaptationSetNode      GstAdaptationSetNode;
+typedef struct _GstRepresentationNode     GstRepresentationNode;
+typedef struct _GstSubRepresentationNode  GstSubRepresentationNode;
+typedef struct _GstSegmentListNode        GstSegmentListNode;
+typedef struct _GstSegmentTemplateNode    GstSegmentTemplateNode;
+typedef struct _GstSegmentURLNode         GstSegmentURLNode;
+typedef struct _GstBaseURL                GstBaseURL;
+typedef struct _GstRange                  GstRange;
+typedef struct _GstRatio                  GstRatio;
+typedef struct _GstFrameRate              GstFrameRate;
+typedef struct _GstConditionalUintType    GstConditionalUintType;
+typedef struct _GstSubsetNode             GstSubsetNode;
+typedef struct _GstProgramInformationNode GstProgramInformationNode;
+typedef struct _GstMetricsRangeNode       GstMetricsRangeNode;
+typedef struct _GstMetricsNode            GstMetricsNode;
+typedef struct _GstSNode                  GstSNode;
+typedef struct _GstSegmentTimelineNode    GstSegmentTimelineNode;
+typedef struct _GstSegmentBaseType        GstSegmentBaseType;
+typedef struct _GstURLType                GstURLType;
+typedef struct _GstMultSegmentBaseType    GstMultSegmentBaseType;
+
+#define GST_MPD_CLIENT_LOCK(c) g_mutex_lock (c->lock);
+#define GST_MPD_CLIENT_UNLOCK(c) g_mutex_unlock (c->lock);
+
+typedef enum
+{
+  GST_STREAM_VIDEO,           /* video stream (the main one) */
+  GST_STREAM_AUDIO,           /* audio stream (optional) */
+  GST_STREAM_APPLICATION      /* application stream (optional): for timed text/subtitles */
+} GstStreamMimeType;
+
+typedef enum
+{
+  GST_MPD_FILE_TYPE_STATIC,
+  GST_MPD_FILE_TYPE_DYNAMIC
+} GstMPDFileType;
+
+typedef enum
+{
+  GST_SAP_TYPE_0 = 0,
+  GST_SAP_TYPE_1,
+  GST_SAP_TYPE_2,
+  GST_SAP_TYPE_3,
+  GST_SAP_TYPE_4,
+  GST_SAP_TYPE_5,
+  GST_SAP_TYPE_6
+} GstSAPType;
+
+struct _GstBaseURL
+{
+  gchar *baseURL;
+  gchar *serviceLocation;
+  gchar *byteRange;
+};
+
+struct _GstRange
+{
+  guint64 first_byte_pos;
+  guint64 last_byte_pos;
+};
+
+struct _GstRatio
+{
+  guint num;
+  guint den;
+};
+
+struct _GstFrameRate
+{
+  guint num;
+  guint den;
+};
+
+struct _GstConditionalUintType
+{
+  gboolean flag;
+  guint value;
+};
+
+struct _GstSNode
+{
+  guint t;
+  guint d;
+  guint r;
+};
+
+struct _GstSegmentTimelineNode
+{
+  /* list of S nodes */
+  GList *S;
+};
+
+struct _GstURLType
+{
+  gchar *sourceURL;
+  GstRange *range;
+};
+
+struct _GstSegmentBaseType
+{
+  guint timescale;
+  guint presentationTimeOffset;
+  gchar *indexRange;
+  gboolean indexRangeExact;
+  /* Initialization node */
+  GstURLType *Initialization;
+  /* RepresentationIndex node */
+  GstURLType *RepresentationIndex;
+};
+
+struct _GstMultSegmentBaseType
+{
+  guint duration;                  /* in seconds */
+  guint startNumber;
+  /* SegmentBaseType extension */
+  GstSegmentBaseType *SegBaseType;
+  /* SegmentTimeline node */
+  GstSegmentTimelineNode *SegmentTimeline;
+  /* BitstreamSwitching node */
+  GstURLType *BitstreamSwitching;
+};
+
+struct _GstSegmentListNode
+{
+  /* extension */
+  GstMultSegmentBaseType *MultSegBaseType;
+  /* list of SegmentURL nodes */
+  GList *SegmentURL;
+};
+
+struct _GstSegmentTemplateNode
+{
+  /* extension */
+  GstMultSegmentBaseType *MultSegBaseType;
+  gchar *media;
+  gchar *index;
+  gchar *initialization;
+  gchar *bitstreamSwitching;
+};
+
+struct _GstSegmentURLNode
+{
+  gchar *media;
+  GstRange *mediaRange;
+  gchar *index;
+  GstRange *indexRange;
+};
+
+struct _GstRepresentationBaseType
+{
+  gchar *profiles;
+  guint width;
+  guint height;
+  GstRatio *sar;
+  GstFrameRate *frameRate;
+  gchar *audioSamplingRate;
+  gchar *mimeType;
+  gchar *segmentProfiles;
+  gchar *codecs;
+  gdouble maximumSAPPeriod;
+  GstSAPType startWithSAP;
+  gdouble maxPlayoutRate;
+  gboolean codingDependency;
+  gchar *scanType;
+  /* list of FramePacking DescriptorType nodes */
+  GList *FramePacking;
+  /* list of AudioChannelConfiguration DescriptorType nodes */
+  GList *AudioChannelConfiguration;
+  /* list of ContentProtection DescriptorType nodes */
+  GList *ContentProtection;
+};
+
+struct _GstSubRepresentationNode
+{
+  /* RepresentationBase extension */
+  GstRepresentationBaseType *RepresentationBase;
+  guint level;
+  guint *dependencyLevel;            /* UIntVectorType */
+  guint size;                        /* size of "dependencyLevel" array */
+  guint bandwidth;
+  gchar **contentComponent;          /* StringVectorType */
+};
+
+struct _GstRepresentationNode
+{
+  gchar *id;
+  guint bandwidth;
+  guint qualityRanking;
+  gchar **dependencyId;              /* StringVectorType */
+  gchar **mediaStreamStructureId;    /* StringVectorType */
+  /* RepresentationBase extension */
+  GstRepresentationBaseType *RepresentationBase;
+  /* list of BaseURL nodes */
+  GList *BaseURLs;
+  /* list of SubRepresentation nodes */
+  GList *SubRepresentations;
+  /* SegmentBase node */
+  GstSegmentBaseType *SegmentBase;
+  /* SegmentTemplate node */
+  GstSegmentTemplateNode *SegmentTemplate;
+  /* SegmentList node */
+  GstSegmentListNode *SegmentList;
+};
+
+struct _GstDescriptorType
+{
+  gchar *schemeIdUri;
+  gchar *value;
+  /* For adding ContentProtection to caps , get string of <mspr:pro> */
+  gchar *msprPro;
+};
+
+struct _GstContentComponentNode
+{
+  guint id;
+  gchar *lang;                      /* LangVectorType RFC 5646 */
+  gchar *contentType;
+  GstRatio *par;
+  /* list of Accessibility DescriptorType nodes */
+  GList *Accessibility;
+  /* list of Role DescriptorType nodes */
+  GList *Role;
+  /* list of Rating DescriptorType nodes */
+  GList *Rating;
+  /* list of Viewpoint DescriptorType nodes */
+  GList *Viewpoint;
+};
+
+struct _GstAdaptationSetNode
+{
+  guint id;
+  guint group;
+  gchar *lang;                      /* LangVectorType RFC 5646 */
+  gchar *contentType;
+  GstRatio *par;
+  guint minBandwidth;
+  guint maxBandwidth;
+  guint minWidth;
+  guint maxWidth;
+  guint minHeight;
+  guint maxHeight;
+  GstFrameRate *minFrameRate;
+  GstFrameRate *maxFrameRate;
+  GstConditionalUintType *segmentAlignment;
+  GstConditionalUintType *subsegmentAlignment;
+  GstSAPType subsegmentStartsWithSAP;
+  gboolean bitstreamSwitching;
+  /* list of Accessibility DescriptorType nodes */
+  GList *Accessibility;
+  /* list of Role DescriptorType nodes */
+  GList *Role;
+  /* list of Rating DescriptorType nodes */
+  GList *Rating;
+  /* list of Viewpoint DescriptorType nodes */
+  GList *Viewpoint;
+  /* RepresentationBase extension */
+  GstRepresentationBaseType *RepresentationBase;
+  /* SegmentBase node */
+  GstSegmentBaseType *SegmentBase;
+  /* SegmentList node */
+  GstSegmentListNode *SegmentList;
+  /* SegmentTemplate node */
+  GstSegmentTemplateNode *SegmentTemplate;
+  /* list of BaseURL nodes */
+  GList *BaseURLs;
+  /* list of Representation nodes */
+  GList *Representations;
+  /* list of ContentComponent nodes */
+  GList *ContentComponents;
+};
+
+struct _GstSubsetNode
+{
+  guint *contains;                   /* UIntVectorType */
+  guint size;                        /* size of the "contains" array */
+};
+
+struct _GstPeriodNode
+{
+  gchar *id;
+  gint64 start;                      /* [ms] */
+  gint64 duration;                   /* [ms] */
+  gboolean bitstreamSwitching;
+  /* SegmentBase node */
+  GstSegmentBaseType *SegmentBase;
+  /* SegmentList node */
+  GstSegmentListNode *SegmentList;
+  /* SegmentTemplate node */
+  GstSegmentTemplateNode *SegmentTemplate;
+  /* list of Adaptation Set nodes */
+  GList *AdaptationSets;
+  /* list of Representation nodes */
+  GList *Subsets;
+  /* list of BaseURL nodes */
+  GList *BaseURLs;
+};
+
+struct _GstProgramInformationNode
+{
+  gchar *lang;                      /* LangVectorType RFC 5646 */
+  gchar *moreInformationURL;
+  /* children nodes */
+  gchar *Title;
+  gchar *Source;
+  gchar *Copyright;
+};
+
+struct _GstMetricsRangeNode
+{
+  gint64 starttime;                  /* [ms] */
+  gint64 duration;                   /* [ms] */
+};
+
+struct _GstMetricsNode
+{
+  gchar *metrics;
+  /* list of Metrics Range nodes */
+  GList *MetricsRanges;
+  /* list of Reporting nodes */
+  GList *Reportings;
+};
+
+struct _GstMPDNode
+{
+  gchar *default_namespace;
+  gchar *namespace_xsi;
+  gchar *namespace_ext;
+  gchar *schemaLocation;
+  gchar *id;
+  gchar *profiles;
+  GstMPDFileType type;
+  GstDateTime *availabilityStartTime;
+  GstDateTime *availabilityEndTime;
+  gint64 mediaPresentationDuration;  /* [ms] */
+  gint64 minimumUpdatePeriod;        /* [ms] */
+  gint64 minBufferTime;              /* [ms] */
+  gint64 timeShiftBufferDepth;       /* [ms] */
+  gint64 suggestedPresentationDelay; /* [ms] */
+  gint64 maxSegmentDuration;         /* [ms] */
+  gint64 maxSubsegmentDuration;      /* [ms] */
+  /* list of BaseURL nodes */
+  GList *BaseURLs;
+  /* list of Location nodes */
+  GList *Locations;
+  /* List of ProgramInformation nodes */
+  GList *ProgramInfo;
+  /* list of Periods nodes */
+  GList *Periods;
+  /* list of Metrics nodes */
+  GList *Metrics;
+};
+
+/**
+ * GstStreamPeriod:
+ *
+ * Stream period data structure
+ */
+struct _GstStreamPeriod
+{
+  GstPeriodNode *period;                      /* Stream period */
+  guint number;                               /* Period number */
+  GstClockTime start;                         /* Period start time */
+  GstClockTime duration;                      /* Period duration */
+};
+
+/**
+ * GstMediaSegment:
+ *
+ * Media segment data structure
+ */
+struct _GstMediaSegment
+{
+  GstSegmentURLNode *SegmentURL;              /* this is NULL when using a SegmentTemplate */
+  guint number;                               /* segment number */
+  guint start;                                /* segment start time in timescale units */
+  GstClockTime start_time;                    /* segment start time */
+  GstClockTime duration;                      /* segment duration */
+};
+
+/**
+ * GstActiveStream:
+ *
+ * Active stream data structure
+ */
+struct _GstActiveStream
+{
+  GstStreamMimeType mimeType;                 /* video/audio/application */
+
+  guint baseURL_idx;                          /* index of the baseURL used for last request */
+  gchar *baseURL;                             /* active baseURL used for last request */
+  guint max_bandwidth;                        /* max bandwidth allowed for this mimeType */
+
+  GstAdaptationSetNode *cur_adapt_set;        /* active adaptation set */
+  gint representation_idx;                    /* index of current representation */
+  GstRepresentationNode *cur_representation;  /* active representation */
+  GstSegmentBaseType *cur_segment_base;       /* active segment base */
+  GstSegmentListNode *cur_segment_list;       /* active segment list */
+  GstSegmentTemplateNode *cur_seg_template;   /* active segment template */
+  guint segment_idx;                          /* index of next sequence chunk */
+  GList *segments;                            /* list of GstMediaSegment */
+};
+
+struct _GstMpdClient
+{
+  GstMPDNode *mpd_node;                       /* active MPD manifest file */
+
+  GList *periods;                             /* list of GstStreamPeriod */
+  guint period_idx;                           /* index of current Period */
+
+  GList *active_streams;                      /* list of GstActiveStream */
+  guint stream_idx;                           /* currently active stream */
+
+  guint update_failed_count;
+  gchar *mpd_uri;                             /* manifest file URI */
+  GMutex *lock;
+};
+
+/* Basic initialization/deinitialization functions */
+GstMpdClient *gst_mpd_client_new ();
+void gst_active_streams_free (GstMpdClient * client);
+void gst_mpd_client_free (GstMpdClient * client);
+
+/* MPD file parsing */
+gboolean gst_mpd_parse (GstMpdClient *client, const gchar *data, gint size);
+
+/* Streaming management */
+gboolean gst_mpd_client_setup_media_presentation (GstMpdClient *client);
+gboolean gst_mpd_client_setup_streaming (GstMpdClient *client, GstStreamMimeType mimeType, gchar* lang);
+gboolean gst_mpd_client_setup_representation (GstMpdClient *client, GstActiveStream *stream, GstRepresentationNode *representation);
+GstClockTime gst_mpd_client_get_current_position (GstMpdClient *client);
+GstClockTime gst_mpd_client_get_next_fragment_duration (GstMpdClient * client);
+GstClockTime gst_mpd_client_get_media_presentation_duration (GstMpdClient *client);
+gboolean gst_mpd_client_get_next_fragment (GstMpdClient *client, guint indexStream, gboolean *discontinuity, gchar **uri, GstClockTime *duration, GstClockTime *timestamp);
+gboolean gst_mpd_client_get_next_header (GstMpdClient *client, const gchar **uri, guint stream_idx);
+gboolean gst_mpd_client_is_live (GstMpdClient * client);
+
+/* Period selection */
+gboolean gst_mpd_client_set_period_index (GstMpdClient *client, guint period_idx);
+guint gst_mpd_client_get_period_index (GstMpdClient *client);
+
+/* Representation selection */
+gint gst_mpdparser_get_rep_idx_with_max_bandwidth (GList *Representations, gint max_bandwidth);
+
+/* URL management */
+const gchar *gst_mpdparser_get_baseURL (GstMpdClient *client);
+GstMediaSegment *gst_mpdparser_get_chunk_by_index (GstMpdClient *client, guint indexStream, guint indexChunk);
+
+/* Active stream */
+guint gst_mpdparser_get_nb_active_stream (GstMpdClient *client);
+GstActiveStream *gst_mpdparser_get_active_stream_by_index (GstMpdClient *client, guint stream_idx);
+
+/* AdaptationSet */
+guint gst_mpdparser_get_nb_adaptationSet (GstMpdClient *client);
+
+/* Segment */
+void gst_mpd_client_set_segment_index_for_all_streams (GstMpdClient * client, guint segment_idx);
+guint gst_mpd_client_get_segment_index (GstActiveStream * stream);
+
+/* Get audio/video stream parameters (mimeType, width, height, rate, number of channels) */
+const gchar *gst_mpd_client_get_stream_mimeType (GstActiveStream * stream);
+const gboolean gst_mpd_client_get_bitstream_switching_flag (GstActiveStream * stream);
+guint gst_mpd_client_get_video_stream_width (GstActiveStream * stream);
+guint gst_mpd_client_get_video_stream_height (GstActiveStream * stream);
+guint gst_mpd_client_get_audio_stream_rate (GstActiveStream * stream);
+guint gst_mpd_client_get_audio_stream_num_channels (GstActiveStream * stream);
+
+/* Support multi language */
+guint gst_mpdparser_get_list_and_nb_of_audio_language (GstMpdClient *client, GList **lang);
+G_END_DECLS
+
+#endif /* __GST_MPDPARSER_H__ */
diff --git a/wearable/dashdemux/src/gstplugin.c b/wearable/dashdemux/src/gstplugin.c
new file mode 100755 (executable)
index 0000000..8584caf
--- /dev/null
@@ -0,0 +1,109 @@
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <string.h>
+
+#include <gst/gst.h>
+
+#include "gstfragmented.h"
+#include "gstdashdemux.h"
+
+GST_DEBUG_CATEGORY (fragmented_debug);
+
+#define XML_BUFFER_SIZE 16
+#define XML_INC_BUFFER {                                                \
+  pos++;                                                                \
+  if (pos == XML_BUFFER_SIZE) {                                         \
+    pos = 0;                                                            \
+    offset += XML_BUFFER_SIZE;                                          \
+    data = gst_type_find_peek (tf, offset, XML_BUFFER_SIZE);            \
+    if (data == NULL) return FALSE;                                     \
+  } else {                                                              \
+    data++;                                                             \
+  }                                                                     \
+}
+
+static gboolean
+xml_check_first_element (GstTypeFind * tf, const gchar * element, guint elen,
+    gboolean strict)
+{
+  gboolean got_xmldec;
+  const guint8 *data;
+  guint offset = 0;
+  guint pos = 0;
+
+  data = gst_type_find_peek (tf, 0, XML_BUFFER_SIZE);
+  if (!data)
+    return FALSE;
+
+  /* look for the XMLDec
+   * see XML spec 2.8, Prolog and Document Type Declaration
+   * http://www.w3.org/TR/2004/REC-xml-20040204/#sec-prolog-dtd */
+  got_xmldec = (memcmp (data, "<?xml", 5) == 0);
+
+  if (strict && !got_xmldec)
+    return FALSE;
+
+  /* skip XMLDec in any case if we've got one */
+  if (got_xmldec) {
+    pos += 5;
+    data += 5;
+  }
+
+  /* look for the first element, it has to be the requested element. Bail
+   * out if it is not within the first 4kB. */
+  while (data && (offset + pos) < 4096) {
+    while (*data != '<' && (offset + pos) < 4096) {
+      XML_INC_BUFFER;
+    }
+
+    XML_INC_BUFFER;
+    if (!g_ascii_isalpha (*data)) {
+      /* if not alphabetic, it's a PI or an element / attribute declaration
+       * like <?xxx or <!xxx */
+      XML_INC_BUFFER;
+      continue;
+    }
+
+    /* the first normal element, check if it's the one asked for */
+    data = gst_type_find_peek (tf, offset + pos, elen + 1);
+    return (data && element && strncmp ((char *) data, element, elen) == 0);
+  }
+
+  return FALSE;
+}
+
+/*** application/dash+xml typefind helper ***/
+
+static GstStaticCaps dash_caps = GST_STATIC_CAPS ("application/dash+xml");
+
+#define DASH_CAPS gst_static_caps_get (&dash_caps)
+
+static void
+dash_type_find (GstTypeFind * tf, gpointer unused)
+{
+  if (xml_check_first_element (tf, "MPD", 3, FALSE) ||
+      xml_check_first_element (tf, "mpd", 3, FALSE)) {
+    gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, DASH_CAPS);
+  }
+}
+
+static gboolean
+fragmented_init (GstPlugin * plugin)
+{
+  GST_DEBUG_CATEGORY_INIT (fragmented_debug, "dashdemux", 0, "dashdemux");
+  if (!gst_element_register (plugin, "dashdemux", GST_RANK_PRIMARY,
+          GST_TYPE_DASH_DEMUX) || FALSE)
+    return FALSE;
+  if(!gst_type_find_register (plugin, "application/dash+xml",
+      GST_RANK_SECONDARY, dash_type_find, NULL, DASH_CAPS, NULL, NULL))
+    return FALSE;
+  return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    "dashdemux",
+    "DASH demuxer plugin",
+    fragmented_init, VERSION, "LGPL", PACKAGE_NAME, "http://www.gstreamer.org/")
diff --git a/wearable/dashdemux/src/gsturidownloader.c b/wearable/dashdemux/src/gsturidownloader.c
new file mode 100755 (executable)
index 0000000..81e693d
--- /dev/null
@@ -0,0 +1,394 @@
+/* GStreamer
+ * Copyright (C) 2011 Andoni Morales Alastruey <ylatuya@gmail.com>
+ *
+ * gstfragment.c:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include "gstfragmented.h"
+#include "gstfragment.h"
+#include "gsturidownloader.h"
+
+GST_DEBUG_CATEGORY_STATIC (uridownloader_debug);
+#define GST_CAT_DEFAULT (uridownloader_debug)
+
+#define GST_URI_DOWNLOADER_GET_PRIVATE(obj)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
+    GST_TYPE_URI_DOWNLOADER, GstUriDownloaderPrivate))
+
+struct _GstUriDownloaderPrivate
+{
+  /* Fragments fetcher */
+  GstElement *urisrc;
+  GstBus *bus;
+  GstPad *pad;
+  GTimeVal *timeout;
+  GstFragment *download;
+  GMutex *lock;
+  GCond *cond;
+/* add setting UA,cookies */
+  gchar *user_agent;
+  gchar **cookies;
+};
+
+static void gst_uri_downloader_finalize (GObject * object);
+static void gst_uri_downloader_dispose (GObject * object);
+
+static GstFlowReturn gst_uri_downloader_chain (GstPad * pad, GstBuffer * buf);
+static gboolean gst_uri_downloader_sink_event (GstPad * pad, GstEvent * event);
+static GstBusSyncReply gst_uri_downloader_bus_handler (GstBus * bus,
+    GstMessage * message, gpointer data);
+
+static GstStaticPadTemplate sinkpadtemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS_ANY);
+
+#define _do_init \
+{ \
+  GST_DEBUG_CATEGORY_INIT (uridownloader_debug, "uridownloader", 0, "URI downloader"); \
+}
+
+G_DEFINE_TYPE_WITH_CODE (GstUriDownloader, gst_uri_downloader, GST_TYPE_OBJECT,
+    _do_init);
+
+static void
+gst_uri_downloader_class_init (GstUriDownloaderClass * klass)
+{
+  GObjectClass *gobject_class;
+
+  gobject_class = (GObjectClass *) klass;
+
+  g_type_class_add_private (klass, sizeof (GstUriDownloaderPrivate));
+
+  gobject_class->dispose = gst_uri_downloader_dispose;
+  gobject_class->finalize = gst_uri_downloader_finalize;
+}
+
+static void
+gst_uri_downloader_init (GstUriDownloader * downloader)
+{
+  downloader->priv = GST_URI_DOWNLOADER_GET_PRIVATE (downloader);
+
+  /* Initialize the sink pad. This pad will be connected to the src pad of the
+   * element created with gst_element_make_from_uri and will handle the download */
+  downloader->priv->pad =
+      gst_pad_new_from_static_template (&sinkpadtemplate, "sink");
+  gst_pad_set_chain_function (downloader->priv->pad,
+      GST_DEBUG_FUNCPTR (gst_uri_downloader_chain));
+  gst_pad_set_event_function (downloader->priv->pad,
+      GST_DEBUG_FUNCPTR (gst_uri_downloader_sink_event));
+  gst_pad_set_element_private (downloader->priv->pad, downloader);
+  gst_pad_activate_push (downloader->priv->pad, TRUE);
+
+  /* Create a bus to handle error and warning message from the source element */
+  downloader->priv->bus = gst_bus_new ();
+
+  downloader->priv->lock = g_mutex_new ();
+  downloader->priv->cond = g_cond_new ();
+/* add setting UA, cookies */
+  downloader->priv->user_agent = NULL;
+  downloader->priv->cookies = NULL;
+}
+
+static void
+gst_uri_downloader_dispose (GObject * object)
+{
+  GstUriDownloader *downloader = GST_URI_DOWNLOADER (object);
+
+  if (downloader->priv->urisrc != NULL) {
+    gst_object_unref (downloader->priv->urisrc);
+    downloader->priv->urisrc = NULL;
+  }
+
+  if (downloader->priv->bus != NULL) {
+    gst_object_unref (downloader->priv->bus);
+    downloader->priv->bus = NULL;
+  }
+
+  if (downloader->priv->pad) {
+    gst_object_unref (downloader->priv->pad);
+    downloader->priv->pad = NULL;
+  }
+
+  if (downloader->priv->download) {
+    g_object_unref (downloader->priv->download);
+    downloader->priv->download = NULL;
+  }
+
+/* add setting UA, cookies */
+  if (downloader->priv->user_agent) {
+    g_free (downloader->priv->user_agent);
+    downloader->priv->user_agent = NULL;
+  }
+  if (downloader->priv->cookies) {
+    g_strfreev (downloader->priv->cookies);
+    downloader->priv->cookies = NULL;
+  }
+  G_OBJECT_CLASS (gst_uri_downloader_parent_class)->dispose (object);
+}
+
+static void
+gst_uri_downloader_finalize (GObject * object)
+{
+  GstUriDownloader *downloader = GST_URI_DOWNLOADER (object);
+
+  g_mutex_free (downloader->priv->lock);
+  g_cond_free (downloader->priv->cond);
+
+  G_OBJECT_CLASS (gst_uri_downloader_parent_class)->finalize (object);
+}
+
+GstUriDownloader *
+gst_uri_downloader_new (void)
+{
+  return g_object_new (GST_TYPE_URI_DOWNLOADER, NULL);
+}
+
+static gboolean
+gst_uri_downloader_sink_event (GstPad * pad, GstEvent * event)
+{
+  GstUriDownloader *downloader =
+      (GstUriDownloader *) (gst_pad_get_element_private (pad));
+
+  switch (event->type) {
+    case GST_EVENT_EOS:{
+      GST_OBJECT_LOCK (downloader);
+      GST_DEBUG_OBJECT (downloader, "Got EOS on the fetcher pad");
+      if (downloader->priv->download != NULL) {
+        /* signal we have fetched the URI */
+        downloader->priv->download->completed = TRUE;
+        downloader->priv->download->download_stop_time = g_get_real_time ();
+        GST_OBJECT_UNLOCK (downloader);
+        GST_DEBUG_OBJECT (downloader, "Signaling chain funtion");
+        g_cond_signal (downloader->priv->cond);
+
+      } else {
+        GST_OBJECT_UNLOCK (downloader);
+      }
+      break;
+    }
+    default:
+      break;
+  }
+
+  gst_event_unref (event);
+  return FALSE;
+}
+
+static GstBusSyncReply
+gst_uri_downloader_bus_handler (GstBus * bus,
+    GstMessage * message, gpointer data)
+{
+  GstUriDownloader *downloader = (GstUriDownloader *) (data);
+
+  if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR ||
+      GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING) {
+    GST_WARNING_OBJECT (downloader,
+        "Received error in bus from the source element, "
+        "the download will be cancelled");
+    /* remove the sync handler to avoid duplicated messages */
+    gst_bus_set_sync_handler (downloader->priv->bus, NULL, NULL);
+    gst_uri_downloader_cancel (downloader);
+  }
+
+  gst_message_unref (message);
+  return GST_BUS_DROP;
+}
+
+static GstFlowReturn
+gst_uri_downloader_chain (GstPad * pad, GstBuffer * buf)
+{
+  GstUriDownloader *downloader =
+      (GstUriDownloader *) gst_pad_get_element_private (pad);
+
+  /* HTML errors (404, 500, etc...) are also pushed through this pad as
+   * response but the source element will also post a warning or error message
+   * in the bus, which is handled synchronously cancelling the download.
+   */
+  GST_OBJECT_LOCK (downloader);
+  if (downloader->priv->download == NULL) {
+    /* Download cancelled, quit */
+    GST_OBJECT_UNLOCK (downloader);
+    goto done;
+  }
+
+  GST_LOG_OBJECT (downloader,
+      "The uri fetcher received a new buffer of size %u",
+      GST_BUFFER_SIZE (buf));
+  if (!gst_fragment_add_buffer (downloader->priv->download, buf))
+    GST_WARNING_OBJECT (downloader, "Could not add buffer to fragment");
+  GST_OBJECT_UNLOCK (downloader);
+
+done:
+  {
+    return GST_FLOW_OK;
+  }
+}
+
+static void
+gst_uri_downloader_stop (GstUriDownloader * downloader)
+{
+  GstPad *pad;
+
+  GST_DEBUG_OBJECT (downloader, "Stopping source element");
+
+  /* remove the bus' sync handler */
+  gst_bus_set_sync_handler (downloader->priv->bus, NULL, NULL);
+  /* unlink the source element from the internal pad */
+  pad = gst_pad_get_peer (downloader->priv->pad);
+  if (pad) {
+    gst_pad_unlink (pad, downloader->priv->pad);
+    gst_object_unref (pad);
+  }
+  /* set the element state to NULL */
+  if (downloader->priv->urisrc)
+  {
+    gst_element_set_state (downloader->priv->urisrc, GST_STATE_NULL);
+    gst_element_get_state (downloader->priv->urisrc, NULL, NULL,
+        GST_CLOCK_TIME_NONE);
+  }
+}
+
+void
+gst_uri_downloader_cancel (GstUriDownloader * downloader)
+{
+  GST_OBJECT_LOCK (downloader);
+  if (downloader->priv->download != NULL) {
+    GST_DEBUG_OBJECT (downloader, "Cancelling download");
+    g_object_unref (downloader->priv->download);
+    downloader->priv->download = NULL;
+    GST_OBJECT_UNLOCK (downloader);
+    GST_DEBUG_OBJECT (downloader, "Signaling chain funtion");
+    g_cond_signal (downloader->priv->cond);
+  } else {
+    GST_OBJECT_UNLOCK (downloader);
+    GST_DEBUG_OBJECT (downloader,
+        "Trying to cancell a download that was alredy cancelled");
+  }
+}
+
+static gboolean
+gst_uri_downloader_set_uri (GstUriDownloader * downloader, const gchar * uri)
+{
+  GstPad *pad;
+
+  if (!gst_uri_is_valid (uri))
+    return FALSE;
+
+  if (downloader->priv->urisrc == NULL) {
+    GST_DEBUG_OBJECT (downloader, "Creating source element for the URI:%s", uri);
+    downloader->priv->urisrc = gst_element_make_from_uri (GST_URI_SRC, uri, NULL);
+    if (!downloader->priv->urisrc)
+      return FALSE;
+  } else {
+    GST_DEBUG_OBJECT (downloader, "Reusing existing source element for the URI:%s", uri);
+    if (!gst_uri_handler_set_uri (GST_URI_HANDLER (downloader->priv->urisrc), uri))
+      return FALSE;
+  }
+  g_object_set(downloader->priv->urisrc,"ahs-streaming", TRUE,NULL);
+
+  /* add a sync handler for the bus messages to detect errors in the download */
+  gst_element_set_bus (GST_ELEMENT (downloader->priv->urisrc),
+      downloader->priv->bus);
+  gst_bus_set_sync_handler (downloader->priv->bus,
+      gst_uri_downloader_bus_handler, downloader);
+
+  pad = gst_element_get_static_pad (downloader->priv->urisrc, "src");
+  if (!pad)
+    return FALSE;
+  gst_pad_link (pad, downloader->priv->pad);
+  gst_object_unref (pad);
+  return TRUE;
+}
+
+GstFragment *
+gst_uri_downloader_fetch_uri (GstUriDownloader * downloader, const gchar * uri)
+{
+  GstStateChangeReturn ret;
+  GstFragment *download = NULL;
+/* add setting UA,cookies */
+  gchar **cookies;
+
+  g_mutex_lock (downloader->priv->lock);
+
+  if (!gst_uri_downloader_set_uri (downloader, uri)) {
+    goto quit;
+  }
+
+  downloader->priv->download = gst_fragment_new ();
+
+  ret = gst_element_set_state (downloader->priv->urisrc, GST_STATE_PLAYING);
+  if (ret == GST_STATE_CHANGE_FAILURE) {
+    g_object_unref (downloader->priv->download);
+    downloader->priv->download = NULL;
+    goto quit;
+  }
+
+/* add setting UA,cookies */
+  g_object_set (downloader->priv->urisrc, "cookies", downloader->priv->cookies, NULL);
+  g_object_set (downloader->priv->urisrc, "user-agent", downloader->priv->user_agent, NULL);
+
+  /* wait until:
+   *   - the download succeed (EOS in the src pad)
+   *   - the download failed (Error message on the fetcher bus)
+   *   - the download was canceled
+   */
+  GST_DEBUG_OBJECT (downloader, "Waiting to fetch the URI");
+  g_cond_wait (downloader->priv->cond, downloader->priv->lock);
+
+/* add setting UA,cookies */
+  g_object_get (downloader->priv->urisrc, "cookies", &cookies, NULL);
+  gst_uri_downloader_set_cookies (downloader, cookies);
+
+  GST_OBJECT_LOCK (downloader);
+  download = downloader->priv->download;
+  downloader->priv->download = NULL;
+  GST_OBJECT_UNLOCK (downloader);
+
+  if (download != NULL)
+    GST_INFO_OBJECT (downloader, "URI fetched successfully");
+  else
+    GST_INFO_OBJECT (downloader, "Error fetching URI");
+
+quit:
+  {
+    gst_uri_downloader_stop (downloader);
+    g_mutex_unlock (downloader->priv->lock);
+    return download;
+  }
+}
+
+/* add setting UA,cookies */
+void
+gst_uri_downloader_set_user_agent (GstUriDownloader * downloader, gchar * user_agent)
+{
+  if (downloader->priv->user_agent)
+    g_free (downloader->priv->user_agent);
+
+  downloader->priv->user_agent = user_agent;
+}
+
+void
+gst_uri_downloader_set_cookies (GstUriDownloader * downloader, gchar ** cookies)
+{
+  if (downloader->priv->cookies)
+    g_strfreev (downloader->priv->cookies);
+
+  downloader->priv->cookies = cookies;
+}
diff --git a/wearable/dashdemux/src/gsturidownloader.h b/wearable/dashdemux/src/gsturidownloader.h
new file mode 100755 (executable)
index 0000000..20a870c
--- /dev/null
@@ -0,0 +1,66 @@
+/* GStreamer
+ * Copyright (C) 2011 Andoni Morales Alastruey <ylatuya@gmail.com>
+ *
+ * gsturidownloader.h:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * Youshould have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GSTURI_DOWNLOADER_H__
+#define __GSTURI_DOWNLOADER_H__
+
+#include <glib-object.h>
+#include <gst/gst.h>
+#include "gstfragment.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_URI_DOWNLOADER (gst_uri_downloader_get_type())
+#define GST_URI_DOWNLOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_URI_DOWNLOADER,GstUriDownloader))
+#define GST_URI_DOWNLOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_URI_DOWNLOADER,GstUriDownloaderClass))
+#define GST_IS_URI_DOWNLOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_URI_DOWNLOADER))
+#define GST_IS_URI_DOWNLOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_URI_DOWNLOADER))
+
+typedef struct _GstUriDownloader GstUriDownloader;
+typedef struct _GstUriDownloaderPrivate GstUriDownloaderPrivate;
+typedef struct _GstUriDownloaderClass GstUriDownloaderClass;
+
+struct _GstUriDownloader
+{
+  GstObject parent;
+
+  GstUriDownloaderPrivate *priv;
+};
+
+struct _GstUriDownloaderClass
+{
+  GstObjectClass parent_class;
+
+  /*< private >*/
+  gpointer _gst_reserved[GST_PADDING];
+};
+
+GType gst_uri_downloader_get_type (void);
+
+GstUriDownloader * gst_uri_downloader_new (void);
+GstFragment * gst_uri_downloader_fetch_uri (GstUriDownloader * downloader, const gchar * uri);
+void gst_uri_downloader_cancel (GstUriDownloader *downloader);
+/* add setting UA,cookies */
+void gst_uri_downloader_set_user_agent (GstUriDownloader * downloader, gchar * user_agent);
+void gst_uri_downloader_set_cookies (GstUriDownloader * downloader, gchar ** cookies);
+
+G_END_DECLS
+#endif /* __GSTURIDOWNLOADER_H__ */
diff --git a/wearable/depcomp b/wearable/depcomp
new file mode 100755 (executable)
index 0000000..04701da
--- /dev/null
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mecanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+       set fnord "$@"
+       shift
+       shift
+       ;;
+    *)
+       set fnord "$@" "$arg"
+       shift
+       shift
+       ;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::   \1 \\:p' >> "$depfile"
+  echo "       " >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/wearable/encodebin/Makefile.am b/wearable/encodebin/Makefile.am
new file mode 100644 (file)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/wearable/encodebin/src/Makefile.am b/wearable/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/wearable/encodebin/src/gstencodebin.c b/wearable/encodebin/src/gstencodebin.c
new file mode 100644 (file)
index 0000000..610a9de
--- /dev/null
@@ -0,0 +1,3371 @@
+/*
+ * 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);\
+      if(ret != GST_PAD_LINK_OK) { \
+            GstObject *src_parent = gst_pad_get_parent(srcpad);\
+            GstObject *sink_parent = gst_pad_get_parent(sinkpad);\
+            char *src_name = NULL;\
+            char *sink_name = NULL;\
+            g_object_get((GObject *)src_parent, "name", &src_name, NULL);\
+            g_object_get((GObject *)sink_parent, "name", &sink_name, NULL);\
+            GST_ERROR("src[%s] - sink[%s] link failed", src_name, sink_name);\
+            gst_object_unref(src_parent); src_parent = NULL;\
+            gst_object_unref(sink_parent); sink_parent = NULL;\
+            if (src_name) {\
+                  free(src_name); src_name = NULL;\
+            }\
+            if (sink_name) {\
+                  free(sink_name); sink_name = NULL;\
+            }\
+            gst_object_unref(srcpad); srcpad = NULL;\
+            gst_object_unref(sinkpad); sinkpad = NULL;\
+            goto if_fail_goto;\
+      }\
+      gst_object_unref(srcpad); srcpad = NULL;\
+      gst_object_unref(sinkpad); sinkpad = NULL;\
+}
+
+#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"
+#define DEFAULT_PROP_VCONV_NAME         "ffmpegcolorspace"
+
+/* 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,
+       PROP_VCONV_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,
+       PROP_VIDEO_CONV,
+       //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,
+       ENCODEBIN_ELEMENT_VIDEO_CONV
+}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;
+               case PROP_VCONV_NAME:
+                       g_value_set_string (value, encodebin->vconv_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_VIDEO_CONV:
+                       if(encodebin->color_space == NULL && (encodebin->profile != GST_ENCODE_BIN_PROFILE_AUDIO)) {
+                               encodebin->color_space = gst_element_factory_make (encodebin->vconv_name, "video_convert");
+                               if(encodebin->color_space != NULL)
+                                       gst_bin_add(GST_BIN(encodebin), encodebin->color_space);
+                       }
+                       g_value_set_object (value, encodebin->color_space);
+                       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;
+               }
+               case PROP_VCONV_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->color_space == NULL) {
+                               if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_VIDEO_CONV, new_name))
+                                       encodebin->vconv_name = g_strdup (new_name);
+                       } else {
+                               if(strcmp (encodebin->vconv_name, new_name)) {
+                                       gst_encode_bin_remove_element(encodebin, encodebin->color_space);
+                                       if(gst_encode_bin_add_element_by_name(encodebin, ENCODEBIN_ELEMENT_VIDEO_CONV, new_name))
+                                               encodebin->vconv_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_VIDEO_CONV: {
+                       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->color_space);
+                               encodebin->color_space = newelement;
+                               gst_object_ref (encodebin->color_space);
+                               gst_object_sink (GST_OBJECT_CAST (encodebin->color_space));
+                               gst_bin_add(GST_BIN(encodebin), encodebin->color_space);
+                       }
+                       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_VCONV_NAME,
+         g_param_spec_string ("vconv-name", "Video converter name", "the name of video color converter to use",
+             DEFAULT_PROP_VCONV_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_VIDEO_CONV,
+         g_param_spec_object ("video-convert", "Video converter",
+             "the video converter 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->vconv_name = g_strdup(DEFAULT_PROP_VCONV_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;
+
+       g_free(encodebin->vconv_name);
+       encodebin->vconv_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);
+                               encodebin->venc_name = NULL;
+                       } 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);
+                               encodebin->aenc_name = NULL;
+                       } 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);
+                               encodebin->ienc_name = NULL;
+                       } 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);
+                               encodebin->mux_name = NULL;
+                       } else {
+                               goto element_make_fail;
+                       }
+                       break;
+               case ENCODEBIN_ELEMENT_VIDEO_CONV:
+                       encodebin->color_space = gst_element_factory_make(name, "video_convert");
+                       if (encodebin->color_space != NULL) {
+                               gst_bin_add(GST_BIN(encodebin), encodebin->color_space);
+                               g_free(encodebin->vconv_name);
+                               encodebin->vconv_name = NULL;
+                       } 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_INFO_OBJECT (encodebin, "gst_encode_bin_remove_element");
+
+       if (element == NULL) {
+               GST_INFO_OBJECT (encodebin, "element is already 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)) {
+                               gchar *caps_str = NULL;
+                               caps_str = gst_caps_to_string(encodebin->vcaps);
+                               if (caps_str) {
+                                       GST_INFO_OBJECT(encodebin, "vconv caps [%s]", caps_str);
+                                       g_free(caps_str);
+                                       caps_str = NULL;
+                               }
+
+                               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 (encodebin->vconv_name, "video_convert");
+                                       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/wearable/encodebin/src/gstencodebin.h b/wearable/encodebin/src/gstencodebin.h
new file mode 100644 (file)
index 0000000..136fc92
--- /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;
+  gchar *vconv_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/wearable/evasimagesink/Makefile.am b/wearable/evasimagesink/Makefile.am
new file mode 100644 (file)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/wearable/evasimagesink/src/Makefile.am b/wearable/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/wearable/evasimagesink/src/gstevasimagesink.c b/wearable/evasimagesink/src/gstevasimagesink.c
new file mode 100644 (file)
index 0000000..9a2fbd4
--- /dev/null
@@ -0,0 +1,686 @@
+/*
+ * 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
+{
+       LAST_SIGNAL
+};
+
+enum
+{
+       PROP_0,
+       PROP_EVAS_OBJECT,
+       PROP_EVAS_OBJECT_SHOW
+};
+
+enum
+{
+       UPDATE_FALSE,
+       UPDATE_TRUE
+};
+
+#define COLOR_DEPTH 4
+#define GL_X11_ENGINE "gl_x11"
+#define DO_RENDER_FROM_FIMC 1
+#define SIZE_FOR_UPDATE_VISIBILITY sizeof(gchar)
+
+#define EVASIMAGESINK_SET_EVAS_OBJECT_EVENT_CALLBACK( x_evas_image_object, x_usr_data ) \
+do \
+{ \
+       if (x_evas_image_object) { \
+               evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_DEL, evas_callback_del_event, x_usr_data); \
+               evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_RESIZE, evas_callback_resize_event, x_usr_data); \
+       } \
+}while(0)
+
+#define EVASIMAGESINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK( x_evas_image_object ) \
+do \
+{ \
+       if (x_evas_image_object) { \
+               evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_DEL, evas_callback_del_event); \
+               evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_RESIZE, evas_callback_resize_event); \
+       } \
+}while(0)
+
+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_callback_del_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void evas_callback_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",
+               "Samsung Electronics <www.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_DEBUG ("[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;
+       }
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+static void
+evas_image_sink_cb_pipe (void *data, void *buffer, unsigned int nbyte)
+{
+       GstBuffer *buf;
+       GstEvasImageSink *esink = data;
+       void *img_data;
+
+       GST_DEBUG ("[ENTER]");
+
+       if (!esink || !esink->eo) {
+               return;
+       }
+       if (nbyte == SIZE_FOR_UPDATE_VISIBILITY) {
+               if(!esink->object_show) {
+                       evas_object_hide(esink->eo);
+                       GST_INFO ("object hide..");
+               } else {
+                       evas_object_show(esink->eo);
+                       GST_INFO ("object show..");
+               }
+               GST_DEBUG ("[LEAVE]");
+               return;
+       }
+       if (!buffer || nbyte != sizeof (GstBuffer *)) {
+               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);
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+static void
+gst_evas_image_sink_init (GstEvasImageSink *esink, GstEvasImageSinkClass *gclass)
+{
+       GST_DEBUG ("[ENTER]");
+
+       esink->eo = NULL;
+       esink->epipe = NULL;
+       esink->object_show = FALSE;
+       esink->update_visibility = UPDATE_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);
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+static void
+evas_callback_del_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       GST_DEBUG ("[ENTER]");
+
+       GstEvasImageSink *esink = data;
+       if (!esink) {
+               return;
+       }
+
+       EVASIMAGESINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK (esink->eo);
+       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;
+       }
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+static void
+evas_callback_resize_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       int w = 0;
+       int h = 0;
+
+       GST_DEBUG ("[ENTER]");
+
+       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);
+       }
+
+       GST_DEBUG ("[LEAVE]");
+}
+
+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 ***");
+                       EVASIMAGESINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK (esink->eo);
+                       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) {
+                               Eina_Bool r;
+
+                               /* delete evas object callbacks registrated on a previous evas image object */
+                               EVASIMAGESINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK (esink->eo);
+                               esink->eo = eo;
+                               /* add evas object callbacks on a new evas image object */
+                               EVASIMAGESINK_SET_EVAS_OBJECT_EVENT_CALLBACK (esink->eo, 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);
+                               esink->is_evas_object_size_set = FALSE;
+                               esink->object_show = TRUE;
+                               esink->update_visibility = UPDATE_TRUE;
+                               if (esink->epipe) {
+                                       r = ecore_pipe_write (esink->epipe, &esink->update_visibility, SIZE_FOR_UPDATE_VISIBILITY);
+                                       if (r == EINA_FALSE)  {
+                                               GST_WARNING ("Failed to ecore_pipe_write() for updating visibility\n");
+                                       }
+                               }
+                       }
+               } else {
+                       GST_ERROR ("Cannot set evas-object property: value is not an evas image object");
+               }
+               break;
+
+       case PROP_EVAS_OBJECT_SHOW:
+       {
+               Eina_Bool r;
+               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;
+               }
+               esink->update_visibility = UPDATE_TRUE;
+               if (esink->epipe) {
+                       r = ecore_pipe_write (esink->epipe, &esink->update_visibility, SIZE_FOR_UPDATE_VISIBILITY);
+                       if (r == EINA_FALSE)  {
+                               GST_WARNING ("Failed to ecore_pipe_write() for updating visibility)\n");
+                       }
+               }
+               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 ("ecore_pipe_write() was called with GST_BUFFER_DATA(buf):%x", GST_BUFFER_DATA(buf));
+       } 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/wearable/evasimagesink/src/gstevasimagesink.h b/wearable/evasimagesink/src/gstevasimagesink.h
new file mode 100644 (file)
index 0000000..09c8102
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * 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;
+       gchar update_visibility;
+       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/wearable/evaspixmapsink/Makefile.am b/wearable/evaspixmapsink/Makefile.am
new file mode 100644 (file)
index 0000000..f05ccbd
--- /dev/null
@@ -0,0 +1,15 @@
+plugin_LTLIBRARIES = libgstevaspixmapsink.la
+
+libgstevaspixmapsink_la_SOURCES = evaspixmapsink.c
+libgstevaspixmapsink_la_CFLAGS = $(GST_CFLAGS) $(X_CFLAGS) $(EFL_CFLAGS) $(MMTA_CFLAGS) \
+       $(XFIXES_CFLAGS) $(DRI2PROTO_CFLAGS) $(DRI2_CFLAGS) $(X11_CFLAGS) $(XDAMAGE_CFLAGS) $(XV_CFLAGS) $(TBM_CFLAGS)
+libgstevaspixmapsink_la_LIBADD = \
+       $(GST_LIBS) -lgstvideo-$(GST_MAJORMINOR) -lgstinterfaces-$(GST_MAJORMINOR) \
+       $(X_LIBS) $(XVIDEO_LIBS) $(XSHM_LIBS) $(LIBM) \
+       $(EFL_LIBS) \
+       $(MMTA_LIBS) \
+       $(XFIXES_LIBS) $(DRI2PROTO_LIBS) $(DRI2_LIBS) $(X11_LIBS) $(XDAMAGE_LIBS) $(XV_LIBS) $(TBM_LIBS)
+libgstevaspixmapsink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstxvimagesink_la_LIBTOOLFLAGS = --tag=disable-static
+
+noinst_HEADERS = evaspixmapsink.h
diff --git a/wearable/evaspixmapsink/evaspixmapsink.c b/wearable/evaspixmapsink/evaspixmapsink.c
new file mode 100644 (file)
index 0000000..6e1552c
--- /dev/null
@@ -0,0 +1,4358 @@
+/*
+ * EvasPixmapSink
+ *
+ * Copyright (c) 2000 - 2012 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
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* Our interfaces */
+#include <gst/interfaces/navigation.h>
+#include <gst/interfaces/colorbalance.h>
+#include <gst/interfaces/propertyprobe.h>
+/* Helper functions */
+#include <gst/video/video.h>
+
+/* Object header */
+#include "evaspixmapsink.h"
+
+#include <time.h>
+
+/* Samsung extension headers */
+/* For xv extension header for buffer transfer (output) */
+#include "xv_types.h"
+
+/* headers for drm */
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <X11/Xmd.h>
+#include <dri2/dri2.h>
+#include <libdrm/drm.h>
+#include <tbm_bufmgr.h>
+
+/* 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];
+       /* dma buf fd */
+       int dma_buf_fd[SCMN_IMGB_MAX_PLANE];
+       /* buffer share method */
+       int buf_share_method;
+       /* Y plane size in case of ST12 */
+       int y_size;
+       /* UV plane size in case of ST12 */
+       int uv_size;
+       /* Tizen buffer object */
+       void *bo[SCMN_IMGB_MAX_PLANE];
+       /* JPEG data */
+       void *jpeg_data;
+       /* JPEG size */
+       int jpeg_size;
+       /* TZ memory buffer */
+       int tz_enable;
+} SCMN_IMGB;
+
+/* Debugging category */
+#include <gst/gstinfo.h>
+GST_DEBUG_CATEGORY_STATIC (gst_debug_evaspixmapsink);
+#define GST_CAT_DEFAULT gst_debug_evaspixmapsink
+GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
+
+enum {
+    DEGREE_0,
+    DEGREE_90,
+    DEGREE_180,
+    DEGREE_270,
+    DEGREE_NUM,
+};
+
+enum {
+    DISP_GEO_METHOD_LETTER_BOX = 0,
+    DISP_GEO_METHOD_ORIGIN_SIZE,
+    DISP_GEO_METHOD_FULL_SCREEN,
+    DISP_GEO_METHOD_CROPPED_FULL_SCREEN,
+    DISP_GEO_METHOD_CUSTOM_ROI,
+    DISP_GEO_METHOD_NUM,
+};
+
+enum {
+    FLIP_NONE = 0,
+    FLIP_HORIZONTAL,
+    FLIP_VERTICAL,
+    FLIP_BOTH,
+    FLIP_NUM,
+};
+
+#define DEF_DISPLAY_GEOMETRY_METHOD                     DISP_GEO_METHOD_LETTER_BOX
+#define DEF_DISPLAY_FLIP                                FLIP_NONE
+#define GST_TYPE_EVASPIXMAPSINK_FLIP                    (gst_evaspixmapsink_flip_get_type())
+#define GST_TYPE_EVASPIXMAPSINK_ROTATE_ANGLE            (gst_evaspixmapsink_rotate_angle_get_type())
+#define GST_TYPE_EVASPIXMAPSINK_DISPLAY_GEOMETRY_METHOD (gst_evaspixmapsink_display_geometry_method_get_type())
+
+
+/* macro ******************************************************/
+#define EVASPIXMAPSINK_SET_PIXMAP_ID_TO_GEM_INFO( x_evaspixmapsink, x_pixmap_id ) \
+do \
+{ \
+       int i = 0; \
+       XV_DATA_PTR data = (XV_DATA_PTR)x_evaspixmapsink->evas_pixmap_buf->xvimage->data; \
+       if (data->YBuf > 0) { \
+               for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) { \
+                       if (evaspixmapsink->gem_info[i].gem_name == data->YBuf) { \
+                               evaspixmapsink->gem_info[i].ref_pixmap = x_pixmap_id; \
+                               GST_LOG_OBJECT (x_evaspixmapsink,"pixmap(%d) is marked at index(%d) of gem_info(YBuf)->gem_handle(%d)", x_pixmap_id, i, evaspixmapsink->gem_info[i].gem_handle); \
+                               break; \
+                       } \
+               } \
+       } \
+       if (data->CbBuf > 0) { \
+               for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) { \
+                       if (evaspixmapsink->gem_info[i].gem_name == data->CbBuf) { \
+                               evaspixmapsink->gem_info[i].ref_pixmap = x_pixmap_id; \
+                               GST_LOG_OBJECT (x_evaspixmapsink,"pixmap(%d) is marked at index(%d) of gem_info(CbBuf)->gem_handle(%d)", x_pixmap_id, i, evaspixmapsink->gem_info[i].gem_handle); \
+                               break; \
+                       } \
+               } \
+       } \
+       if (data->CrBuf > 0) { \
+               for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) { \
+                       if (evaspixmapsink->gem_info[i].gem_name == data->CrBuf) { \
+                               evaspixmapsink->gem_info[i].ref_pixmap = x_pixmap_id; \
+                               GST_LOG_OBJECT (x_evaspixmapsink,"pixmap(%d) is marked at index(%d) of gem_info(CrBuf)->gem_handle(%d)", x_pixmap_id, i, evaspixmapsink->gem_info[i].gem_handle); \
+                               break; \
+                       } \
+               } \
+       } \
+}while(0)
+
+#define EVASPIXMAPSINK_SET_EVAS_OBJECT_EVENT_CALLBACK( x_evas_image_object, x_usr_data ) \
+do \
+{ \
+       evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_DEL, evas_callback_del_event, x_usr_data); \
+       evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_RESIZE, evas_callback_resize_event, x_usr_data); \
+       evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_SHOW, evas_callback_show_event, x_usr_data); \
+       evas_object_event_callback_add (x_evas_image_object, EVAS_CALLBACK_HIDE, evas_callback_hide_event, x_usr_data); \
+}while(0)
+
+#define EVASPIXMAPSINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK( x_evas_image_object ) \
+do \
+{ \
+       evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_DEL, evas_callback_del_event); \
+       evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_RESIZE, evas_callback_resize_event); \
+       evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_SHOW, evas_callback_show_event); \
+       evas_object_event_callback_del (x_evas_image_object, EVAS_CALLBACK_HIDE, evas_callback_hide_event); \
+}while(0)
+
+static GType
+gst_evaspixmapsink_flip_get_type(void)
+{
+       static GType evaspixmapsink_flip_type = 0;
+       static const GEnumValue flip_type[] = {
+               { FLIP_NONE,       "Flip NONE", "FLIP_NONE"},
+               { FLIP_HORIZONTAL, "Flip HORIZONTAL", "FLIP_HORIZONTAL"},
+               { FLIP_VERTICAL,   "Flip VERTICAL", "FLIP_VERTICAL"},
+               { FLIP_BOTH,       "Flip BOTH", "FLIP_BOTH"},
+               { FLIP_NUM, NULL, NULL},
+       };
+
+       if (!evaspixmapsink_flip_type) {
+               evaspixmapsink_flip_type = g_enum_register_static("GstEvasPixmapSinkFlipType", flip_type);
+       }
+
+       return evaspixmapsink_flip_type;
+}
+
+static GType
+gst_evaspixmapsink_rotate_angle_get_type(void)
+{
+       static GType evaspixmapsink_rotate_angle_type = 0;
+       static const GEnumValue rotate_angle_type[] = {
+               { 0, "No rotate", "DEGREE_0"},
+               { 1, "Rotate 90 degree", "DEGREE_90"},
+               { 2, "Rotate 180 degree", "DEGREE_180"},
+               { 3, "Rotate 270 degree", "DEGREE_270"},
+               { 4, NULL, NULL},
+       };
+
+       if (!evaspixmapsink_rotate_angle_type) {
+               evaspixmapsink_rotate_angle_type = g_enum_register_static("GstEvasPixmapSinkRotateAngleType", rotate_angle_type);
+       }
+
+       return evaspixmapsink_rotate_angle_type;
+}
+
+static GType
+gst_evaspixmapsink_display_geometry_method_get_type(void)
+{
+       static GType evaspixmapsink_display_geometry_method_type = 0;
+       static const GEnumValue display_geometry_method_type[] = {
+               { 0, "Letter box", "LETTER_BOX"},
+               { 1, "Origin size", "ORIGIN_SIZE"},
+               { 2, "Full-screen", "FULL_SCREEN"},
+               { 3, "Cropped Full-screen", "CROPPED_FULL_SCREEN"},
+               { 4, "Explicitely described destination ROI", "CUSTOM_ROI"},
+               { 5, NULL, NULL},
+       };
+
+       if (!evaspixmapsink_display_geometry_method_type) {
+               evaspixmapsink_display_geometry_method_type = g_enum_register_static("GstEvasPixmapSinkDisplayGeometryMethodType", display_geometry_method_type);
+       }
+
+       return evaspixmapsink_display_geometry_method_type;
+}
+
+typedef struct
+{
+  unsigned long flags;
+  unsigned long functions;
+  unsigned long decorations;
+  long input_mode;
+  unsigned long status;
+}
+MotifWmHints, MwmHints;
+
+#define MWM_HINTS_DECORATIONS   (1L << 1)
+
+static void gst_evaspixmapsink_reset (GstEvasPixmapSink *evaspixmapsink);
+static GstBufferClass *evaspixmap_buffer_parent_class = NULL;
+static void gst_evaspixmap_buffer_finalize (GstEvasPixmapBuffer *evaspixmapbuf);
+static void gst_evaspixmapsink_xcontext_clear (GstEvasPixmapSink *evaspixmapsink);
+static void gst_evaspixmapsink_xpixmap_destroy (GstEvasPixmapSink *evaspixmapsink, GstXPixmap *xpixmap);
+static void gst_evaspixmapsink_xpixmap_update_geometry (GstEvasPixmapSink *evaspixmapsink, int idx);
+static gboolean gst_evaspixmap_buffer_put (GstEvasPixmapSink *evaspixmapsink, GstEvasPixmapBuffer *evaspixmapbuf);
+static gboolean gst_evaspixmapsink_xpixmap_link (GstEvasPixmapSink *evaspixmapsink);
+static void gst_evaspixmapsink_xpixmap_clear (GstEvasPixmapSink *evaspixmapsink, GstXPixmap *xpixmap);
+static gint gst_evaspixmapsink_get_format_from_caps (GstEvasPixmapSink *evaspixmapsink, GstCaps *caps);
+static void drm_close_gem(GstEvasPixmapSink *evaspixmapsink, unsigned int gem_handle);
+static void drm_fini_close_gem_handle(GstEvasPixmapSink *evaspixmapsink, Pixmap pixmap_id);
+static void evas_callback_resize_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void evas_callback_del_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void evas_callback_show_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void evas_callback_hide_event (void *data, Evas *e, Evas_Object *obj, void *event_info);
+
+/* Default template - initiated with class struct to allow gst-register to work
+   without X running */
+static GstStaticPadTemplate gst_evaspixmapsink_sink_template_factory =
+    GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("video/x-raw-rgb, "
+        "framerate = (fraction) [ 0, MAX ], "
+        "width = (int) [ 1, MAX ], "
+        "height = (int) [ 1, MAX ]; "
+        "video/x-raw-yuv, "
+        "framerate = (fraction) [ 0, MAX ], "
+        "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]")
+    );
+
+enum
+{
+  PROP_0,
+  PROP_CONTRAST,
+  PROP_BRIGHTNESS,
+  PROP_HUE,
+  PROP_SATURATION,
+  PROP_DISPLAY,
+  PROP_SYNCHRONOUS,
+  PROP_PIXEL_ASPECT_RATIO,
+  PROP_DEVICE,
+  PROP_DEVICE_NAME,
+  PROP_DOUBLE_BUFFER,
+  PROP_AUTOPAINT_COLORKEY,
+  PROP_COLORKEY,
+  PROP_PIXMAP_WIDTH,
+  PROP_PIXMAP_HEIGHT,
+  PROP_FLIP,
+  PROP_ROTATE_ANGLE,
+  PROP_DISPLAY_GEOMETRY_METHOD,
+  PROP_ZOOM,
+  PROP_DST_ROI_X,
+  PROP_DST_ROI_Y,
+  PROP_DST_ROI_W,
+  PROP_DST_ROI_H,
+  PROP_STOP_VIDEO,
+  PROP_EVAS_OBJECT,
+  PROP_VISIBLE,
+  PROP_ORIGIN_SIZE,
+};
+
+static GstVideoSinkClass *parent_class = NULL;
+
+/* ============================================================= */
+/*                                                               */
+/*                       Private Methods                         */
+/*                                                               */
+/* ============================================================= */
+
+/* evaspixmap buffers */
+
+#define GST_TYPE_EVASPIXMAP_BUFFER (gst_evaspixmap_buffer_get_type())
+
+#define GST_IS_EVASPIXMAP_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_EVASPIXMAP_BUFFER))
+#define GST_EVASPIXMAP_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_EVASPIXMAP_BUFFER, GstEvasPixmapBuffer))
+
+static int get_millis_time()
+{
+    struct timespec tp;
+    clock_gettime(CLOCK_MONOTONIC, &tp);
+    return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
+}
+
+static void
+ecore_pipe_callback_handler (void *data, void *buffer, unsigned int nbyte)
+{
+       GstEvasPixmapSink *evaspixmapsink = (GstEvasPixmapSink*)data;
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START] Evas_Object(0x%x)", evaspixmapsink->eo);
+       MMTA_ACUM_ITEM_BEGIN("evaspixmapsink - ecore thread cb : TOTAL", FALSE);
+       int i = 0;
+       guint idx = 0;
+       GstXPixmap *xpixmap = NULL;
+
+       if (!data ) {
+               GST_WARNING_OBJECT (evaspixmapsink,"data is NULL..");
+               return;
+       }
+       if (!evaspixmapsink->eo) {
+               GST_WARNING_OBJECT (evaspixmapsink,"evas object is NULL..");
+               return;
+       }
+       if (!evaspixmapsink->visible) {
+               GST_WARNING_OBJECT (evaspixmapsink,"visible is false..");
+               return;
+       }
+
+       /* mapping evas object with xpixmap */
+       if (evaspixmapsink->do_link) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"do link");
+               evas_object_image_size_set(evaspixmapsink->eo, evaspixmapsink->w, evaspixmapsink->h);
+               if (evaspixmapsink->xpixmap[idx]->pixmap) {
+                       Evas_Native_Surface surf;
+                       surf.version = EVAS_NATIVE_SURFACE_VERSION;
+                       surf.type = EVAS_NATIVE_SURFACE_X11;
+                       surf.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
+                       surf.data.x11.pixmap = evaspixmapsink->xpixmap[idx]->pixmap;
+                       __ta__("evaspixmapsink - ecore thread cb : _native_surface_set(LINK)", evas_object_image_native_surface_set(evaspixmapsink->eo, &surf); );
+                       evaspixmapsink->do_link = FALSE;
+               } else {
+                       GST_WARNING_OBJECT (evaspixmapsink,"pixmap is NULL..");
+                       return;
+               }
+               for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                       if (evaspixmapsink->xpixmap[i]->prev_pixmap && evaspixmapsink->xpixmap[i]->prev_gc && evaspixmapsink->prev_damage[i]) {
+                               GST_LOG_OBJECT (evaspixmapsink,"Free pixmap(%d), gc(%x), destroy previous damage(%d)",
+                                               evaspixmapsink->xpixmap[i]->prev_pixmap, evaspixmapsink->xpixmap[i]->prev_gc, evaspixmapsink->prev_damage[i]);
+                               g_mutex_lock (evaspixmapsink->x_lock);
+                               XFreePixmap(evaspixmapsink->xcontext->disp, evaspixmapsink->xpixmap[i]->prev_pixmap);
+                               XFreeGC (evaspixmapsink->xcontext->disp, evaspixmapsink->xpixmap[i]->prev_gc);
+                               XDamageDestroy(evaspixmapsink->xcontext->disp, evaspixmapsink->prev_damage[i]);
+                               XSync(evaspixmapsink->xcontext->disp, FALSE);
+                               g_mutex_unlock (evaspixmapsink->x_lock);
+                               evaspixmapsink->xpixmap[i]->prev_pixmap = 0;
+                               evaspixmapsink->xpixmap[i]->prev_gc = 0;
+                               evaspixmapsink->prev_damage[i] = NULL;
+                       }
+               }
+
+       } else {
+               GST_DEBUG_OBJECT (evaspixmapsink,"update");
+               /* update evas image object size */
+               if (evaspixmapsink->use_origin_size) {
+                       evas_object_geometry_get(evaspixmapsink->eo, NULL, NULL, &evaspixmapsink->w, &evaspixmapsink->h);
+               }
+
+               g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+
+               /* find a oldest damaged pixmap */
+               int temp_time = 0;
+               for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                       if (evaspixmapsink->last_updated_idx == i) {
+                               continue;
+                       } else {
+                               xpixmap = evaspixmapsink->xpixmap[i];
+                               if (xpixmap->ref > 0 && xpixmap->damaged_time) {
+                                       if (temp_time == 0) {
+                                               temp_time = xpixmap->damaged_time;
+                                               idx = i;
+                                       } else {
+                                               if (temp_time > xpixmap->damaged_time) {
+                                                       temp_time = xpixmap->damaged_time;
+                                                       idx = i;
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               xpixmap = evaspixmapsink->xpixmap[idx];
+               if (xpixmap->pixmap) {
+                       if (evaspixmapsink->last_updated_idx != idx) {
+                               Evas_Native_Surface surf;
+                               surf.version = EVAS_NATIVE_SURFACE_VERSION;
+                               surf.type = EVAS_NATIVE_SURFACE_X11;
+                               surf.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
+                               surf.data.x11.pixmap = xpixmap->pixmap;
+                               if (evaspixmapsink->eo) {
+                                       evas_object_image_native_surface_set(evaspixmapsink->eo, NULL);
+                               }
+                               __ta__("evaspixmapsink - ecore thread cb : _native_surface_set", evas_object_image_native_surface_set(evaspixmapsink->eo, &surf); );
+                               GST_LOG_OBJECT (evaspixmapsink,"update, native_surface_set of xpixmap[%d]",idx);
+                               if (evaspixmapsink->last_updated_idx == -1) {
+                                       xpixmap->damaged_time = 0;
+                                       GST_INFO_OBJECT (evaspixmapsink,"this is the first time to request to update(do not DECREASE ref-count) : pixmap(%d), refcount(%d), damaged_time(%d), idx(%d)",
+                                                                       xpixmap->pixmap, xpixmap->ref, xpixmap->damaged_time, idx);
+                               } else {
+                                       xpixmap = evaspixmapsink->xpixmap[evaspixmapsink->last_updated_idx];
+                                       xpixmap->ref--;
+                                       xpixmap->damaged_time = 0;
+                                       GST_INFO_OBJECT (evaspixmapsink,"pixmap ref-count DECREASED : pixmap(%d), refcount(%d), damaged_time(%d), idx(%d)",
+                                                                                       xpixmap->pixmap, xpixmap->ref, xpixmap->damaged_time, evaspixmapsink->last_updated_idx);
+                               }
+                               evaspixmapsink->last_updated_idx = idx;
+                       }
+
+                       MMTA_ACUM_ITEM_BEGIN("evaspixmapsink evas_object_image update", FALSE);
+                       evas_object_image_pixels_dirty_set (evaspixmapsink->eo, 1);
+                       evas_object_image_fill_set(evaspixmapsink->eo, 0, 0, evaspixmapsink->w, evaspixmapsink->h);
+                       evas_object_image_data_update_add(evaspixmapsink->eo, 0, 0, evaspixmapsink->w, evaspixmapsink->h);
+                       MMTA_ACUM_ITEM_END("evaspixmapsink evas_object_image update", FALSE);
+                       //GST_LOG_OBJECT (evaspixmapsink,"request to update : pixmap idx(%d), ref(%d)", idx, xpixmap->ref);
+               } else {
+                       GST_ERROR_OBJECT (evaspixmapsink,"pixmap is NULL..");
+               }
+               g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+       }
+
+       MMTA_ACUM_ITEM_END("evaspixmapsink - ecore thread cb : TOTAL", FALSE);
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+}
+
+static inline gboolean
+is_evas_image_object (Evas_Object *obj)
+{
+       const char *type;
+       if (!obj) {
+               GST_ERROR ("evas image object is NULL..");
+               return FALSE;
+       }
+       type = evas_object_type_get (obj);
+       if (!type) {
+               GST_ERROR ("could not find type of the evas object..");
+               return FALSE;
+       }
+       if (strcmp (type, "image") == 0) {
+               return TRUE;
+       }
+       return FALSE;
+}
+
+static void
+evas_callback_resize_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       int w = 0;
+       int h = 0;
+       float former_ratio = 0;
+       float ratio = 0;
+       float abs_margin = 0;
+       int i = 0;
+
+       GstEvasPixmapSink *evaspixmapsink = (GstEvasPixmapSink *)data;
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START] evas_image_object(%x), tid(%u)", obj, (unsigned int)pthread_self());
+
+       evas_object_geometry_get(evaspixmapsink->eo, NULL, NULL, &w, &h);
+       GST_DEBUG_OBJECT (evaspixmapsink,"resized : w(%d), h(%d)", w, h);
+       if (!evaspixmapsink->use_origin_size &&
+                       (evaspixmapsink->w != w || evaspixmapsink->h != h)) {
+               former_ratio = (float)evaspixmapsink->w / evaspixmapsink->h;
+               ratio = (float)w / h;
+               evaspixmapsink->w = w;
+               evaspixmapsink->h = h;
+
+#ifdef COMPARE_RATIO
+               GST_DEBUG_OBJECT (evaspixmapsink,"resized : ratio(%.3f=>%.3f)", former_ratio, ratio);
+               if ( former_ratio >= ratio ) {
+                       abs_margin = former_ratio - ratio;
+               } else {
+                       abs_margin = ratio - former_ratio;
+               }
+               /* re-link_pixmap can only be set when ratio is changed */
+               if ( abs_margin >= MARGIN_OF_ERROR ) {
+#endif
+                       if (!gst_evaspixmapsink_xpixmap_link(evaspixmapsink)) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                               return;
+                       }
+                       for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) {
+                               if (evaspixmapsink->gem_info[i].ref_pixmap > 0) {
+                                       GST_LOG_OBJECT (evaspixmapsink,"set ref_pixmap(%d) to 0 in gem_info[%d]", evaspixmapsink->gem_info[i].ref_pixmap, i);
+                                       evaspixmapsink->gem_info[i].ref_pixmap = 0;
+                               }
+                       }
+#ifdef COMPARE_RATIO
+               }
+#endif
+       }
+
+       if (GST_STATE(evaspixmapsink) == GST_STATE_PAUSED) {
+               gst_evaspixmap_buffer_put (evaspixmapsink, evaspixmapsink->evas_pixmap_buf);
+       }
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+}
+
+static void
+evas_callback_del_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       GstEvasPixmapSink *evaspixmapsink = data;
+       if (!evaspixmapsink) {
+               GST_WARNING ("evaspixmapsink is NULL..");
+               return;
+       }
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START]");
+
+       EVASPIXMAPSINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK( evaspixmapsink->eo );
+       if (evaspixmapsink->eo) {
+               evas_object_image_native_surface_set(evaspixmapsink->eo, NULL);
+               evaspixmapsink->eo = NULL;
+       }
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+}
+
+static void
+evas_callback_show_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       GstEvasPixmapSink *evaspixmapsink = (GstEvasPixmapSink *)data;
+       GST_INFO_OBJECT (evaspixmapsink,"show evas_image_object(%x) from pid(%d), tid(%u)", obj, getpid(), (unsigned int)pthread_self());
+}
+
+static void
+evas_callback_hide_event (void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       GstEvasPixmapSink *evaspixmapsink = (GstEvasPixmapSink *)data;
+       GST_INFO_OBJECT (evaspixmapsink,"hide evas_image_object(%x) from pid(%d), tid(%u)", obj, getpid(), (unsigned int)pthread_self());
+}
+
+/* X11 stuff */
+static gboolean error_caught = FALSE;
+
+static int
+gst_evaspixmapsink_handle_xerror (Display * display, XErrorEvent * xevent)
+{
+  char error_msg[1024];
+
+  XGetErrorText (display, xevent->error_code, error_msg, 1024);
+  GST_DEBUG ("evaspixmapsink triggered an XError. error: %s", error_msg);
+  error_caught = TRUE;
+  return 0;
+}
+
+#ifdef HAVE_XSHM
+/* This function checks that it is actually really possible to create an image
+   using XShm */
+static gboolean
+gst_evaspixmapsink_check_xshm_calls (GstXContext * xcontext)
+{
+  XvImage *xvimage;
+  XShmSegmentInfo SHMInfo;
+  gint size;
+  int (*handler) (Display *, XErrorEvent *);
+  gboolean result = FALSE;
+  gboolean did_attach = FALSE;
+
+  g_return_val_if_fail (xcontext != NULL, FALSE);
+
+  /* Sync to ensure any older errors are already processed */
+  XSync (xcontext->disp, FALSE);
+
+  /* Set defaults so we don't free these later unnecessarily */
+  SHMInfo.shmaddr = ((void *) -1);
+  SHMInfo.shmid = -1;
+
+  /* Setting an error handler to catch failure */
+  error_caught = FALSE;
+  handler = XSetErrorHandler (gst_evaspixmapsink_handle_xerror);
+
+  /* Trying to create a 1x1 picture */
+  GST_DEBUG ("XvShmCreateImage of 1x1");
+  xvimage = XvShmCreateImage (xcontext->disp, xcontext->xv_port_id,
+      xcontext->im_format, NULL, 1, 1, &SHMInfo);
+
+  /* Might cause an error, sync to ensure it is noticed */
+  XSync (xcontext->disp, FALSE);
+  if (!xvimage || error_caught) {
+    GST_WARNING ("could not XvShmCreateImage a 1x1 image");
+    goto beach;
+  }
+  size = xvimage->data_size;
+
+  SHMInfo.shmid = shmget (IPC_PRIVATE, size, IPC_CREAT | 0777);
+  if (SHMInfo.shmid == -1) {
+    GST_WARNING ("could not get shared memory of %d bytes", size);
+    goto beach;
+  }
+
+  SHMInfo.shmaddr = shmat (SHMInfo.shmid, NULL, 0);
+  if (SHMInfo.shmaddr == ((void *) -1)) {
+    GST_WARNING ("Failed to shmat: %s", g_strerror (errno));
+    /* Clean up the shared memory segment */
+    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+
+  xvimage->data = SHMInfo.shmaddr;
+  SHMInfo.readOnly = FALSE;
+
+  if (XShmAttach (xcontext->disp, &SHMInfo) == 0) {
+    GST_WARNING ("Failed to XShmAttach");
+    /* Clean up the shared memory segment */
+    shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+    goto beach;
+  }
+
+  /* Sync to ensure we see any errors we caused */
+  XSync (xcontext->disp, FALSE);
+
+  /* Delete the shared memory segment as soon as everyone is attached.
+   * This way, it will be deleted as soon as we detach later, and not
+   * leaked if we crash. */
+  shmctl (SHMInfo.shmid, IPC_RMID, NULL);
+
+  if (!error_caught) {
+    GST_DEBUG ("XServer ShmAttached to 0x%x, id 0x%lx", SHMInfo.shmid,
+        SHMInfo.shmseg);
+
+    did_attach = TRUE;
+    /* store whether we succeeded in result */
+    result = TRUE;
+  } else {
+    GST_WARNING ("MIT-SHM extension check failed at XShmAttach. "
+        "Not using shared memory.");
+  }
+
+beach:
+  /* Sync to ensure we swallow any errors we caused and reset error_caught */
+  XSync (xcontext->disp, FALSE);
+
+  error_caught = FALSE;
+  XSetErrorHandler (handler);
+
+  if (did_attach) {
+    GST_DEBUG ("XServer ShmDetaching from 0x%x id 0x%lx",
+        SHMInfo.shmid, SHMInfo.shmseg);
+    XShmDetach (xcontext->disp, &SHMInfo);
+    XSync (xcontext->disp, FALSE);
+  }
+  if (SHMInfo.shmaddr != ((void *) -1))
+    shmdt (SHMInfo.shmaddr);
+  if (xvimage)
+    XFree (xvimage);
+  return result;
+}
+#endif /* HAVE_XSHM */
+
+/* This function destroys a GstEvasPixmap handling XShm availability */
+static void
+gst_evaspixmap_buffer_destroy (GstEvasPixmapBuffer *evaspixmapbuf)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+
+       evaspixmapsink = evaspixmapbuf->evaspixmapsink;
+       if (G_UNLIKELY (evaspixmapsink == NULL)) {
+               goto no_sink;
+       }
+       GST_DEBUG_OBJECT (evaspixmapsink, "Destroying buffer");
+
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+       GST_OBJECT_LOCK (evaspixmapsink);
+
+       /* We might have some buffers destroyed after changing state to NULL */
+       if (evaspixmapsink->xcontext == NULL) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Destroying XvImage after Xcontext");
+#ifdef HAVE_XSHM
+               /* Need to free the shared memory segment even if the x context
+               * was already cleaned up */
+               if (evaspixmapbuf->SHMInfo.shmaddr != ((void *) -1)) {
+                       shmdt (evaspixmapbuf->SHMInfo.shmaddr);
+               }
+#endif
+               goto beach;
+       }
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+#ifdef HAVE_XSHM
+       if (evaspixmapsink->xcontext->use_xshm) {
+               if (evaspixmapbuf->SHMInfo.shmaddr != ((void *) -1)) {
+                       GST_DEBUG_OBJECT (evaspixmapsink,"XServer ShmDetaching from 0x%x id 0x%lx", evaspixmapbuf->SHMInfo.shmid, evaspixmapbuf->SHMInfo.shmseg);
+                       XShmDetach (evaspixmapsink->xcontext->disp, &evaspixmapbuf->SHMInfo);
+                       XSync (evaspixmapsink->xcontext->disp, FALSE);
+                       shmdt (evaspixmapbuf->SHMInfo.shmaddr);
+               }
+               if (evaspixmapbuf->xvimage)
+               XFree (evaspixmapbuf->xvimage);
+       } else
+#endif /* HAVE_XSHM */
+       {
+               if (evaspixmapbuf->xvimage) {
+                       if (evaspixmapbuf->xvimage->data) {
+                               g_free (evaspixmapbuf->xvimage->data);
+                       }
+                       XFree (evaspixmapbuf->xvimage);
+               }
+       }
+
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+beach:
+       GST_OBJECT_UNLOCK (evaspixmapsink);
+       evaspixmapbuf->evaspixmapsink = NULL;
+       gst_object_unref (evaspixmapsink);
+
+       GST_MINI_OBJECT_CLASS (evaspixmap_buffer_parent_class)->finalize (GST_MINI_OBJECT(evaspixmapbuf));
+
+       return;
+
+       no_sink:
+       {
+               GST_WARNING ("no sink found");
+               return;
+       }
+}
+
+static void
+gst_evaspixmap_buffer_finalize (GstEvasPixmapBuffer *evaspixmapbuf)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+
+       evaspixmapsink = evaspixmapbuf->evaspixmapsink;
+       if (G_UNLIKELY (evaspixmapsink == NULL)) {
+               GST_WARNING_OBJECT (evaspixmapsink,"no sink found");
+               return;
+       }
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+        /* If our geometry changed we can't reuse that image. */
+       GST_LOG_OBJECT (evaspixmapsink,"destroy image as sink is shutting down");
+       gst_evaspixmap_buffer_destroy (evaspixmapbuf);
+}
+
+static void
+gst_evaspixmap_buffer_free (GstEvasPixmapBuffer *evaspixmapbuf)
+{
+  /* make sure it is not recycled */
+  evaspixmapbuf->width = -1;
+  evaspixmapbuf->height = -1;
+  gst_buffer_unref (GST_BUFFER (evaspixmapbuf));
+}
+
+static void
+gst_evaspixmap_buffer_init (GstEvasPixmapBuffer *evaspixmapbuf, gpointer g_class)
+{
+#ifdef HAVE_XSHM
+  evaspixmapbuf->SHMInfo.shmaddr = ((void *) -1);
+  evaspixmapbuf->SHMInfo.shmid = -1;
+#endif
+}
+
+static void
+gst_evaspixmap_buffer_class_init (gpointer g_class, gpointer class_data)
+{
+  GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
+
+  evaspixmap_buffer_parent_class = g_type_class_peek_parent (g_class);
+
+  mini_object_class->finalize = (GstMiniObjectFinalizeFunction) gst_evaspixmap_buffer_finalize;
+}
+
+static GType
+gst_evaspixmap_buffer_get_type (void)
+{
+  static GType _gst_evaspixmap_buffer_type;
+
+  if (G_UNLIKELY (_gst_evaspixmap_buffer_type == 0)) {
+    static const GTypeInfo evaspixmap_buffer_info = {
+      sizeof (GstBufferClass),
+      NULL,
+      NULL,
+      gst_evaspixmap_buffer_class_init,
+      NULL,
+      NULL,
+      sizeof (GstEvasPixmapBuffer),
+      0,
+      (GInstanceInitFunc) gst_evaspixmap_buffer_init,
+      NULL
+    };
+    _gst_evaspixmap_buffer_type = g_type_register_static (GST_TYPE_BUFFER,
+        "GstEvasPixmapBuffer", &evaspixmap_buffer_info, 0);
+  }
+  return _gst_evaspixmap_buffer_type;
+}
+
+/* This function handles GstEvasPixmapBuffer creation depending on XShm availability */
+static GstEvasPixmapBuffer*
+gst_evaspixmap_buffer_new (GstEvasPixmapSink *evaspixmapsink, GstCaps *caps)
+{
+       GstEvasPixmapBuffer *evaspixmapbuf = NULL;
+       GstStructure *structure = NULL;
+       gboolean succeeded = FALSE;
+       int (*handler) (Display *, XErrorEvent *);
+
+       g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), NULL);
+
+       if (caps == NULL) {
+               return NULL;
+       }
+
+       evaspixmapbuf = (GstEvasPixmapBuffer*) gst_mini_object_new (GST_TYPE_EVASPIXMAP_BUFFER);
+       GST_DEBUG_OBJECT (evaspixmapsink,"Creating new EvasPixmapBuffer");
+
+       structure = gst_caps_get_structure (caps, 0);
+
+       if (!gst_structure_get_int (structure, "width", &evaspixmapbuf->width) || !gst_structure_get_int (structure, "height", &evaspixmapbuf->height)) {
+               GST_WARNING_OBJECT (evaspixmapsink,"failed getting geometry from caps %" GST_PTR_FORMAT, caps);
+       }
+
+       GST_LOG_OBJECT (evaspixmapsink,"creating %dx%d", evaspixmapbuf->width, evaspixmapbuf->height);
+
+       GST_LOG_OBJECT (evaspixmapsink,"aligned size %dx%d", evaspixmapsink->aligned_width, evaspixmapsink->aligned_height);
+       if (evaspixmapsink->aligned_width == 0 || evaspixmapsink->aligned_height == 0) {
+               GST_INFO_OBJECT (evaspixmapsink,"aligned size is zero. set size of caps.");
+               evaspixmapsink->aligned_width = evaspixmapbuf->width;
+               evaspixmapsink->aligned_height = evaspixmapbuf->height;
+       }
+
+       evaspixmapbuf->im_format = gst_evaspixmapsink_get_format_from_caps (evaspixmapsink, caps);
+       if (evaspixmapbuf->im_format == -1) {
+               GST_WARNING_OBJECT (evaspixmapsink,"failed to get format from caps %"GST_PTR_FORMAT, caps);
+               GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,("Failed to create output image buffer of %dx%d pixels",
+                                  evaspixmapbuf->width, evaspixmapbuf->height), ("Invalid input caps"));
+               goto beach_unlocked;
+       }
+
+       GST_INFO_OBJECT (evaspixmapsink, "FOURCC format : %c%c%c%c", evaspixmapbuf->im_format, evaspixmapbuf->im_format>>8,
+                       evaspixmapbuf->im_format>>16, evaspixmapbuf->im_format>>24);
+
+       evaspixmapbuf->evaspixmapsink = gst_object_ref (evaspixmapsink);
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+       /* Sync to ensure we swallow any errors we caused and reset error_caught */
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       /* Setting an error handler to catch failure */
+       error_caught = FALSE;
+       handler = XSetErrorHandler (gst_evaspixmapsink_handle_xerror);
+
+#ifdef HAVE_XSHM
+       if (evaspixmapsink->xcontext->use_xshm) {
+               int expected_size;
+               evaspixmapbuf->xvimage = XvShmCreateImage (evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, evaspixmapbuf->im_format, NULL,
+               evaspixmapsink->aligned_width, evaspixmapsink->aligned_height, &evaspixmapbuf->SHMInfo);
+               if (!evaspixmapbuf->xvimage || error_caught) {
+                       if (error_caught) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"error_caught!");
+                       }
+                       if(!evaspixmapbuf->xvimage) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"XvShmCreateImage() failed");
+                       }
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       /* Reset error handler */
+                       error_caught = FALSE;
+                       XSetErrorHandler (handler);
+                       /* Push an error */
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,("Failed to create output image buffer of %dx%d pixels",evaspixmapbuf->width,
+                                  evaspixmapbuf->height),("could not XvShmCreateImage a %dx%d image",evaspixmapbuf->width, evaspixmapbuf->height));
+                       goto beach_unlocked;
+               }
+
+               /* we have to use the returned data_size for our shm size */
+               evaspixmapbuf->size = evaspixmapbuf->xvimage->data_size;
+               GST_LOG_OBJECT (evaspixmapsink,"XShm image size is %" G_GSIZE_FORMAT, evaspixmapbuf->size);
+
+               /* calculate the expected size.  This is only for sanity checking the
+               * number we get from X. */
+               switch (evaspixmapbuf->im_format) {
+               case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+               case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
+               {
+                       gint pitches[3];
+                       gint offsets[3];
+                       guint plane;
+
+                       offsets[0] = 0;
+                       pitches[0] = GST_ROUND_UP_4 (evaspixmapbuf->width);
+                       offsets[1] = offsets[0] + pitches[0] * GST_ROUND_UP_2 (evaspixmapbuf->height);
+                       pitches[1] = GST_ROUND_UP_8 (evaspixmapbuf->width) / 2;
+                       offsets[2] =
+                       offsets[1] + pitches[1] * GST_ROUND_UP_2 (evaspixmapbuf->height) / 2;
+                       pitches[2] = GST_ROUND_UP_8 (pitches[0]) / 2;
+
+                       expected_size = offsets[2] + pitches[2] * GST_ROUND_UP_2 (evaspixmapbuf->height) / 2;
+
+                       for (plane = 0; plane < evaspixmapbuf->xvimage->num_planes; plane++) {
+                               GST_DEBUG_OBJECT (evaspixmapsink,"Plane %u has a expected pitch of %d bytes, " "offset of %d",
+                                               plane, pitches[plane], offsets[plane]);
+                       }
+                       break;
+               }
+               case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
+               case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
+                       expected_size = evaspixmapbuf->height * GST_ROUND_UP_4 (evaspixmapbuf->width * 2);
+                       break;
+               case GST_MAKE_FOURCC ('S', 'T', '1', '2'):
+               case GST_MAKE_FOURCC ('S', 'N', '1', '2'):
+               case GST_MAKE_FOURCC ('S', 'U', 'Y', 'V'):
+               case GST_MAKE_FOURCC ('S', 'U', 'Y', '2'):
+               case GST_MAKE_FOURCC ('S', '4', '2', '0'):
+               case GST_MAKE_FOURCC ('S', 'Y', 'V', 'Y'):
+               case GST_MAKE_FOURCC ('I', 'T', 'L', 'V'):
+               case GST_MAKE_FOURCC ('S', 'R', '3', '2'):
+                       expected_size = sizeof(SCMN_IMGB);
+                       break;
+               default:
+                       expected_size = 0;
+                       break;
+               }
+               if (expected_size != 0 && evaspixmapbuf->size != expected_size) {
+                       GST_WARNING_OBJECT (evaspixmapsink,"unexpected XShm image size (got %" G_GSIZE_FORMAT ", expected %d)", evaspixmapbuf->size, expected_size);
+               }
+
+               /* Be verbose about our XvImage stride */
+               {
+                       guint plane;
+                       for (plane = 0; plane < evaspixmapbuf->xvimage->num_planes; plane++) {
+                               GST_DEBUG_OBJECT (evaspixmapsink,"Plane %u has a pitch of %d bytes, ""offset of %d", plane,
+                                               evaspixmapbuf->xvimage->pitches[plane], evaspixmapbuf->xvimage->offsets[plane]);
+                       }
+               }
+
+               evaspixmapbuf->SHMInfo.shmid = shmget (IPC_PRIVATE, evaspixmapbuf->size,IPC_CREAT | 0777);
+               if (evaspixmapbuf->SHMInfo.shmid == -1) {
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,
+                               ("Failed to create output image buffer of %dx%d pixels", evaspixmapbuf->width, evaspixmapbuf->height),
+                               ("could not get shared memory of %" G_GSIZE_FORMAT " bytes",evaspixmapbuf->size));
+                       goto beach_unlocked;
+               }
+
+               evaspixmapbuf->SHMInfo.shmaddr = shmat (evaspixmapbuf->SHMInfo.shmid, NULL, 0);
+               if (evaspixmapbuf->SHMInfo.shmaddr == ((void *) -1)) {
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,
+                               ("Failed to create output image buffer of %dx%d pixels",
+                               evaspixmapbuf->width, evaspixmapbuf->height),
+                               ("Failed to shmat: %s", g_strerror (errno)));
+                       /* Clean up the shared memory segment */
+                       shmctl (evaspixmapbuf->SHMInfo.shmid, IPC_RMID, NULL);
+                       goto beach_unlocked;
+               }
+
+               evaspixmapbuf->xvimage->data = evaspixmapbuf->SHMInfo.shmaddr;
+               evaspixmapbuf->SHMInfo.readOnly = FALSE;
+
+               if (XShmAttach (evaspixmapsink->xcontext->disp, &evaspixmapbuf->SHMInfo) == 0) {
+               /* Clean up the shared memory segment */
+               shmctl (evaspixmapbuf->SHMInfo.shmid, IPC_RMID, NULL);
+
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,
+                       ("Failed to create output image buffer of %dx%d pixels",
+                       evaspixmapbuf->width, evaspixmapbuf->height), ("Failed to XShmAttach"));
+               goto beach_unlocked;
+               }
+
+               XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+               /* Delete the shared memory segment as soon as we everyone is attached.
+               * This way, it will be deleted as soon as we detach later, and not
+               * leaked if we crash. */
+               shmctl (evaspixmapbuf->SHMInfo.shmid, IPC_RMID, NULL);
+
+               GST_DEBUG_OBJECT (evaspixmapsink,"XServer ShmAttached to 0x%x, id 0x%lx", evaspixmapbuf->SHMInfo.shmid, evaspixmapbuf->SHMInfo.shmseg);
+       } else
+#endif /* HAVE_XSHM */
+       {
+               evaspixmapbuf->xvimage = XvCreateImage (evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id,
+               evaspixmapbuf->im_format, NULL, evaspixmapsink->aligned_width, evaspixmapsink->aligned_height);
+               if (!evaspixmapbuf->xvimage || error_caught) {
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       /* Reset error handler */
+                       error_caught = FALSE;
+                       XSetErrorHandler (handler);
+                       /* Push an error */
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE,
+                               ("Failed to create outputimage buffer of %dx%d pixels",
+                               evaspixmapbuf->width, evaspixmapbuf->height),
+                               ("could not XvCreateImage a %dx%d image",
+                               evaspixmapbuf->width, evaspixmapbuf->height));
+                       goto beach_unlocked;
+               }
+
+               /* we have to use the returned data_size for our image size */
+               evaspixmapbuf->size = evaspixmapbuf->xvimage->data_size;
+               evaspixmapbuf->xvimage->data = g_malloc (evaspixmapbuf->size);
+
+               XSync (evaspixmapsink->xcontext->disp, FALSE);
+       }
+
+       /* Reset error handler */
+       error_caught = FALSE;
+       XSetErrorHandler (handler);
+
+       succeeded = TRUE;
+
+       GST_BUFFER_DATA (evaspixmapbuf) = (guchar *) evaspixmapbuf->xvimage->data;
+       GST_BUFFER_SIZE (evaspixmapbuf) = evaspixmapbuf->size;
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+beach_unlocked:
+       if (!succeeded) {
+               gst_evaspixmap_buffer_free (evaspixmapbuf);
+               evaspixmapbuf = NULL;
+       }
+
+       return evaspixmapbuf;
+}
+
+/* This function puts a GstEvasPixmapBuffer on a GstEvasPixmapSink's pixmap. Returns FALSE
+ * if no pixmap was available  */
+static gboolean
+gst_evaspixmap_buffer_put (GstEvasPixmapSink *evaspixmapsink, GstEvasPixmapBuffer *evaspixmapbuf)
+{
+       GstVideoRectangle result;
+
+       GstVideoRectangle src_origin = { 0, 0, 0, 0};
+       GstVideoRectangle src_input  = { 0, 0, 0, 0};
+       GstVideoRectangle src = { 0, 0, 0, 0};
+       GstVideoRectangle dst = { 0, 0, 0, 0};
+       int rotate = 0;
+       int ret = 0;
+       int idx = 0;
+       GstXPixmap *xpixmap = NULL;
+
+       MMTA_ACUM_ITEM_BEGIN("evaspixmapsink evaspixmap_buffer_put()", FALSE);
+
+       /* We take the flow_lock. If expose is in there we don't want to run
+       concurrently from the data flow thread */
+       g_mutex_lock (evaspixmapsink->flow_lock);
+
+       if (G_UNLIKELY (evaspixmapsink->xpixmap[idx] == NULL)) {
+               GST_WARNING_OBJECT (evaspixmapsink, "xpixmap is NULL. Skip buffer_put." );
+               g_mutex_unlock(evaspixmapsink->flow_lock);
+               return FALSE;
+       }
+       if (evaspixmapsink->visible == FALSE) {
+               GST_WARNING_OBJECT (evaspixmapsink, "visible is FALSE. Skip buffer_put." );
+               g_mutex_unlock(evaspixmapsink->flow_lock);
+               return TRUE;
+       }
+       if (!evaspixmapbuf) {
+               GST_WARNING_OBJECT (evaspixmapsink, "evaspixmapbuf is NULL. Skip buffer_put." );
+               g_mutex_unlock(evaspixmapsink->flow_lock);
+               return TRUE;
+       }
+
+       g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+       if (evaspixmapsink->last_updated_idx == -1) {
+               /* if it has never been updated any frame in Ecore thread, do below */
+               idx = 0;
+               xpixmap = evaspixmapsink->xpixmap[idx];
+               xpixmap->ref = 1;
+               GST_LOG_OBJECT (evaspixmapsink, "last_updated_idx(%d), we use index[%d] of pixmap buffers : pixmap(%d), ref(%d)",
+                               evaspixmapsink->last_updated_idx, idx, xpixmap->pixmap, xpixmap->ref);
+       } else {
+               for (idx = 0; idx < evaspixmapsink->num_of_pixmaps; idx++) {
+                       if (idx == evaspixmapsink->last_updated_idx) {
+                               continue;
+                       } else {
+                               xpixmap = evaspixmapsink->xpixmap[idx];
+                               if (xpixmap->ref == 0 && xpixmap->damaged_time == 0) {
+                                       xpixmap->ref++;
+                                       GST_LOG_OBJECT (evaspixmapsink, "found an available pixmap(%d) : xpixmap[%d]", xpixmap->pixmap, idx);
+                                       GST_INFO_OBJECT (evaspixmapsink,"pixmap ref-count INCREASED : pixmap(%d), refcount(%d)", xpixmap->pixmap, xpixmap->ref);
+                                       break;
+                               }
+                       }
+               }
+               if (idx == evaspixmapsink->num_of_pixmaps) {
+                       GST_LOG_OBJECT (evaspixmapsink, "Could not find a pixmap with idle state, skip buffer_put." );
+                       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+                       g_mutex_unlock(evaspixmapsink->flow_lock);
+                       return TRUE;
+               }
+       }
+       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+
+       gst_evaspixmapsink_xpixmap_update_geometry(evaspixmapsink, idx);
+
+       src.x = src.y = 0;
+       src_origin.x = src_origin.y = src_input.x = src_input.y = 0;
+       src_input.w = src_origin.w = evaspixmapsink->video_width;
+       src_input.h = src_origin.h = evaspixmapsink->video_height;
+       if (evaspixmapsink->use_origin_size ||
+               (evaspixmapsink->rotate_angle == DEGREE_0 ||
+               evaspixmapsink->rotate_angle == DEGREE_180)) {
+               src.w = src_origin.w;
+               src.h = src_origin.h;
+       } else {
+               src.w = src_origin.h;
+               src.h = src_origin.w;
+       }
+
+       dst.w = evaspixmapsink->render_rect.w; /* pixmap width */
+       dst.h = evaspixmapsink->render_rect.h; /* pixmap height */
+
+       if (!evaspixmapsink->use_origin_size) {
+               static Atom atom_rotation = None;
+               static Atom atom_hflip = None;
+               static Atom atom_vflip = None;
+               gboolean set_hflip = FALSE;
+               gboolean set_vflip = FALSE;
+
+               /* compensation of size information (between evas image object's and pixmap's) */
+               if (evaspixmapsink->sizediff_width > 1) {
+                       if (evaspixmapsink->sizediff_height > 1) {
+                               dst.w -= (evaspixmapsink->sizediff_width >> 1) << 1;
+                               dst.h -= (evaspixmapsink->sizediff_height >> 1) << 1;
+                       } else {
+                               dst.w -= (evaspixmapsink->sizediff_width >> 1) << 1;
+                       }
+               } else if (evaspixmapsink->sizediff_height > 1) {
+                       dst.h -= (evaspixmapsink->sizediff_height >> 1) << 1;
+               }
+
+               switch (evaspixmapsink->display_geometry_method) {
+               case DISP_GEO_METHOD_LETTER_BOX:
+                       gst_video_sink_center_rect (src, dst, &result, TRUE);
+                       result.x += evaspixmapsink->render_rect.x;
+                       result.y += evaspixmapsink->render_rect.y;
+                       GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : letter box");
+                       break;
+               case DISP_GEO_METHOD_ORIGIN_SIZE:
+                       gst_video_sink_center_rect (src, dst, &result, FALSE);
+                       gst_video_sink_center_rect (dst, src, &src_input, FALSE);
+                       GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : origin size");
+                       if (evaspixmapsink->rotate_angle == DEGREE_90 ||
+                               evaspixmapsink->rotate_angle == DEGREE_270) {
+                               src_input.x = src_input.x ^ src_input.y;
+                               src_input.y = src_input.x ^ src_input.y;
+                               src_input.x = src_input.x ^ src_input.y;
+                               src_input.w = src_input.w ^ src_input.h;
+                               src_input.h = src_input.w ^ src_input.h;
+                               src_input.w = src_input.w ^ src_input.h;
+                       }
+                       break;
+               case DISP_GEO_METHOD_FULL_SCREEN:
+                       result.x = result.y = 0;
+                       result.w = evaspixmapsink->xpixmap[idx]->width;
+                       result.h = evaspixmapsink->xpixmap[idx]->height;
+                       GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : full screen");
+                       break;
+               case DISP_GEO_METHOD_CROPPED_FULL_SCREEN:
+                       GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : cropped full screen");
+                       gst_video_sink_center_rect(dst, src, &src_input, TRUE);
+                       result.x = result.y = 0;
+                       result.w = dst.w;
+                       result.h = dst.h;
+                       if (evaspixmapsink->rotate_angle == DEGREE_90 ||
+                               evaspixmapsink->rotate_angle == DEGREE_270) {
+                               src_input.x = src_input.x ^ src_input.y;
+                               src_input.y = src_input.x ^ src_input.y;
+                               src_input.x = src_input.x ^ src_input.y;
+                               src_input.w = src_input.w ^ src_input.h;
+                               src_input.h = src_input.w ^ src_input.h;
+                               src_input.w = src_input.w ^ src_input.h;
+                       }
+                       break;
+               case DISP_GEO_METHOD_CUSTOM_ROI:
+                       switch (evaspixmapsink->rotate_angle) {
+                       case DEGREE_90:
+                               result.w = evaspixmapsink->dst_roi.h;
+                               result.h = evaspixmapsink->dst_roi.w;
+                               result.x = evaspixmapsink->dst_roi.y;
+                               result.y = evaspixmapsink->xpixmap[idx]->height - evaspixmapsink->dst_roi.x - evaspixmapsink->dst_roi.w;
+                               break;
+                       case DEGREE_180:
+                               result.w = evaspixmapsink->dst_roi.w;
+                               result.h = evaspixmapsink->dst_roi.h;
+                               result.x = evaspixmapsink->xpixmap[idx]->width - result.w - evaspixmapsink->dst_roi.x;
+                               result.y = evaspixmapsink->xpixmap[idx]->height - result.h - evaspixmapsink->dst_roi.y;
+                               break;
+                       case DEGREE_270:
+                               result.w = evaspixmapsink->dst_roi.h;
+                               result.h = evaspixmapsink->dst_roi.w;
+                               result.x = evaspixmapsink->xpixmap[idx]->width - evaspixmapsink->dst_roi.y - evaspixmapsink->dst_roi.h;
+                               result.y = evaspixmapsink->dst_roi.x;
+                               break;
+                       default:
+                               result.x = evaspixmapsink->dst_roi.x;
+                               result.y = evaspixmapsink->dst_roi.y;
+                               result.w = evaspixmapsink->dst_roi.w;
+                               result.h = evaspixmapsink->dst_roi.h;
+                               break;
+                       }
+                       GST_LOG_OBJECT(evaspixmapsink, "rotate[%d], ROI input[%d,%d,%dx%d] > result[%d,%d,%dx%d]",
+                                       evaspixmapsink->rotate_angle,
+                                       evaspixmapsink->dst_roi.x, evaspixmapsink->dst_roi.y, evaspixmapsink->dst_roi.w, evaspixmapsink->dst_roi.h,
+                                       result.x, result.y, result.w, result.h);
+                       break;
+               default:
+                       break;
+               }
+               GST_DEBUG_OBJECT (evaspixmapsink, "GEO_METHOD : src(%dx%d), dst(%dx%d), result(%dx%d), result_x(%d), result_y(%d)",
+                               src.w,src.h,dst.w,dst.h,result.w,result.h,result.x,result.y);
+
+               switch( evaspixmapsink->rotate_angle ) {
+                       case DEGREE_0:
+                       break;
+                       case DEGREE_90:
+                       rotate = 270;
+                       break;
+                       case DEGREE_180:
+                       rotate = 180;
+                       break;
+                       case DEGREE_270:
+                       rotate = 90;
+                       break;
+                       default:
+                       GST_WARNING_OBJECT( evaspixmapsink, "Unsupported rotation [%d]... set DEGREE 0.",
+                                       evaspixmapsink->rotate_angle );
+                       break;
+               }
+
+               /* set display rotation */
+               if (atom_rotation == None) {
+                       atom_rotation = XInternAtom(evaspixmapsink->xcontext->disp, "_USER_WM_PORT_ATTRIBUTE_ROTATION", False);
+               }
+
+               ret = XvSetPortAttribute(evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_rotation, rotate);
+               if (ret != Success) {
+                       GST_ERROR_OBJECT( evaspixmapsink, "XvSetPortAttribute failed[%d]. disp[%x],xv_port_id[%d],atom[%x],rotate[%d]",
+                                       ret, evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_rotation, rotate );
+                       return FALSE;
+               }
+
+               /* set display flip */
+               if (atom_hflip == None) {
+                       atom_hflip = XInternAtom(evaspixmapsink->xcontext->disp, "_USER_WM_PORT_ATTRIBUTE_HFLIP", False);
+               }
+               if (atom_vflip == None) {
+                       atom_vflip = XInternAtom(evaspixmapsink->xcontext->disp, "_USER_WM_PORT_ATTRIBUTE_VFLIP", False);
+               }
+
+               switch (evaspixmapsink->flip) {
+               case FLIP_HORIZONTAL:
+                       set_hflip = TRUE;
+                       set_vflip = FALSE;
+                       break;
+               case FLIP_VERTICAL:
+                       set_hflip = FALSE;
+                       set_vflip = TRUE;
+                       break;
+               case FLIP_BOTH:
+                       set_hflip = TRUE;
+                       set_vflip = TRUE;
+                       break;
+               case FLIP_NONE:
+               default:
+                       set_hflip = FALSE;
+                       set_vflip = FALSE;
+                       break;
+               }
+               GST_INFO_OBJECT(evaspixmapsink, "set rotate %d HFLIP %d, VFLIP %d", rotate, set_hflip, set_vflip);
+
+               ret = XvSetPortAttribute(evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_hflip, set_hflip);
+               if (ret != Success) {
+                       GST_WARNING("set HFLIP failed[%d]. disp[%x],xv_port_id[%d],atom[%x],hflip[%d]",
+                                       ret, evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_hflip, set_hflip);
+               }
+               ret = XvSetPortAttribute(evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_vflip, set_vflip);
+               if (ret != Success) {
+                       GST_WARNING("set VFLIP failed[%d]. disp[%x],xv_port_id[%d],atom[%x],vflip[%d]",
+                                       ret, evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, atom_vflip, set_vflip);
+               }
+
+       } else {
+               result.x = result.y = 0;
+               result.w = evaspixmapsink->xpixmap[idx]->width;
+               result.h = evaspixmapsink->xpixmap[idx]->height;
+               GST_INFO_OBJECT (evaspixmapsink, "USE ORIGIN SIZE, no geometry method, no rotation/flip" );
+       }
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+  /* We scale to the pixmap's geometry */
+#ifdef HAVE_XSHM
+       if (evaspixmapsink->xcontext->use_xshm) {
+               GST_LOG_OBJECT (evaspixmapsink,"XvShmPutImage with image %dx%d and pixmap %dx%d, from xvimage %"
+                               GST_PTR_FORMAT,
+                               evaspixmapbuf->width, evaspixmapbuf->height,
+                               evaspixmapsink->render_rect.w, evaspixmapsink->render_rect.h, evaspixmapbuf);
+
+       /* Trim as proper size */
+       if (src_input.w % 2 == 1) {
+               src_input.w += 1;
+       }
+       if (src_input.h % 2 == 1) {
+               src_input.h += 1;
+       }
+
+       GST_LOG_OBJECT (evaspixmapsink, "screen[%dx%d],pixmap[%d,%d,%dx%d],method[%d],rotate[%d],src[%dx%d],dst[%d,%d,%dx%d],input[%d,%d,%dx%d],result[%d,%d,%dx%d]",
+               evaspixmapsink->scr_w, evaspixmapsink->scr_h,
+               evaspixmapsink->xpixmap[idx]->x, evaspixmapsink->xpixmap[idx]->y, evaspixmapsink->xpixmap[idx]->width, evaspixmapsink->xpixmap[idx]->height,
+               evaspixmapsink->display_geometry_method, rotate,
+               src_origin.w, src_origin.h,
+               dst.x, dst.y, dst.w, dst.h,
+               src_input.x, src_input.y, src_input.w, src_input.h,
+               result.x, result.y, result.w, result.h );
+
+       if (evaspixmapsink->visible) {
+               if (evaspixmapsink->buf_shared_type == BUF_SHARE_METHOD_FD) {
+                       EVASPIXMAPSINK_SET_PIXMAP_ID_TO_GEM_INFO (evaspixmapsink, evaspixmapsink->xpixmap[idx]->pixmap);
+               }
+               ret = XvShmPutImage (evaspixmapsink->xcontext->disp,
+                       evaspixmapsink->xcontext->xv_port_id,
+                       evaspixmapsink->xpixmap[idx]->pixmap,
+                       evaspixmapsink->xpixmap[idx]->gc, evaspixmapbuf->xvimage,
+                       src_input.x, src_input.y, src_input.w, src_input.h,
+                       result.x, result.y, result.w, result.h, FALSE);
+               GST_LOG_OBJECT (evaspixmapsink, "XvShmPutImage return value [%d]", ret );
+       } else {
+               GST_WARNING_OBJECT (evaspixmapsink, "visible is FALSE. skip this image..." );
+       }
+  } else
+#endif /* HAVE_XSHM */
+       {
+               if (evaspixmapsink->visible) {
+               XvPutImage (evaspixmapsink->xcontext->disp,
+                       evaspixmapsink->xcontext->xv_port_id,
+                       evaspixmapsink->xpixmap[idx]->pixmap,
+                       evaspixmapsink->xpixmap[idx]->gc, evaspixmapbuf->xvimage,
+                       evaspixmapsink->disp_x, evaspixmapsink->disp_y,
+                       evaspixmapsink->disp_width, evaspixmapsink->disp_height,
+                       result.x, result.y, result.w, result.h);
+               } else {
+                       GST_WARNING_OBJECT (evaspixmapsink, "visible is FALSE. skip this image..." );
+               }
+       }
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+       g_mutex_unlock (evaspixmapsink->flow_lock);
+
+       MMTA_ACUM_ITEM_END("evaspixmapsink evaspixmap_buffer_put()", FALSE);
+
+       return TRUE;
+}
+
+static int
+drm_init(GstEvasPixmapSink *evaspixmapsink)
+{
+       Display *dpy;
+       int i = 0;
+       int eventBase = 0;
+       int errorBase = 0;
+       int dri2Major = 0;
+       int dri2Minor = 0;
+       char *driverName = NULL;
+       char *deviceName = NULL;
+       struct drm_auth auth_arg = {0};
+
+       evaspixmapsink->drm_fd = -1;
+
+       dpy = XOpenDisplay(0);
+
+       /* DRI2 */
+       if (!DRI2QueryExtension(dpy, &eventBase, &errorBase)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"failed to DRI2QueryExtension()");
+               goto ERROR_CASE;
+       }
+
+       if (!DRI2QueryVersion(dpy, &dri2Major, &dri2Minor)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"failed to DRI2QueryVersion");
+               goto ERROR_CASE;
+       }
+
+       if (!DRI2Connect(dpy, RootWindow(dpy, DefaultScreen(dpy)), &driverName, &deviceName)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"failed to DRI2Connect");
+               goto ERROR_CASE;
+       }
+
+       if (!driverName || !deviceName) {
+               GST_ERROR_OBJECT (evaspixmapsink,"driverName or deviceName is not valid");
+               goto ERROR_CASE;
+       }
+
+       GST_INFO_OBJECT (evaspixmapsink,"Open drm device : %s", deviceName);
+
+       /* get the drm_fd though opening the deviceName */
+       evaspixmapsink->drm_fd = open(deviceName, O_RDWR);
+       if (evaspixmapsink->drm_fd < 0) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot open drm device (%s)", deviceName);
+               goto ERROR_CASE;
+       }
+
+       /* get magic from drm to authentication */
+       if (ioctl(evaspixmapsink->drm_fd, DRM_IOCTL_GET_MAGIC, &auth_arg)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot get drm auth magic");
+               close(evaspixmapsink->drm_fd);
+               evaspixmapsink->drm_fd = -1;
+               goto ERROR_CASE;
+       }
+
+       if (!DRI2Authenticate(dpy, RootWindow(dpy, DefaultScreen(dpy)), auth_arg.magic)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot get drm authentication from X");
+               close(evaspixmapsink->drm_fd);
+               evaspixmapsink->drm_fd = -1;
+               goto ERROR_CASE;
+       }
+
+       /* init gem handle */
+       for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) {
+               evaspixmapsink->gem_info[i].dmabuf_fd = 0;
+               evaspixmapsink->gem_info[i].gem_handle = 0;
+               evaspixmapsink->gem_info[i].gem_name = 0;
+               evaspixmapsink->gem_info[i].bo = 0;
+               evaspixmapsink->gem_info[i].ref_pixmap = 0;
+       }
+
+       XCloseDisplay(dpy);
+       free(driverName);
+       free(deviceName);
+
+       return 0;
+
+ERROR_CASE:
+       XCloseDisplay(dpy);
+       if (driverName) {
+               free(driverName);
+       }
+       if (deviceName) {
+               free(deviceName);
+       }
+
+       return -1;
+}
+
+static void
+drm_fini(GstEvasPixmapSink *evaspixmapsink)
+{
+       if (evaspixmapsink->drm_fd >= 0) {
+               GST_INFO_OBJECT (evaspixmapsink,"close drm_fd(%d)", evaspixmapsink->drm_fd);
+               close(evaspixmapsink->drm_fd);
+               evaspixmapsink->drm_fd = -1;
+       }
+}
+
+static unsigned int
+drm_init_convert_dmabuf_gemname(GstEvasPixmapSink *evaspixmapsink, int dmabuf_fd)
+{
+       struct drm_prime_handle prime_arg = {0,};
+       struct drm_gem_flink flink_arg = {0,};
+       int i = 0;
+
+       if (evaspixmapsink->drm_fd < 0) {
+               GST_ERROR_OBJECT (evaspixmapsink,"DRM is not opened");
+               return 0;
+       }
+
+       if (dmabuf_fd <= 0) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Ignore wrong dmabuf fd(%d)", dmabuf_fd);              /* temporarily change log level to DEBUG for reducing WARNING level log */
+               return 0;
+       }
+
+       /* check duplicated dmabuf fd */
+       for (i = 0 ; i < MAX_GEM_BUFFER_NUM ; i++) {
+               if (evaspixmapsink->gem_info[i].dmabuf_fd == dmabuf_fd) {
+                       GST_LOG_OBJECT (evaspixmapsink,"already got fd(%u) with name(%u)", dmabuf_fd, evaspixmapsink->gem_info[i].gem_name);
+                       return evaspixmapsink->gem_info[i].gem_name;
+               }
+
+               if (evaspixmapsink->gem_info[i].dmabuf_fd == 0) {
+                       GST_LOG_OBJECT (evaspixmapsink,"empty gem_info[%d] found", i);
+                       break;
+               }
+       }
+
+       if (i == MAX_GEM_BUFFER_NUM) {
+               GST_WARNING_OBJECT (evaspixmapsink,"too many buffers[dmabuf_fd(%d). skip it]", dmabuf_fd);
+               return 0;
+       }
+
+       evaspixmapsink->gem_info[i].dmabuf_fd = dmabuf_fd;
+       prime_arg.fd = dmabuf_fd;
+       if (ioctl(evaspixmapsink->drm_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &prime_arg)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"non dmabuf fd(%d)", dmabuf_fd);
+               return 0;
+       }
+
+       evaspixmapsink->gem_info[i].gem_handle = prime_arg.handle;
+       GST_LOG_OBJECT (evaspixmapsink,"gem_info[%d].gem_handle = %u", i, prime_arg.handle);
+
+       flink_arg.handle = prime_arg.handle;
+       if (ioctl(evaspixmapsink->drm_fd, DRM_IOCTL_GEM_FLINK, &flink_arg)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot convert drm handle to name");
+               return 0;
+       }
+
+       evaspixmapsink->gem_info[i].gem_name = flink_arg.name;
+       GST_LOG_OBJECT (evaspixmapsink,"gem_info[%d].gem_name = %u", i, flink_arg.name);
+
+       return flink_arg.name;
+}
+
+static unsigned int
+tbm_init_convert_bo_gemname(GstEvasPixmapSink *evaspixmapsink, unsigned int bo)
+{
+       int i = 0;
+
+       if (bo <= 0) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Ignore wrong bo(%u)", bo);            /* temporarily change log level to DEBUG for reducing WARNING level log */
+               return 0;
+       }
+
+       /* check duplicated dmabuf bo */
+       for (i = 0 ; i < MAX_GEM_BUFFER_NUM ; i++) {
+               if (evaspixmapsink->gem_info[i].bo == bo) {
+                       GST_LOG_OBJECT (evaspixmapsink,"already got bo(%u) with name(%u)", bo, evaspixmapsink->gem_info[i].gem_name);
+                       return evaspixmapsink->gem_info[i].gem_name;
+               }
+
+               if (evaspixmapsink->gem_info[i].bo == 0) {
+                       GST_LOG_OBJECT (evaspixmapsink,"empty gem_info[%d] found", i);
+                       break;
+               }
+       }
+
+       if (i == MAX_GEM_BUFFER_NUM) {
+               GST_WARNING_OBJECT (evaspixmapsink,"too many buffers[dmabuf_bo(%d). skip it]", bo);
+               return 0;
+       }
+
+       evaspixmapsink->gem_info[i].bo = bo;
+       evaspixmapsink->gem_info[i].gem_name = tbm_bo_export(bo);
+       GST_LOG_OBJECT (evaspixmapsink,"gem_info[%d].gem_name = %u", i, evaspixmapsink->gem_info[i].gem_name);
+
+       return evaspixmapsink->gem_info[i].gem_name;
+}
+
+static void
+drm_fini_close_gem_handle(GstEvasPixmapSink *evaspixmapsink, Pixmap pixmap_id)
+{
+       int i = 0;
+       if (evaspixmapsink->drm_fd >= 0) {
+               if (pixmap_id == 0) {
+                       for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) {
+                               if (evaspixmapsink->gem_info[i].dmabuf_fd > 0) {
+                                       if (evaspixmapsink->buf_shared_type == BUF_SHARE_METHOD_FD) {
+                                               GST_INFO_OBJECT (evaspixmapsink,"close gem_handle(%u)", evaspixmapsink->gem_info[i].gem_handle);
+                                               drm_close_gem(evaspixmapsink, evaspixmapsink->gem_info[i].gem_handle);
+                                       }
+                                       evaspixmapsink->gem_info[i].dmabuf_fd = 0;
+                                       evaspixmapsink->gem_info[i].gem_handle = 0;
+                                       evaspixmapsink->gem_info[i].gem_name = 0;
+                                       evaspixmapsink->gem_info[i].bo = 0;
+                                       evaspixmapsink->gem_info[i].ref_pixmap = 0;
+                                       break;
+                               }
+                       }
+               } else {
+                       for (i = 0; i < MAX_GEM_BUFFER_NUM; i++) {
+                               if (evaspixmapsink->gem_info[i].dmabuf_fd > 0 && evaspixmapsink->gem_info[i].ref_pixmap == pixmap_id) {
+                                       if (evaspixmapsink->buf_shared_type == BUF_SHARE_METHOD_FD) {
+                                               GST_INFO_OBJECT (evaspixmapsink,"close gem_handle(%u) for pixmap_id(%d)",
+                                                                               evaspixmapsink->gem_info[i].gem_handle, pixmap_id);
+                                               drm_close_gem(evaspixmapsink, evaspixmapsink->gem_info[i].gem_handle);
+                                       }
+                                       evaspixmapsink->gem_info[i].dmabuf_fd = 0;
+                                       evaspixmapsink->gem_info[i].gem_handle = 0;
+                                       evaspixmapsink->gem_info[i].gem_name = 0;
+                                       evaspixmapsink->gem_info[i].bo = 0;
+                                       evaspixmapsink->gem_info[i].ref_pixmap = 0;
+                                       break;
+                               }
+                       }
+               }
+       }
+}
+
+static void
+drm_close_gem(GstEvasPixmapSink *evaspixmapsink, unsigned int gem_handle)
+{
+       struct drm_gem_close close_arg = {0,};
+
+       if (evaspixmapsink->drm_fd < 0) {
+               GST_ERROR_OBJECT (evaspixmapsink,"DRM is not opened");
+               return;
+       }
+
+       if (gem_handle == 0) {
+               GST_ERROR_OBJECT (evaspixmapsink,"invalid gem_handle(%d)",gem_handle);
+               return;
+       }
+
+       close_arg.handle = gem_handle;
+       if (gem_handle > 0 && ioctl(evaspixmapsink->drm_fd, DRM_IOCTL_GEM_CLOSE, &close_arg)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"cannot close drm gem handle(%d)", gem_handle);
+               return;
+       }
+
+       return;
+}
+
+/* This function destroys a GstXPixmap */
+static void
+gst_evaspixmapsink_xpixmap_destroy (GstEvasPixmapSink *evaspixmapsink, GstXPixmap *xpixmap)
+{
+       g_return_if_fail (xpixmap != NULL);
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+       if(xpixmap->pixmap) {
+               GST_LOG_OBJECT (evaspixmapsink,"Free pixmap(%d)", xpixmap->pixmap);
+               XFreePixmap(evaspixmapsink->xcontext->disp, xpixmap->pixmap);
+               xpixmap->pixmap = 0;
+       }
+
+       if (xpixmap->gc) {
+               XFreeGC (evaspixmapsink->xcontext->disp, xpixmap->gc);
+       }
+
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+       g_free (xpixmap);
+}
+
+static void
+gst_evaspixmapsink_xpixmap_update_geometry (GstEvasPixmapSink *evaspixmapsink, int idx)
+{
+       Window root_window;
+       XWindowAttributes root_attr;
+
+       int cur_pixmap_x = 0;
+       int cur_pixmap_y = 0;
+       unsigned int cur_pixmap_width = 0;
+       unsigned int cur_pixmap_height = 0;
+       unsigned int cur_pixmap_border_width = 0;
+       unsigned int cur_pixmap_depth = 0;
+
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+       /* Update the window geometry */
+       g_mutex_lock (evaspixmapsink->x_lock);
+       if (G_UNLIKELY (evaspixmapsink->xpixmap[idx] == NULL)) {
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               return;
+       }
+
+       /* Get root window and size of current pixmap */
+       XGetGeometry( evaspixmapsink->xcontext->disp, evaspixmapsink->xpixmap[idx]->pixmap, &root_window,
+                       &cur_pixmap_x, &cur_pixmap_y, /* relative x, y, for pixmap these are alway 0 */
+                       &cur_pixmap_width, &cur_pixmap_height,
+                       &cur_pixmap_border_width, &cur_pixmap_depth ); /* cur_pixmap_border_width, cur_pixmap_depth are not used */
+
+       evaspixmapsink->xpixmap[idx]->width = cur_pixmap_width;
+       evaspixmapsink->xpixmap[idx]->height = cur_pixmap_height;
+
+       evaspixmapsink->xpixmap[idx]->x = cur_pixmap_x;
+       evaspixmapsink->xpixmap[idx]->y = cur_pixmap_y;
+
+       /* Get size of root window == size of screen */
+       XGetWindowAttributes(evaspixmapsink->xcontext->disp, root_window, &root_attr);
+
+       evaspixmapsink->scr_w = root_attr.width;
+       evaspixmapsink->scr_h = root_attr.height;
+
+       if (!evaspixmapsink->have_render_rect) {
+               evaspixmapsink->render_rect.x = evaspixmapsink->render_rect.y = 0;
+               evaspixmapsink->render_rect.w = cur_pixmap_width;
+               evaspixmapsink->render_rect.h = cur_pixmap_height;
+       }
+
+       GST_LOG_OBJECT (evaspixmapsink,"screen size %dx%d, current pixmap geometry %d,%d,%dx%d, render_rect %d,%d,%dx%d",
+                       evaspixmapsink->scr_w, evaspixmapsink->scr_h,
+                       evaspixmapsink->xpixmap[idx]->x, evaspixmapsink->xpixmap[idx]->y,
+                       evaspixmapsink->xpixmap[idx]->width, evaspixmapsink->xpixmap[idx]->height,
+                       evaspixmapsink->render_rect.x, evaspixmapsink->render_rect.y,
+                       evaspixmapsink->render_rect.w, evaspixmapsink->render_rect.h);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+}
+
+static void
+gst_evaspixmapsink_xpixmap_clear (GstEvasPixmapSink *evaspixmapsink, GstXPixmap *xpixmap)
+{
+       g_return_if_fail (xpixmap != NULL);
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+       if (!xpixmap->pixmap) {
+               GST_WARNING_OBJECT (evaspixmapsink,"pixmap was not created..");
+               return;
+       }
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+       if (!evaspixmapsink->xcontext) {
+               GST_WARNING_OBJECT (evaspixmapsink,"xcontext is null..");
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               return;
+       }
+
+       if (evaspixmapsink->stop_video) {
+               XvStopVideo (evaspixmapsink->xcontext->disp, evaspixmapsink->xcontext->xv_port_id, xpixmap->pixmap);
+       }
+       XSync (evaspixmapsink->xcontext->disp, FALSE);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+       g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+       evaspixmapsink->last_updated_idx = -1;
+       xpixmap->ref = 0;
+       xpixmap->damaged_time = 0;
+       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+}
+
+/* This function commits our internal colorbalance settings to our grabbed Xv
+   port. If the xcontext is not initialized yet it simply returns */
+static void
+gst_evaspixmapsink_update_colorbalance (GstEvasPixmapSink *evaspixmapsink)
+{
+  GList *channels = NULL;
+
+  g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+  /* If we haven't initialized the X context we can't update anything */
+  if (evaspixmapsink->xcontext == NULL)
+    return;
+
+  /* Don't set the attributes if they haven't been changed, to avoid
+   * rounding errors changing the values */
+  if (!evaspixmapsink->cb_changed)
+    return;
+
+  /* For each channel of the colorbalance we calculate the correct value
+     doing range conversion and then set the Xv port attribute to match our
+     values. */
+  channels = evaspixmapsink->xcontext->channels_list;
+
+  while (channels) {
+    if (channels->data && GST_IS_COLOR_BALANCE_CHANNEL (channels->data)) {
+      GstColorBalanceChannel *channel = NULL;
+      Atom prop_atom;
+      gint value = 0;
+      gdouble convert_coef;
+
+      channel = GST_COLOR_BALANCE_CHANNEL (channels->data);
+      g_object_ref (channel);
+
+      /* Our range conversion coef */
+      convert_coef = (channel->max_value - channel->min_value) / 2000.0;
+
+      if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) {
+        value = evaspixmapsink->hue;
+      } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) {
+        value = evaspixmapsink->saturation;
+      } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) {
+        value = evaspixmapsink->contrast;
+      } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) {
+        value = evaspixmapsink->brightness;
+      } else {
+        g_warning ("got an unknown channel %s", channel->label);
+        g_object_unref (channel);
+        return;
+      }
+
+      /* Committing to Xv port */
+      g_mutex_lock (evaspixmapsink->x_lock);
+      prop_atom =
+          XInternAtom (evaspixmapsink->xcontext->disp, channel->label, True);
+      if (prop_atom != None) {
+        int xv_value;
+        xv_value =
+            floor (0.5 + (value + 1000) * convert_coef + channel->min_value);
+        XvSetPortAttribute (evaspixmapsink->xcontext->disp,
+            evaspixmapsink->xcontext->xv_port_id, prop_atom, xv_value);
+      }
+      g_mutex_unlock (evaspixmapsink->x_lock);
+
+      g_object_unref (channel);
+    }
+    channels = g_list_next (channels);
+  }
+}
+
+static void
+gst_lookup_xv_port_from_adaptor (GstXContext *xcontext, XvAdaptorInfo *adaptors, int adaptor_no)
+{
+  gint j;
+  gint res;
+
+  /* Do we support XvImageMask ? */
+  if (!(adaptors[adaptor_no].type & XvImageMask)) {
+    GST_DEBUG ("XV Adaptor %s has no support for XvImageMask", adaptors[adaptor_no].name);
+    return;
+  }
+
+  /* We found such an adaptor, looking for an available port */
+  for (j = 0; j < adaptors[adaptor_no].num_ports && !xcontext->xv_port_id; j++) {
+    /* We try to grab the port */
+    res = XvGrabPort (xcontext->disp, adaptors[adaptor_no].base_id + j, 0);
+    if (Success == res) {
+      xcontext->xv_port_id = adaptors[adaptor_no].base_id + j;
+      GST_DEBUG ("XV Adaptor %s with %ld ports", adaptors[adaptor_no].name, adaptors[adaptor_no].num_ports);
+    } else {
+      GST_DEBUG ("GrabPort %d for XV Adaptor %s failed: %d", j, adaptors[adaptor_no].name, res);
+    }
+  }
+}
+
+/* This function generates a caps with all supported format by the first
+   Xv grabable port we find. We store each one of the supported formats in a
+   format list and append the format to a newly created caps that we return
+   If this function does not return NULL because of an error, it also grabs
+   the port via XvGrabPort */
+static GstCaps*
+gst_evaspixmapsink_get_xv_support (GstEvasPixmapSink *evaspixmapsink, GstXContext *xcontext)
+{
+  gint i;
+  XvAdaptorInfo *adaptors;
+  gint nb_formats;
+  XvImageFormatValues *formats = NULL;
+  guint nb_encodings;
+  XvEncodingInfo *encodings = NULL;
+  gulong max_w = G_MAXINT, max_h = G_MAXINT;
+  GstCaps *caps = NULL;
+  GstCaps *rgb_caps = NULL;
+
+  g_return_val_if_fail (xcontext != NULL, NULL);
+
+  /* First let's check that XVideo extension is available */
+  if (!XQueryExtension (xcontext->disp, "XVideo", &i, &i, &i)) {
+    GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, SETTINGS,
+        ("Could not initialise Xv output"),
+        ("XVideo extension is not available"));
+    return NULL;
+  }
+
+  /* Then we get adaptors list */
+  if (Success != XvQueryAdaptors (xcontext->disp, xcontext->root,
+          &xcontext->nb_adaptors, &adaptors)) {
+    GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, SETTINGS,
+        ("Could not initialise Xv output"),
+        ("Failed getting XV adaptors list"));
+    return NULL;
+  }
+
+  xcontext->xv_port_id = 0;
+
+  GST_DEBUG_OBJECT (evaspixmapsink,"Found %u XV adaptor(s)", xcontext->nb_adaptors);
+
+  xcontext->adaptors =
+      (gchar **) g_malloc0 (xcontext->nb_adaptors * sizeof (gchar *));
+
+  /* Now fill up our adaptor name array */
+  for (i = 0; i < xcontext->nb_adaptors; i++) {
+    xcontext->adaptors[i] = g_strdup (adaptors[i].name);
+  }
+
+  if (evaspixmapsink->adaptor_no < xcontext->nb_adaptors) {
+    /* Find xv port from user defined adaptor */
+    gst_lookup_xv_port_from_adaptor (xcontext, adaptors, evaspixmapsink->adaptor_no);
+  }
+
+  if (!xcontext->xv_port_id) {
+    /* Now search for an adaptor that supports XvImageMask */
+    for (i = 0; i < xcontext->nb_adaptors && !xcontext->xv_port_id; i++) {
+      gst_lookup_xv_port_from_adaptor (xcontext, adaptors, i);
+      evaspixmapsink->adaptor_no = i;
+    }
+  }
+
+  XvFreeAdaptorInfo (adaptors);
+
+  if (!xcontext->xv_port_id) {
+    evaspixmapsink->adaptor_no = -1;
+    GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, BUSY,
+        ("Could not initialise Xv output"), ("No port available"));
+    return NULL;
+  }
+
+  /* Set XV_AUTOPAINT_COLORKEY and XV_DOUBLE_BUFFER and XV_COLORKEY */
+  {
+    int count, todo = 3;
+    XvAttribute *const attr = XvQueryPortAttributes (xcontext->disp,
+        xcontext->xv_port_id, &count);
+    static const char autopaint[] = "XV_AUTOPAINT_COLORKEY";
+    static const char dbl_buffer[] = "XV_DOUBLE_BUFFER";
+    static const char colorkey[] = "XV_COLORKEY";
+
+    GST_DEBUG_OBJECT (evaspixmapsink,"Checking %d Xv port attributes", count);
+
+    evaspixmapsink->have_autopaint_colorkey = FALSE;
+    evaspixmapsink->have_double_buffer = FALSE;
+    evaspixmapsink->have_colorkey = FALSE;
+
+    for (i = 0; ((i < count) && todo); i++)
+      if (!strcmp (attr[i].name, autopaint)) {
+        const Atom atom = XInternAtom (xcontext->disp, autopaint, False);
+
+        /* turn on autopaint colorkey */
+        XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
+            (evaspixmapsink->autopaint_colorkey ? 1 : 0));
+        todo--;
+        evaspixmapsink->have_autopaint_colorkey = TRUE;
+      } else if (!strcmp (attr[i].name, dbl_buffer)) {
+        const Atom atom = XInternAtom (xcontext->disp, dbl_buffer, False);
+
+        XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
+            (evaspixmapsink->double_buffer ? 1 : 0));
+        todo--;
+        evaspixmapsink->have_double_buffer = TRUE;
+      } else if (!strcmp (attr[i].name, colorkey)) {
+        /* Set the colorkey, default is something that is dark but hopefully
+         * won't randomly appear on the screen elsewhere (ie not black or greys)
+         * can be overridden by setting "colorkey" property
+         */
+        const Atom atom = XInternAtom (xcontext->disp, colorkey, False);
+        guint32 ckey = 0;
+        gboolean set_attr = TRUE;
+        guint cr, cg, cb;
+
+        /* set a colorkey in the right format RGB565/RGB888
+         * We only handle these 2 cases, because they're the only types of
+         * devices we've encountered. If we don't recognise it, leave it alone
+         */
+        cr = (evaspixmapsink->colorkey >> 16);
+        cg = (evaspixmapsink->colorkey >> 8) & 0xFF;
+        cb = (evaspixmapsink->colorkey) & 0xFF;
+        switch (xcontext->depth) {
+          case 16:             /* RGB 565 */
+            cr >>= 3;
+            cg >>= 2;
+            cb >>= 3;
+            ckey = (cr << 11) | (cg << 5) | cb;
+            break;
+          case 24:
+          case 32:             /* RGB 888 / ARGB 8888 */
+            ckey = (cr << 16) | (cg << 8) | cb;
+            break;
+          default:
+            GST_DEBUG_OBJECT (evaspixmapsink,"Unknown bit depth %d for Xv Colorkey - not adjusting", xcontext->depth);
+            set_attr = FALSE;
+            break;
+        }
+
+        if (set_attr) {
+          ckey = CLAMP (ckey, (guint32) attr[i].min_value,
+              (guint32) attr[i].max_value);
+          GST_LOG_OBJECT (evaspixmapsink,"Setting color key for display depth %d to 0x%x", xcontext->depth, ckey);
+
+          XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
+              (gint) ckey);
+        }
+        todo--;
+        evaspixmapsink->have_colorkey = TRUE;
+      }
+
+    XFree (attr);
+  }
+
+  /* Get the list of encodings supported by the adapter and look for the
+   * XV_IMAGE encoding so we can determine the maximum width and height
+   * supported */
+  XvQueryEncodings (xcontext->disp, xcontext->xv_port_id, &nb_encodings,
+      &encodings);
+
+  for (i = 0; i < nb_encodings; i++) {
+    GST_LOG_OBJECT (evaspixmapsink,
+        "Encoding %d, name %s, max wxh %lux%lu rate %d/%d",
+        i, encodings[i].name, encodings[i].width, encodings[i].height,
+        encodings[i].rate.numerator, encodings[i].rate.denominator);
+    if (strcmp (encodings[i].name, "XV_IMAGE") == 0) {
+      max_w = encodings[i].width;
+      max_h = encodings[i].height;
+      evaspixmapsink->scr_w = max_w;
+      evaspixmapsink->scr_h = max_h;
+    }
+  }
+
+  XvFreeEncodingInfo (encodings);
+
+  /* We get all image formats supported by our port */
+  formats = XvListImageFormats (xcontext->disp,
+      xcontext->xv_port_id, &nb_formats);
+  caps = gst_caps_new_empty ();
+  for (i = 0; i < nb_formats; i++) {
+    GstCaps *format_caps = NULL;
+    gboolean is_rgb_format = FALSE;
+
+    /* We set the image format of the xcontext to an existing one. This
+       is just some valid image format for making our xshm calls check before
+       caps negotiation really happens. */
+    xcontext->im_format = formats[i].id;
+
+    switch (formats[i].type) {
+      case XvRGB:
+      {
+        XvImageFormatValues *fmt = &(formats[i]);
+        gint endianness = G_BIG_ENDIAN;
+
+        if (fmt->byte_order == LSBFirst) {
+          /* our caps system handles 24/32bpp RGB as big-endian. */
+          if (fmt->bits_per_pixel == 24 || fmt->bits_per_pixel == 32) {
+            fmt->red_mask = GUINT32_TO_BE (fmt->red_mask);
+            fmt->green_mask = GUINT32_TO_BE (fmt->green_mask);
+            fmt->blue_mask = GUINT32_TO_BE (fmt->blue_mask);
+
+            if (fmt->bits_per_pixel == 24) {
+              fmt->red_mask >>= 8;
+              fmt->green_mask >>= 8;
+              fmt->blue_mask >>= 8;
+            }
+          } else
+            endianness = G_LITTLE_ENDIAN;
+        }
+
+        format_caps = gst_caps_new_simple ("video/x-raw-rgb",
+            "format", GST_TYPE_FOURCC, formats[i].id,
+            "endianness", G_TYPE_INT, endianness,
+            "depth", G_TYPE_INT, fmt->depth,
+            "bpp", G_TYPE_INT, fmt->bits_per_pixel,
+            "red_mask", G_TYPE_INT, fmt->red_mask,
+            "green_mask", G_TYPE_INT, fmt->green_mask,
+            "blue_mask", G_TYPE_INT, fmt->blue_mask,
+            "width", GST_TYPE_INT_RANGE, 1, max_w,
+            "height", GST_TYPE_INT_RANGE, 1, max_h,
+            "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
+
+        is_rgb_format = TRUE;
+        break;
+      }
+      case XvYUV:
+        format_caps = gst_caps_new_simple ("video/x-raw-yuv",
+            "format", GST_TYPE_FOURCC, formats[i].id,
+            "width", GST_TYPE_INT_RANGE, 1, max_w,
+            "height", GST_TYPE_INT_RANGE, 1, max_h,
+            "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
+        break;
+      default:
+        g_assert_not_reached ();
+        break;
+    }
+
+    if (format_caps) {
+      GstEvasPixmapFormat *format = NULL;
+
+      format = g_new0 (GstEvasPixmapFormat, 1);
+      if (format) {
+        format->format = formats[i].id;
+        format->caps = gst_caps_copy (format_caps);
+        xcontext->formats_list = g_list_append (xcontext->formats_list, format);
+      }
+
+      if (is_rgb_format) {
+        if (rgb_caps == NULL)
+          rgb_caps = format_caps;
+        else
+          gst_caps_append (rgb_caps, format_caps);
+      } else
+        gst_caps_append (caps, format_caps);
+    }
+  }
+
+  /* Collected all caps into either the caps or rgb_caps structures.
+   * Append rgb_caps on the end of YUV, so that YUV is always preferred */
+  if (rgb_caps)
+    gst_caps_append (caps, rgb_caps);
+
+  if (formats)
+    XFree (formats);
+
+  GST_DEBUG_OBJECT (evaspixmapsink,"Generated the following caps: %" GST_PTR_FORMAT, caps);
+
+  if (gst_caps_is_empty (caps)) {
+    gst_caps_unref (caps);
+    XvUngrabPort (xcontext->disp, xcontext->xv_port_id, 0);
+    GST_ELEMENT_ERROR (evaspixmapsink, STREAM, WRONG_TYPE, (NULL),
+        ("No supported format found"));
+    return NULL;
+  }
+
+  return caps;
+}
+
+static gpointer
+gst_evaspixmapsink_event_thread (GstEvasPixmapSink * evaspixmapsink)
+{
+       g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), NULL);
+       int damage_base = 0;
+       int damage_err_base = 0;
+       int damage_case = 0;
+       XEvent e;
+       int i = 0;
+       Display *disp = NULL;
+
+       GST_OBJECT_LOCK (evaspixmapsink);
+
+       if (evaspixmapsink->xcontext && evaspixmapsink->xcontext->disp) {
+               disp = evaspixmapsink->xcontext->disp;
+       } else {
+               GST_ERROR_OBJECT (evaspixmapsink,"evaspixmapsink->xcontext(->disp) is not ready");
+               return NULL;
+       }
+
+       if (!XDamageQueryExtension(evaspixmapsink->xcontext->disp, &damage_base, &damage_err_base)) {
+               GST_ERROR_OBJECT (evaspixmapsink,"XDamageQueryExtension() failed");
+               return NULL;
+       }
+       damage_case = (int)damage_base + XDamageNotify;
+
+       while (evaspixmapsink->running) {
+               GST_OBJECT_UNLOCK (evaspixmapsink);
+
+               g_mutex_lock (evaspixmapsink->x_lock);
+               while (XPending (disp)) {
+                       XNextEvent (disp, &e);
+                       if (e.type == damage_case ) {
+                               XDamageNotifyEvent *damage_ev = (XDamageNotifyEvent *)&e;
+                               for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                                       GstXPixmap *xpixmap = evaspixmapsink->xpixmap[i];
+                                       if (xpixmap && damage_ev->drawable == xpixmap->pixmap) {
+                                               g_mutex_lock(evaspixmapsink->pixmap_ref_lock);
+                                               if (xpixmap->ref) {
+                                                       /* set it only if damage event comes from _buffer_put() */
+                                                       xpixmap->damaged_time = (gint)get_millis_time();
+                                               }
+                                               GST_LOG_OBJECT (evaspixmapsink,"event_handler : got a damage event for pixmap(%d), refcount(%d), damaged_time(%d)",
+                                                                                               xpixmap->pixmap, xpixmap->ref, xpixmap->damaged_time);
+                                               g_mutex_unlock(evaspixmapsink->pixmap_ref_lock);
+
+                                               __ta__("evaspixmapsink ecore_pipe_write", ecore_pipe_write(evaspixmapsink->epipe, evaspixmapsink, sizeof(GstEvasPixmapSink)););
+                                               GST_DEBUG_OBJECT (evaspixmapsink,"event_handler : after call ecore_pipe_write() for pixmap(%d)", xpixmap->pixmap);
+                                               XDamageSubtract (evaspixmapsink->xcontext->disp, evaspixmapsink->damage[i], None, None );
+
+                                               if (evaspixmapsink->buf_shared_type == BUF_SHARE_METHOD_FD) {
+                                                       if (GST_STATE(evaspixmapsink) == GST_STATE_PLAYING) {
+                                                               drm_fini_close_gem_handle(evaspixmapsink, xpixmap->pixmap);
+                                                       }
+                                               }
+                                               break;
+                                       }
+                               }
+                               if (i == evaspixmapsink->num_of_pixmaps) {
+                                       GST_WARNING_OBJECT (evaspixmapsink,"event_handler : could not find corresponding pixmap with this damage event(%d)", damage_ev->drawable);
+                               }
+                       } else {
+                               GST_LOG_OBJECT (evaspixmapsink,"event_handler : unidentified event(%d)", e.type);
+                               continue;
+                       }
+               }
+               //XSync (disp, FALSE);
+               g_mutex_unlock (evaspixmapsink->x_lock);
+
+               g_usleep (G_USEC_PER_SEC / 40);
+               GST_OBJECT_LOCK (evaspixmapsink);
+       }
+       GST_OBJECT_UNLOCK (evaspixmapsink);
+       return NULL;
+}
+
+static void
+gst_evaspixmapsink_manage_event_thread (GstEvasPixmapSink *evaspixmapsink)
+{
+       /* don't start the thread too early */
+       if (evaspixmapsink->xcontext == NULL) {
+               GST_ERROR_OBJECT (evaspixmapsink,"xcontext is NULL..");
+               return;
+       }
+
+       GST_OBJECT_LOCK (evaspixmapsink);
+
+       if (!evaspixmapsink->event_thread) {
+               /* Setup our event listening thread */
+               GST_DEBUG_OBJECT (evaspixmapsink,"run xevent thread");
+               evaspixmapsink->running = TRUE;
+               evaspixmapsink->event_thread = g_thread_create ( (GThreadFunc) gst_evaspixmapsink_event_thread, evaspixmapsink, TRUE, NULL);
+       } else {
+               GST_WARNING_OBJECT (evaspixmapsink,"there already existed the event_thread.. keep going");
+               /* Do not finalize the thread in here, Only finalize the thread by calling gst_evaspixmapsink_reset() */
+       }
+
+       GST_OBJECT_UNLOCK (evaspixmapsink);
+}
+
+
+/* This function calculates the pixel aspect ratio based on the properties
+ * in the xcontext structure and stores it there. */
+static void
+gst_evaspixmapsink_calculate_pixel_aspect_ratio (GstXContext *xcontext)
+{
+  static const gint par[][2] = {
+    {1, 1},                     /* regular screen */
+    {16, 15},                   /* PAL TV */
+    {11, 10},                   /* 525 line Rec.601 video */
+    {54, 59},                   /* 625 line Rec.601 video */
+    {64, 45},                   /* 1280x1024 on 16:9 display */
+    {5, 3},                     /* 1280x1024 on 4:3 display */
+    {4, 3}                      /*  800x600 on 16:9 display */
+  };
+  gint i;
+  gint index;
+  gdouble ratio;
+  gdouble delta;
+
+#define DELTA(idx) (ABS (ratio - ((gdouble) par[idx][0] / par[idx][1])))
+
+  /* first calculate the "real" ratio based on the X values;
+   * which is the "physical" w/h divided by the w/h in pixels of the display */
+  ratio = (gdouble) (xcontext->widthmm * xcontext->height)
+      / (xcontext->heightmm * xcontext->width);
+
+  /* DirectFB's X in 720x576 reports the physical dimensions wrong, so
+   * override here */
+  if (xcontext->width == 720 && xcontext->height == 576) {
+    ratio = 4.0 * 576 / (3.0 * 720);
+  }
+  GST_DEBUG ("calculated pixel aspect ratio: %f", ratio);
+  /* now find the one from par[][2] with the lowest delta to the real one */
+  delta = DELTA (0);
+  index = 0;
+
+  for (i = 1; i < sizeof (par) / (sizeof (gint) * 2); ++i) {
+    gdouble this_delta = DELTA (i);
+
+    if (this_delta < delta) {
+      index = i;
+      delta = this_delta;
+    }
+  }
+
+  GST_DEBUG ("Decided on index %d (%d/%d)", index,
+      par[index][0], par[index][1]);
+
+  g_free (xcontext->par);
+  xcontext->par = g_new0 (GValue, 1);
+  g_value_init (xcontext->par, GST_TYPE_FRACTION);
+  gst_value_set_fraction (xcontext->par, par[index][0], par[index][1]);
+  GST_DEBUG ("set xcontext PAR to %d/%d",
+      gst_value_get_fraction_numerator (xcontext->par),
+      gst_value_get_fraction_denominator (xcontext->par));
+}
+
+/* This function gets the X Display and global info about it. Everything is
+   stored in our object and will be cleaned when the object is disposed. Note
+   here that caps for supported format are generated without any window or
+   image creation */
+static GstXContext*
+gst_evaspixmapsink_xcontext_get (GstEvasPixmapSink *evaspixmapsink)
+{
+       GstXContext *xcontext = NULL;
+       XPixmapFormatValues *px_formats = NULL;
+       gint nb_formats = 0, i, j, N_attr;
+       XvAttribute *xv_attr;
+       Atom prop_atom;
+       const char *channels[4] = { "XV_HUE", "XV_SATURATION", "XV_BRIGHTNESS", "XV_CONTRAST"};
+
+       g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), NULL);
+
+       xcontext = g_new0 (GstXContext, 1);
+       xcontext->im_format = 0;
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+
+       xcontext->disp = XOpenDisplay (evaspixmapsink->display_name);
+
+       if (!xcontext->disp) {
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               g_free (xcontext);
+               GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE, ("Could not initialise Xv output"), ("Could not open display"));
+               return NULL;
+       }
+
+       xcontext->screen = DefaultScreenOfDisplay (xcontext->disp);
+       xcontext->screen_num = DefaultScreen (xcontext->disp);
+       xcontext->visual = DefaultVisual (xcontext->disp, xcontext->screen_num);
+       xcontext->root = DefaultRootWindow (xcontext->disp);
+       xcontext->white = XWhitePixel (xcontext->disp, xcontext->screen_num);
+       xcontext->black = XBlackPixel (xcontext->disp, xcontext->screen_num);
+       xcontext->depth = DefaultDepthOfScreen (xcontext->screen);
+
+       xcontext->width = DisplayWidth (xcontext->disp, xcontext->screen_num);
+       xcontext->height = DisplayHeight (xcontext->disp, xcontext->screen_num);
+       xcontext->widthmm = DisplayWidthMM (xcontext->disp, xcontext->screen_num);
+       xcontext->heightmm = DisplayHeightMM (xcontext->disp, xcontext->screen_num);
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"X reports %dx%d pixels and %d mm x %d mm", xcontext->width, xcontext->height, xcontext->widthmm, xcontext->heightmm);
+
+       gst_evaspixmapsink_calculate_pixel_aspect_ratio (xcontext);
+       /* We get supported pixmap formats at supported depth */
+       px_formats = XListPixmapFormats (xcontext->disp, &nb_formats);
+
+       if (!px_formats) {
+               XCloseDisplay (xcontext->disp);
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               g_free (xcontext->par);
+               g_free (xcontext);
+               GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, SETTINGS,
+               ("Could not initialise Xv output"), ("Could not get pixel formats"));
+               return NULL;
+       }
+
+       /* We get bpp value corresponding to our running depth */
+       for (i = 0; i < nb_formats; i++) {
+               if (px_formats[i].depth == xcontext->depth)
+               xcontext->bpp = px_formats[i].bits_per_pixel;
+       }
+
+       XFree (px_formats);
+
+       xcontext->endianness = (ImageByteOrder (xcontext->disp) == LSBFirst) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
+
+       /* our caps system handles 24/32bpp RGB as big-endian. */
+       if ((xcontext->bpp == 24 || xcontext->bpp == 32) && xcontext->endianness == G_LITTLE_ENDIAN) {
+               xcontext->endianness = G_BIG_ENDIAN;
+               xcontext->visual->red_mask = GUINT32_TO_BE (xcontext->visual->red_mask);
+               xcontext->visual->green_mask = GUINT32_TO_BE (xcontext->visual->green_mask);
+               xcontext->visual->blue_mask = GUINT32_TO_BE (xcontext->visual->blue_mask);
+               if (xcontext->bpp == 24) {
+                       xcontext->visual->red_mask >>= 8;
+                       xcontext->visual->green_mask >>= 8;
+                       xcontext->visual->blue_mask >>= 8;
+               }
+       }
+
+       xcontext->caps = gst_evaspixmapsink_get_xv_support (evaspixmapsink, xcontext);
+
+       if (!xcontext->caps) {
+               XCloseDisplay (xcontext->disp);
+               g_mutex_unlock (evaspixmapsink->x_lock);
+               g_free (xcontext->par);
+               g_free (xcontext);
+               /* GST_ELEMENT_ERROR is thrown by gst_evaspixmapsink_get_xv_support */
+               return NULL;
+       }
+#ifdef HAVE_XSHM
+       /* Search for XShm extension support */
+       if (XShmQueryExtension (xcontext->disp) && gst_evaspixmapsink_check_xshm_calls (xcontext)) {
+               xcontext->use_xshm = TRUE;
+               GST_DEBUG_OBJECT (evaspixmapsink,"evaspixmapsink is using XShm extension");
+       } else
+#endif /* HAVE_XSHM */
+       {
+               xcontext->use_xshm = FALSE;
+               GST_DEBUG_OBJECT (evaspixmapsink,"evaspixmapsink is not using XShm extension");
+       }
+
+       xv_attr = XvQueryPortAttributes (xcontext->disp, xcontext->xv_port_id, &N_attr);
+
+       /* Generate the channels list */
+       for (i = 0; i < (sizeof (channels) / sizeof (char *)); i++) {
+               XvAttribute *matching_attr = NULL;
+
+               /* Retrieve the property atom if it exists. If it doesn't exist,
+               * the attribute itself must not either, so we can skip */
+               prop_atom = XInternAtom (xcontext->disp, channels[i], True);
+               if (prop_atom == None) {
+                       continue;
+               }
+
+               if (xv_attr != NULL) {
+                       for (j = 0; j < N_attr && matching_attr == NULL; ++j) {
+                               if (!g_ascii_strcasecmp (channels[i], xv_attr[j].name)) {
+                                       matching_attr = xv_attr + j;
+                               }
+                       }
+               }
+
+               if (matching_attr) {
+                       GstColorBalanceChannel *channel;
+                       channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
+                       channel->label = g_strdup (channels[i]);
+                       channel->min_value = matching_attr->min_value;
+                       channel->max_value = matching_attr->max_value;
+
+                       xcontext->channels_list = g_list_append (xcontext->channels_list, channel);
+
+                       /* If the colorbalance settings have not been touched we get Xv values
+                               as defaults and update our internal variables */
+                       if (!evaspixmapsink->cb_changed) {
+                               gint val;
+                               XvGetPortAttribute (xcontext->disp, xcontext->xv_port_id, prop_atom, &val);
+                               /* Normalize val to [-1000, 1000] */
+                               val = floor (0.5 + -1000 + 2000 * (val - channel->min_value) /  (double) (channel->max_value - channel->min_value));
+
+                               if (!g_ascii_strcasecmp (channels[i], "XV_HUE")) {
+                                       evaspixmapsink->hue = val;
+                               } else if (!g_ascii_strcasecmp (channels[i], "XV_SATURATION")) {
+                                       evaspixmapsink->saturation = val;
+                               } else if (!g_ascii_strcasecmp (channels[i], "XV_BRIGHTNESS")) {
+                                       evaspixmapsink->brightness = val;
+                               } else if (!g_ascii_strcasecmp (channels[i], "XV_CONTRAST")) {
+                                       evaspixmapsink->contrast = val;
+                               }
+                       }
+               }
+       }
+
+       if (xv_attr) {
+               XFree (xv_attr);
+       }
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+       return xcontext;
+}
+
+/* This function cleans the X context. Closing the Display, releasing the XV
+   port and unrefing the caps for supported formats. */
+static void
+gst_evaspixmapsink_xcontext_clear (GstEvasPixmapSink *evaspixmapsink)
+{
+  GList *formats_list, *channels_list;
+  GstXContext *xcontext;
+  gint i = 0;
+
+  g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+
+  GST_OBJECT_LOCK (evaspixmapsink);
+  if (evaspixmapsink->xcontext == NULL) {
+    GST_OBJECT_UNLOCK (evaspixmapsink);
+    return;
+  }
+
+  /* Take the XContext from the sink and clean it up */
+  xcontext = evaspixmapsink->xcontext;
+  evaspixmapsink->xcontext = NULL;
+
+  GST_OBJECT_UNLOCK (evaspixmapsink);
+
+  formats_list = xcontext->formats_list;
+
+  while (formats_list) {
+    GstEvasPixmapFormat *format = formats_list->data;
+
+    gst_caps_unref (format->caps);
+    g_free (format);
+    formats_list = g_list_next (formats_list);
+  }
+
+  if (xcontext->formats_list)
+    g_list_free (xcontext->formats_list);
+
+  channels_list = xcontext->channels_list;
+
+  while (channels_list) {
+    GstColorBalanceChannel *channel = channels_list->data;
+
+    g_object_unref (channel);
+    channels_list = g_list_next (channels_list);
+  }
+
+  if (xcontext->channels_list)
+    g_list_free (xcontext->channels_list);
+
+  gst_caps_unref (xcontext->caps);
+
+  for (i = 0; i < xcontext->nb_adaptors; i++) {
+    g_free (xcontext->adaptors[i]);
+  }
+
+  g_free (xcontext->adaptors);
+
+  g_free (xcontext->par);
+
+  g_mutex_lock (evaspixmapsink->x_lock);
+
+  GST_DEBUG_OBJECT (evaspixmapsink,"Closing display and freeing X Context");
+
+  XvUngrabPort (xcontext->disp, xcontext->xv_port_id, 0);
+
+  XCloseDisplay (xcontext->disp);
+
+  g_mutex_unlock (evaspixmapsink->x_lock);
+
+  g_free (xcontext);
+}
+
+/* Element stuff */
+
+/* This function tries to get a format matching with a given caps in the
+   supported list of formats we generated in gst_evaspixmapsink_get_xv_support */
+static gint
+gst_evaspixmapsink_get_format_from_caps (GstEvasPixmapSink *evaspixmapsink, GstCaps *caps)
+{
+  GList *list = NULL;
+
+  g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), 0);
+
+  list = evaspixmapsink->xcontext->formats_list;
+
+  while (list) {
+    GstEvasPixmapFormat *format = list->data;
+
+    if (format) {
+      if (gst_caps_can_intersect (caps, format->caps)) {
+        return format->format;
+      }
+    }
+    list = g_list_next (list);
+  }
+
+  return -1;
+}
+
+static GstCaps *
+gst_evaspixmapsink_getcaps (GstBaseSink *bsink)
+{
+  GstEvasPixmapSink *evaspixmapsink;
+
+  evaspixmapsink = GST_EVASPIXMAPSINK (bsink);
+
+  if (evaspixmapsink->xcontext)
+    return gst_caps_ref (evaspixmapsink->xcontext->caps);
+
+  return
+      gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_SINK_PAD
+          (evaspixmapsink)));
+}
+
+static gboolean
+gst_evaspixmapsink_setcaps (GstBaseSink *bsink, GstCaps *caps)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+       GstStructure *structure;
+       guint32 im_format = 0;
+       gboolean ret;
+       gint video_width, video_height;
+       gint disp_x, disp_y;
+       gint disp_width, disp_height;
+       gint video_par_n, video_par_d;        /* video's PAR */
+       gint display_par_n, display_par_d;    /* display's PAR */
+       const GValue *caps_par;
+       const GValue *caps_disp_reg;
+       const GValue *fps;
+       guint num, den;
+       gboolean enable_last_buffer;
+
+       evaspixmapsink = GST_EVASPIXMAPSINK (bsink);
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"In setcaps. Possible caps %" GST_PTR_FORMAT ", setting caps %" GST_PTR_FORMAT, evaspixmapsink->xcontext->caps, caps);
+
+       if (!gst_caps_can_intersect (evaspixmapsink->xcontext->caps, caps)) {
+               goto incompatible_caps;
+       }
+
+       structure = gst_caps_get_structure (caps, 0);
+       ret = gst_structure_get_int (structure, "width", &video_width);
+       ret &= gst_structure_get_int (structure, "height", &video_height);
+       fps = gst_structure_get_value (structure, "framerate");
+       ret &= (fps != NULL);
+
+       if (!ret) {
+               goto incomplete_caps;
+       }
+
+       evaspixmapsink->aligned_width = video_width;
+       evaspixmapsink->aligned_height = video_height;
+
+       /* get enable-last-buffer */
+       g_object_get(G_OBJECT(evaspixmapsink), "enable-last-buffer", &enable_last_buffer, NULL);
+       GST_INFO_OBJECT (evaspixmapsink,"current enable-last-buffer : %d", enable_last_buffer);
+       /* flush if enable-last-buffer is TRUE */
+       if (enable_last_buffer) {
+               GST_INFO_OBJECT (evaspixmapsink,"flush last-buffer");
+               g_object_set(G_OBJECT(evaspixmapsink), "enable-last-buffer", FALSE, NULL);
+               g_object_set(G_OBJECT(evaspixmapsink), "enable-last-buffer", TRUE, NULL);
+       }
+
+       evaspixmapsink->fps_n = gst_value_get_fraction_numerator (fps);
+       evaspixmapsink->fps_d = gst_value_get_fraction_denominator (fps);
+
+       evaspixmapsink->video_width = video_width;
+       evaspixmapsink->video_height = video_height;
+
+       im_format = gst_evaspixmapsink_get_format_from_caps (evaspixmapsink, caps);
+       if (im_format == -1) {
+               goto invalid_format;
+       }
+
+       /* get aspect ratio from caps if it's present, and
+       * convert video width and height to a display width and height
+       * using wd / hd = wv / hv * PARv / PARd */
+
+       /* get video's PAR */
+       caps_par = gst_structure_get_value (structure, "pixel-aspect-ratio");
+       if (caps_par) {
+               video_par_n = gst_value_get_fraction_numerator (caps_par);
+               video_par_d = gst_value_get_fraction_denominator (caps_par);
+       } else {
+               video_par_n = 1;
+               video_par_d = 1;
+       }
+       /* get display's PAR */
+       if (evaspixmapsink->par) {
+               display_par_n = gst_value_get_fraction_numerator (evaspixmapsink->par);
+               display_par_d = gst_value_get_fraction_denominator (evaspixmapsink->par);
+       } else {
+               display_par_n = 1;
+               display_par_d = 1;
+       }
+
+       /* get the display region */
+       caps_disp_reg = gst_structure_get_value (structure, "display-region");
+       if (caps_disp_reg) {
+               disp_x = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 0));
+               disp_y = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 1));
+               disp_width = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 2));
+               disp_height = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 3));
+       } else {
+               disp_x = disp_y = 0;
+               disp_width = video_width;
+               disp_height = video_height;
+       }
+
+       if (!gst_video_calculate_display_ratio (&num, &den, video_width, video_height, video_par_n, video_par_d, display_par_n, display_par_d)) {
+               goto no_disp_ratio;
+       }
+
+       evaspixmapsink->disp_x = disp_x;
+       evaspixmapsink->disp_y = disp_y;
+       evaspixmapsink->disp_width = disp_width;
+       evaspixmapsink->disp_height = disp_height;
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"video width/height: %dx%d, calculated display ratio: %d/%d",  video_width, video_height, num, den);
+
+       /* now find a width x height that respects this display ratio.
+       * prefer those that have one of w/h the same as the incoming video
+       * using wd / hd = num / den */
+
+       /* start with same height, because of interlaced video */
+       /* check hd / den is an integer scale factor, and scale wd with the PAR */
+       if (video_height % den == 0) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"keeping video height");
+               GST_VIDEO_SINK_WIDTH (evaspixmapsink) = (guint) gst_util_uint64_scale_int (video_height, num, den);
+               GST_VIDEO_SINK_HEIGHT (evaspixmapsink) = video_height;
+       } else if (video_width % num == 0) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"keeping video width");
+               GST_VIDEO_SINK_WIDTH (evaspixmapsink) = video_width;
+               GST_VIDEO_SINK_HEIGHT (evaspixmapsink) = (guint) gst_util_uint64_scale_int (video_width, den, num);
+       } else {
+               GST_DEBUG_OBJECT (evaspixmapsink,"approximating while keeping video height");
+               GST_VIDEO_SINK_WIDTH (evaspixmapsink) = (guint) gst_util_uint64_scale_int (video_height, num, den);
+               GST_VIDEO_SINK_HEIGHT (evaspixmapsink) = video_height;
+       }
+       GST_DEBUG_OBJECT (evaspixmapsink,"scaling to %dx%d", GST_VIDEO_SINK_WIDTH (evaspixmapsink), GST_VIDEO_SINK_HEIGHT (evaspixmapsink));
+
+       /* Creating our window and our image with the display size in pixels */
+       if (GST_VIDEO_SINK_WIDTH (evaspixmapsink) <= 0 || GST_VIDEO_SINK_HEIGHT (evaspixmapsink) <= 0) {
+               goto no_display_size;
+       }
+
+       g_mutex_lock (evaspixmapsink->flow_lock);
+
+       /* We renew our evaspixmap buffer only if size or format changed;
+       * the evaspixmap buffer is the same size as the video pixel size */
+       if ((evaspixmapsink->evas_pixmap_buf) && ((im_format != evaspixmapsink->evas_pixmap_buf->im_format)
+               || (video_width != evaspixmapsink->evas_pixmap_buf->width) || (video_height != evaspixmapsink->evas_pixmap_buf->height))) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"old format %" GST_FOURCC_FORMAT ", new format %" GST_FOURCC_FORMAT,
+                               GST_FOURCC_ARGS (evaspixmapsink->evas_pixmap_buf->im_format), GST_FOURCC_ARGS (im_format));
+               GST_DEBUG_OBJECT (evaspixmapsink,"renewing evaspixmap buffer");
+               gst_buffer_unref (GST_BUFFER (evaspixmapsink->evas_pixmap_buf));
+               evaspixmapsink->evas_pixmap_buf = NULL;
+       }
+
+       g_mutex_unlock (evaspixmapsink->flow_lock);
+
+       if (evaspixmapsink->eo) {
+               if (!gst_evaspixmapsink_xpixmap_link (evaspixmapsink)) {
+                       GST_ERROR_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                       return FALSE;
+               } else {
+                       gst_evaspixmapsink_manage_event_thread (evaspixmapsink);
+               }
+       } else {
+               GST_ERROR_OBJECT (evaspixmapsink,"setcaps success, but there is no evas image object..");
+               return FALSE;
+       }
+
+       return TRUE;
+
+       /* ERRORS */
+       incompatible_caps:
+       {
+               GST_ERROR_OBJECT (evaspixmapsink,"caps incompatible");
+               return FALSE;
+       }
+       incomplete_caps:
+       {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Failed to retrieve either width, ""height or framerate from intersected caps");
+               return FALSE;
+       }
+       invalid_format:
+       {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Could not locate image format from caps %" GST_PTR_FORMAT, caps);
+               return FALSE;
+       }
+       no_disp_ratio:
+       {
+               GST_ELEMENT_ERROR (evaspixmapsink, CORE, NEGOTIATION, (NULL), ("Error calculating the output display ratio of the video."));
+               return FALSE;
+       }
+       no_display_size:
+       {
+               GST_ELEMENT_ERROR (evaspixmapsink, CORE, NEGOTIATION, (NULL), ("Error calculating the output display ratio of the video."));
+               return FALSE;
+       }
+}
+
+static GstStateChangeReturn
+gst_evaspixmapsink_change_state (GstElement *element, GstStateChange transition)
+{
+       GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
+       GstEvasPixmapSink *evaspixmapsink;
+
+       evaspixmapsink = GST_EVASPIXMAPSINK (element);
+
+       switch (transition) {
+       case GST_STATE_CHANGE_NULL_TO_READY:
+               g_mutex_lock (evaspixmapsink->flow_lock);
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_NULL_TO_READY");
+
+               /* open drm to use gem */
+               if (drm_init(evaspixmapsink)) {
+                       GST_ERROR_OBJECT (evaspixmapsink,"drm_init() failure");
+                       g_mutex_unlock (evaspixmapsink->flow_lock);
+                       return GST_STATE_CHANGE_FAILURE;
+               }
+
+               /* check if there exist evas image object, need to write code related to making internal evas image object */
+               if (!is_evas_image_object (evaspixmapsink->eo)) {
+                       GST_ERROR_OBJECT (evaspixmapsink,"There is no evas image object..");
+                       g_mutex_unlock (evaspixmapsink->flow_lock);
+                       return GST_STATE_CHANGE_FAILURE;
+               }
+
+               /* Set xcontext and display */
+               if (!evaspixmapsink->xcontext) {
+                       evaspixmapsink->xcontext = gst_evaspixmapsink_xcontext_get (evaspixmapsink);
+                       if (!evaspixmapsink->xcontext) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"could not get xcontext..");
+                               g_mutex_unlock (evaspixmapsink->flow_lock);
+                               return GST_STATE_CHANGE_FAILURE;
+                       }
+               }
+
+               /* update object's par with calculated one if not set yet */
+               if (!evaspixmapsink->par) {
+                       evaspixmapsink->par = g_new0 (GValue, 1);
+                       gst_value_init_and_copy (evaspixmapsink->par, evaspixmapsink->xcontext->par);
+                       GST_DEBUG_OBJECT (evaspixmapsink,"set calculated PAR on object's PAR");
+               }
+
+               /* call XSynchronize with the current value of synchronous */
+               GST_DEBUG_OBJECT (evaspixmapsink,"XSynchronize called with %s", evaspixmapsink->synchronous ? "TRUE" : "FALSE");
+               XSynchronize (evaspixmapsink->xcontext->disp, evaspixmapsink->synchronous);
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+
+               g_mutex_unlock (evaspixmapsink->flow_lock);
+               break;
+
+       case GST_STATE_CHANGE_READY_TO_PAUSED:
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_READY_TO_PAUSED");
+               break;
+
+       case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_PAUSED_TO_PLAYING");
+               break;
+
+       default:
+               break;
+       }
+
+       ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+
+       switch (transition) {
+       case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_PLAYING_TO_PAUSED");
+               break;
+
+       case GST_STATE_CHANGE_PAUSED_TO_READY:
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_PAUSED_TO_READY");
+               evaspixmapsink->fps_n = 0;
+               evaspixmapsink->fps_d = 1;
+               GST_VIDEO_SINK_WIDTH (evaspixmapsink) = 0;
+               GST_VIDEO_SINK_HEIGHT (evaspixmapsink) = 0;
+               drm_fini_close_gem_handle(evaspixmapsink, 0);
+               break;
+
+       case GST_STATE_CHANGE_READY_TO_NULL:
+               GST_WARNING_OBJECT (evaspixmapsink,"GST_STATE_CHANGE_READY_TO_NULL");
+               gst_evaspixmapsink_reset(evaspixmapsink);
+               /* close drm */
+               drm_fini(evaspixmapsink);
+               break;
+
+       default:
+               break;
+       }
+       return ret;
+}
+
+static void
+gst_evaspixmapsink_get_times (GstBaseSink *bsink, GstBuffer *buf, GstClockTime *start, GstClockTime *end)
+{
+  GstEvasPixmapSink *evaspixmapsink;
+
+  evaspixmapsink = GST_EVASPIXMAPSINK (bsink);
+
+  if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
+    *start = GST_BUFFER_TIMESTAMP (buf);
+    if (GST_BUFFER_DURATION_IS_VALID (buf)) {
+      *end = *start + GST_BUFFER_DURATION (buf);
+    } else {
+      if (evaspixmapsink->fps_n > 0) {
+        *end = *start +
+            gst_util_uint64_scale_int (GST_SECOND, evaspixmapsink->fps_d,
+            evaspixmapsink->fps_n);
+      }
+    }
+  }
+}
+
+static GstFlowReturn
+gst_evaspixmapsink_show_frame (GstVideoSink *vsink, GstBuffer *buf)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+       XV_DATA_PTR img_data = NULL;
+       SCMN_IMGB *scmn_imgb = NULL;
+       gint format = 0;
+
+       MMTA_ACUM_ITEM_BEGIN("evaspixmapsink gst_evaspixmapsink_show_frame()", FALSE);
+
+       evaspixmapsink = GST_EVASPIXMAPSINK (vsink);
+
+       if( evaspixmapsink->stop_video ) {
+               GST_INFO_OBJECT (evaspixmapsink, "Stop video is TRUE. so skip show frame..." );
+               return GST_FLOW_OK;
+       }
+
+       if (!evaspixmapsink->evas_pixmap_buf) {
+               GST_DEBUG_OBJECT (evaspixmapsink,"creating our evaspixmap buffer");
+               format = gst_evaspixmapsink_get_format_from_caps(evaspixmapsink, GST_BUFFER_CAPS(buf));
+               switch (format) {
+               case GST_MAKE_FOURCC('S', 'T', '1', '2'):
+               case GST_MAKE_FOURCC('S', 'N', '1', '2'):
+               case GST_MAKE_FOURCC('S', '4', '2', '0'):
+               case GST_MAKE_FOURCC('S', 'U', 'Y', '2'):
+               case GST_MAKE_FOURCC('S', 'U', 'Y', 'V'):
+               case GST_MAKE_FOURCC('S', 'Y', 'V', 'Y'):
+               case GST_MAKE_FOURCC('I', 'T', 'L', 'V'):
+               case GST_MAKE_FOURCC('S', 'R', '3', '2'):
+                       scmn_imgb = (SCMN_IMGB *)GST_BUFFER_MALLOCDATA(buf);
+                       if(scmn_imgb == NULL) {
+                               GST_DEBUG_OBJECT (evaspixmapsink, "scmn_imgb is NULL. Skip buffer put..." );
+                               return GST_FLOW_OK;
+                       }
+                        /* skip buffer if aligned size is smaller than size of caps */
+                       if (scmn_imgb->s[0] < evaspixmapsink->video_width || scmn_imgb->e[0] < evaspixmapsink->video_height) {
+                               GST_WARNING_OBJECT (evaspixmapsink,"invalid size[caps:%dx%d,aligned:%dx%d]. Skip this buffer...",
+                                               evaspixmapsink->video_width, evaspixmapsink->video_height, scmn_imgb->s[0], scmn_imgb->e[0]);
+                               return GST_FLOW_OK;
+                       }
+                       evaspixmapsink->aligned_width = scmn_imgb->s[0];
+                       evaspixmapsink->aligned_height = scmn_imgb->e[0];
+                       GST_DEBUG_OBJECT (evaspixmapsink,"video width,height[%dx%d]",evaspixmapsink->video_width, evaspixmapsink->video_height);
+                       GST_INFO_OBJECT (evaspixmapsink,"Use aligned width,height[%dx%d]",evaspixmapsink->aligned_width, evaspixmapsink->aligned_height);
+                       break;
+               default:
+                       GST_INFO_OBJECT (evaspixmapsink,"Use original width,height of caps");
+                       break;
+               }
+               evaspixmapsink->evas_pixmap_buf = gst_evaspixmap_buffer_new (evaspixmapsink, GST_BUFFER_CAPS (buf));
+               if (!evaspixmapsink->evas_pixmap_buf) {
+                       /* The create method should have posted an informative error */
+                       goto no_image;
+               }
+               if (evaspixmapsink->evas_pixmap_buf->size < GST_BUFFER_SIZE (buf)) {
+                       GST_ELEMENT_ERROR (evaspixmapsink, RESOURCE, WRITE, ("Failed to create output image buffer of %dx%d pixels",    evaspixmapsink->evas_pixmap_buf->width, evaspixmapsink->evas_pixmap_buf->height),("XServer allocated buffer size did not match input buffer"));
+                       gst_evaspixmap_buffer_destroy (evaspixmapsink->evas_pixmap_buf);
+                       evaspixmapsink->evas_pixmap_buf = NULL;
+                       goto no_image;
+               }
+       }
+
+       switch (evaspixmapsink->evas_pixmap_buf->im_format) {
+       /* Cases for specified formats of Samsung extension */
+       case GST_MAKE_FOURCC('S', 'T', '1', '2'):
+       case GST_MAKE_FOURCC('S', 'N', '1', '2'):
+       case GST_MAKE_FOURCC('S', '4', '2', '0'):
+       case GST_MAKE_FOURCC('S', 'U', 'Y', '2'):
+       case GST_MAKE_FOURCC('S', 'U', 'Y', 'V'):
+       case GST_MAKE_FOURCC('S', 'Y', 'V', 'Y'):
+       case GST_MAKE_FOURCC('I', 'T', 'L', 'V'):
+       case GST_MAKE_FOURCC('S', 'R', '3', '2'):
+       {
+               GST_DEBUG_OBJECT (evaspixmapsink,"Samsung extension display format activated. fourcc:%d", evaspixmapsink->evas_pixmap_buf->im_format);
+
+               if (evaspixmapsink->evas_pixmap_buf->xvimage->data) {
+                       img_data = (XV_DATA_PTR) evaspixmapsink->evas_pixmap_buf->xvimage->data;
+                       XV_INIT_DATA(img_data);
+                       scmn_imgb = (SCMN_IMGB *)GST_BUFFER_MALLOCDATA(buf);
+                       if (scmn_imgb == NULL) {
+                               GST_DEBUG_OBJECT (evaspixmapsink, "scmn_imgb is NULL. Skip buffer put..." );
+                               return GST_FLOW_OK;
+                       }
+
+                       if (scmn_imgb->buf_share_method == BUF_SHARE_METHOD_PADDR) {
+                               img_data->YBuf = (unsigned int)scmn_imgb->p[0];
+                               img_data->CbBuf = (unsigned int)scmn_imgb->p[1];
+                               img_data->CrBuf = (unsigned int)scmn_imgb->p[2];
+                               img_data->BufType = XV_BUF_TYPE_LEGACY;
+
+                       } else if (scmn_imgb->buf_share_method == BUF_SHARE_METHOD_FD) {
+                               /* set gem information to gem_info structure of handle and convert dma-buf fd into drm gem name  */
+                               img_data->YBuf = drm_init_convert_dmabuf_gemname(evaspixmapsink, (int)scmn_imgb->dma_buf_fd[0]);
+                               img_data->CbBuf = drm_init_convert_dmabuf_gemname(evaspixmapsink, (int)scmn_imgb->dma_buf_fd[1]);
+                               img_data->CrBuf = drm_init_convert_dmabuf_gemname(evaspixmapsink, (int)scmn_imgb->dma_buf_fd[2]);
+                               img_data->BufType = XV_BUF_TYPE_DMABUF;
+                               if (evaspixmapsink->buf_shared_type != BUF_SHARE_METHOD_FD) {
+                                       evaspixmapsink->buf_shared_type = BUF_SHARE_METHOD_FD;
+                                       GST_WARNING_OBJECT (evaspixmapsink, "BUF SHARED TYPE : FD");
+                               }
+
+                       } else if (scmn_imgb->buf_share_method == BUF_SHARE_METHOD_TIZEN_BUFFER) {
+                               img_data->bo[0] = scmn_imgb->bo[0];
+                               img_data->bo[1] = scmn_imgb->bo[1];
+                               img_data->bo[2] = scmn_imgb->bo[2];
+                               GST_DEBUG("TBM bo %p %p %p", img_data->bo[0], img_data->bo[1], img_data->bo[2]);
+                               /* export bo */
+                               if (img_data->bo[0]) {
+                                       img_data->YBuf = tbm_init_convert_bo_gemname(evaspixmapsink, img_data->bo[0]);
+                               }
+                               if (img_data->bo[1]) {
+                                       img_data->CbBuf = tbm_init_convert_bo_gemname(evaspixmapsink, img_data->bo[1]);
+                               }
+                               if (img_data->bo[2]) {
+                                       img_data->CrBuf = tbm_init_convert_bo_gemname(evaspixmapsink, img_data->bo[2]);
+                               }
+                               if (evaspixmapsink->buf_shared_type != BUF_SHARE_METHOD_TIZEN_BUFFER) {
+                                       evaspixmapsink->buf_shared_type = BUF_SHARE_METHOD_TIZEN_BUFFER;
+                                       GST_WARNING_OBJECT (evaspixmapsink, "BUF SHARED TYPE : TIZEN BUFFER");
+                               }
+                       } else {
+                               GST_WARNING_OBJECT (evaspixmapsink, "Not supported, buf_share_method(%d)", scmn_imgb->buf_share_method);
+                               return GST_FLOW_OK;
+                       }
+                       if (!img_data->YBuf) {
+                               GST_WARNING_OBJECT (evaspixmapsink, "img_data->YBuf is NULL. skip buffer put..." );
+                               return GST_FLOW_OK;
+                       }
+                       GST_LOG_OBJECT(evaspixmapsink, "YBuf[%d], CbBuf[%d], CrBuf[%d]",
+                                       img_data->YBuf, img_data->CbBuf, img_data->CrBuf );
+               } else {
+                       GST_WARNING_OBJECT (evaspixmapsink, "xvimage->data is NULL. skip buffer put..." );
+                       return GST_FLOW_OK;
+               }
+               break;
+       }
+       default:
+       {
+               if (evaspixmapsink->buf_shared_type != BUF_SHARE_METHOD_NONE) {
+                       evaspixmapsink->buf_shared_type = BUF_SHARE_METHOD_NONE;
+               }
+               GST_DEBUG_OBJECT (evaspixmapsink,"Normal format activated. fourcc = %d", evaspixmapsink->evas_pixmap_buf->im_format);
+               __ta__("evaspixmapsink memcpy in _show_frame", memcpy (evaspixmapsink->evas_pixmap_buf->xvimage->data, GST_BUFFER_DATA (buf),
+               MIN (GST_BUFFER_SIZE (buf), evaspixmapsink->evas_pixmap_buf->size)););
+               break;
+       }
+       }
+       if (!gst_evaspixmap_buffer_put (evaspixmapsink, evaspixmapsink->evas_pixmap_buf)) {
+               MMTA_ACUM_ITEM_END("evaspixmapsink gst_evaspixmapsink_show_frame()", FALSE);
+               return GST_FLOW_OK;
+       }
+
+       MMTA_ACUM_ITEM_END("evaspixmapsink gst_evaspixmapsink_show_frame()", FALSE);
+
+       return GST_FLOW_OK;
+
+       /* ERRORS */
+       no_image:
+       {
+               /* No image available. That's very bad ! */
+               GST_WARNING_OBJECT (evaspixmapsink,"could not create image");
+               return GST_FLOW_ERROR;
+       }
+}
+
+static gboolean
+gst_evaspixmapsink_event (GstBaseSink *sink, GstEvent *event)
+{
+       GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (sink);
+
+       switch (GST_EVENT_TYPE (event)) {
+       case GST_EVENT_FLUSH_START:
+               GST_DEBUG_OBJECT (evaspixmapsink,"GST_EVENT_FLUSH_START");
+               break;
+       case GST_EVENT_FLUSH_STOP:
+               GST_DEBUG_OBJECT (evaspixmapsink,"GST_EVENT_FLUSH_STOP");
+               break;
+       default:
+               break;
+       }
+       if (GST_BASE_SINK_CLASS (parent_class)->event) {
+               return GST_BASE_SINK_CLASS (parent_class)->event (sink, event);
+       } else {
+               return TRUE;
+       }
+}
+
+/* Interfaces stuff */
+
+static gboolean
+gst_evaspixmapsink_interface_supported (GstImplementsInterface *iface, GType type)
+{
+  g_assert (type == GST_TYPE_NAVIGATION || type == GST_TYPE_COLOR_BALANCE || type == GST_TYPE_PROPERTY_PROBE);
+  return TRUE;
+}
+
+static void
+gst_evaspixmapsink_interface_init (GstImplementsInterfaceClass *klass)
+{
+  klass->supported = gst_evaspixmapsink_interface_supported;
+}
+
+static void
+gst_evaspixmapsink_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (navigation);
+  GstPad *peer;
+  int i = 0;
+
+  if ((peer = gst_pad_get_peer (GST_VIDEO_SINK_PAD (evaspixmapsink)))) {
+    GstEvent *event;
+    GstVideoRectangle result;
+    gdouble x, y, xscale = 1.0, yscale = 1.0;
+
+    event = gst_event_new_navigation (structure);
+
+    /* We take the flow_lock while we look at the window */
+    g_mutex_lock (evaspixmapsink->flow_lock);
+
+    for (i = 0; i < evaspixmapsink->num_of_pixmaps; i ++) {
+      if (!evaspixmapsink->xpixmap[i]) {
+        g_mutex_unlock (evaspixmapsink->flow_lock);
+        return;
+      }
+    }
+
+    memcpy (&result, &evaspixmapsink->render_rect, sizeof (GstVideoRectangle));
+
+    g_mutex_unlock (evaspixmapsink->flow_lock);
+
+    /* We calculate scaling using the original video frames geometry to include
+       pixel aspect ratio scaling. */
+    xscale = (gdouble) evaspixmapsink->video_width / result.w;
+    yscale = (gdouble) evaspixmapsink->video_height / result.h;
+
+    /* Converting pointer coordinates to the non scaled geometry */
+    if (gst_structure_get_double (structure, "pointer_x", &x)) {
+      x = MIN (x, result.x + result.w);
+      x = MAX (x - result.x, 0);
+      gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
+          (gdouble) x * xscale, NULL);
+    }
+    if (gst_structure_get_double (structure, "pointer_y", &y)) {
+      y = MIN (y, result.y + result.h);
+      y = MAX (y - result.y, 0);
+      gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
+          (gdouble) y * yscale, NULL);
+    }
+
+    gst_pad_send_event (peer, event);
+    gst_object_unref (peer);
+  }
+}
+
+static void
+gst_evaspixmapsink_navigation_init (GstNavigationInterface *iface)
+{
+  iface->send_event = gst_evaspixmapsink_navigation_send_event;
+}
+
+static const GList*
+gst_evaspixmapsink_colorbalance_list_channels (GstColorBalance *balance)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (balance);
+
+  g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), NULL);
+
+  if (evaspixmapsink->xcontext)
+    return evaspixmapsink->xcontext->channels_list;
+  else
+    return NULL;
+}
+
+static void
+gst_evaspixmapsink_colorbalance_set_value (GstColorBalance *balance, GstColorBalanceChannel *channel, gint value)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (balance);
+
+  g_return_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink));
+  g_return_if_fail (channel->label != NULL);
+
+  evaspixmapsink->cb_changed = TRUE;
+
+  /* Normalize val to [-1000, 1000] */
+  value = floor (0.5 + -1000 + 2000 * (value - channel->min_value) /
+      (double) (channel->max_value - channel->min_value));
+
+  if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) {
+    evaspixmapsink->hue = value;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) {
+    evaspixmapsink->saturation = value;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) {
+    evaspixmapsink->contrast = value;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) {
+    evaspixmapsink->brightness = value;
+  } else {
+    g_warning ("got an unknown channel %s", channel->label);
+    return;
+  }
+
+  gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+}
+
+static gint
+gst_evaspixmapsink_colorbalance_get_value (GstColorBalance *balance, GstColorBalanceChannel *channel)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (balance);
+  gint value = 0;
+
+  g_return_val_if_fail (GST_IS_EVASPIXMAPSINK (evaspixmapsink), 0);
+  g_return_val_if_fail (channel->label != NULL, 0);
+
+  if (g_ascii_strcasecmp (channel->label, "XV_HUE") == 0) {
+    value = evaspixmapsink->hue;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_SATURATION") == 0) {
+    value = evaspixmapsink->saturation;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_CONTRAST") == 0) {
+    value = evaspixmapsink->contrast;
+  } else if (g_ascii_strcasecmp (channel->label, "XV_BRIGHTNESS") == 0) {
+    value = evaspixmapsink->brightness;
+  } else {
+    g_warning ("got an unknown channel %s", channel->label);
+  }
+
+  /* Normalize val to [channel->min_value, channel->max_value] */
+  value = channel->min_value + (channel->max_value - channel->min_value) * (value + 1000) / 2000;
+
+  return value;
+}
+
+static void
+gst_evaspixmapsink_colorbalance_init (GstColorBalanceClass *iface)
+{
+  GST_COLOR_BALANCE_TYPE (iface) = GST_COLOR_BALANCE_HARDWARE;
+  iface->list_channels = gst_evaspixmapsink_colorbalance_list_channels;
+  iface->set_value = gst_evaspixmapsink_colorbalance_set_value;
+  iface->get_value = gst_evaspixmapsink_colorbalance_get_value;
+}
+
+static const GList *
+gst_evaspixmapsink_probe_get_properties (GstPropertyProbe *probe)
+{
+       GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
+       static GList *list = NULL;
+
+       if (!list) {
+               list = g_list_append (NULL, g_object_class_find_property (klass, "device"));
+               list = g_list_append (list, g_object_class_find_property (klass, "autopaint-colorkey"));
+               list = g_list_append (list, g_object_class_find_property (klass, "double-buffer"));
+               list = g_list_append (list, g_object_class_find_property (klass, "colorkey"));
+       }
+
+       return list;
+}
+
+static void
+gst_evaspixmapsink_probe_probe_property (GstPropertyProbe *probe, guint prop_id, const GParamSpec *pspec)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (probe);
+
+  switch (prop_id) {
+    case PROP_DEVICE:
+    case PROP_AUTOPAINT_COLORKEY:
+    case PROP_DOUBLE_BUFFER:
+    case PROP_COLORKEY:
+      GST_DEBUG_OBJECT (evaspixmapsink,"probing device list and get capabilities");
+      if (!evaspixmapsink->xcontext) {
+        GST_DEBUG_OBJECT (evaspixmapsink,"generating xcontext");
+        evaspixmapsink->xcontext = gst_evaspixmapsink_xcontext_get (evaspixmapsink);
+        if (!evaspixmapsink->xcontext) {
+          GST_ERROR_OBJECT (evaspixmapsink,"could not get xcontext..");
+        }
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
+      break;
+  }
+}
+
+static gboolean
+gst_evaspixmapsink_probe_needs_probe (GstPropertyProbe *probe, guint prop_id, const GParamSpec *pspec)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (probe);
+  gboolean ret = FALSE;
+
+  switch (prop_id) {
+    case PROP_DEVICE:
+    case PROP_AUTOPAINT_COLORKEY:
+    case PROP_DOUBLE_BUFFER:
+    case PROP_COLORKEY:
+      if (evaspixmapsink->xcontext != NULL) {
+        ret = FALSE;
+      } else {
+        ret = TRUE;
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
+      break;
+  }
+
+  return ret;
+}
+
+static GValueArray *
+gst_evaspixmapsink_probe_get_values (GstPropertyProbe *probe, guint prop_id, const GParamSpec *pspec)
+{
+  GstEvasPixmapSink *evaspixmapsink = GST_EVASPIXMAPSINK (probe);
+  GValueArray *array = NULL;
+
+  if (G_UNLIKELY (!evaspixmapsink->xcontext)) {
+    GST_WARNING_OBJECT (evaspixmapsink,"we don't have any xcontext, can't "
+        "get values");
+    goto beach;
+  }
+
+  switch (prop_id) {
+    case PROP_DEVICE:
+    {
+      guint i;
+      GValue value = { 0 };
+
+      array = g_value_array_new (evaspixmapsink->xcontext->nb_adaptors);
+      g_value_init (&value, G_TYPE_STRING);
+
+      for (i = 0; i < evaspixmapsink->xcontext->nb_adaptors; i++) {
+        gchar *adaptor_id_s = g_strdup_printf ("%u", i);
+
+        g_value_set_string (&value, adaptor_id_s);
+        g_value_array_append (array, &value);
+        g_free (adaptor_id_s);
+      }
+      g_value_unset (&value);
+      break;
+    }
+    case PROP_AUTOPAINT_COLORKEY:
+      if (evaspixmapsink->have_autopaint_colorkey) {
+        GValue value = { 0 };
+
+        array = g_value_array_new (2);
+        g_value_init (&value, G_TYPE_BOOLEAN);
+        g_value_set_boolean (&value, FALSE);
+        g_value_array_append (array, &value);
+        g_value_set_boolean (&value, TRUE);
+        g_value_array_append (array, &value);
+        g_value_unset (&value);
+      }
+      break;
+    case PROP_DOUBLE_BUFFER:
+      if (evaspixmapsink->have_double_buffer) {
+        GValue value = { 0 };
+
+        array = g_value_array_new (2);
+        g_value_init (&value, G_TYPE_BOOLEAN);
+        g_value_set_boolean (&value, FALSE);
+        g_value_array_append (array, &value);
+        g_value_set_boolean (&value, TRUE);
+        g_value_array_append (array, &value);
+        g_value_unset (&value);
+      }
+      break;
+    case PROP_COLORKEY:
+      if (evaspixmapsink->have_colorkey) {
+        GValue value = { 0 };
+
+        array = g_value_array_new (1);
+        g_value_init (&value, GST_TYPE_INT_RANGE);
+        gst_value_set_int_range (&value, 0, 0xffffff);
+        g_value_array_append (array, &value);
+        g_value_unset (&value);
+      }
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (probe, prop_id, pspec);
+      break;
+  }
+
+beach:
+  return array;
+}
+
+static void
+gst_evaspixmapsink_property_probe_interface_init (GstPropertyProbeInterface *iface)
+{
+       iface->get_properties = gst_evaspixmapsink_probe_get_properties;
+       iface->probe_property = gst_evaspixmapsink_probe_probe_property;
+       iface->needs_probe = gst_evaspixmapsink_probe_needs_probe;
+       iface->get_values = gst_evaspixmapsink_probe_get_values;
+}
+
+static gboolean
+gst_evaspixmapsink_xpixmap_link (GstEvasPixmapSink *evaspixmapsink)
+{
+       Display *dpy;
+       Pixmap *pixmap_id[NUM_OF_PIXMAP];
+       int evas_object_width = 0;
+       int evas_object_height = 0;
+       int pixmap_width = 0;
+       int pixmap_height = 0;
+       unsigned int xw = 0;
+       unsigned int xh = 0;
+       int i = 0;
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START]");
+
+       if (!evaspixmapsink) {
+               GST_ERROR_OBJECT (evaspixmapsink,"could not get evaspixmapsink..");
+               return FALSE;
+       }
+       g_mutex_lock (evaspixmapsink->flow_lock);
+
+       /* Set xcontext and display */
+       if (!evaspixmapsink->xcontext) {
+               GST_WARNING_OBJECT (evaspixmapsink,"there's no xcontext, try to get one..");
+               evaspixmapsink->xcontext = gst_evaspixmapsink_xcontext_get (evaspixmapsink);
+               if (!evaspixmapsink->xcontext) {
+                       GST_ERROR_OBJECT (evaspixmapsink,"could not get xcontext..");
+                       return FALSE;
+               }
+       }
+
+       /* Set evas image object size */
+       evas_object_geometry_get(evaspixmapsink->eo, NULL, NULL, &evas_object_width, &evas_object_height);
+
+       /* check if it is redundant request */
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               if (evaspixmapsink->xpixmap[i]) {
+                       if (!evaspixmapsink->use_origin_size && evaspixmapsink->xpixmap[i]->width && evaspixmapsink->xpixmap[i]->height) {
+                               if (evaspixmapsink->xpixmap[i]->width == evas_object_width && evaspixmapsink->xpixmap[i]->height == evas_object_height) {
+                                       GST_WARNING_OBJECT (evaspixmapsink,"pixmap was already created(w:%d, h:%d), skip it..",
+                                               evaspixmapsink->xpixmap[i]->width, evaspixmapsink->xpixmap[i]->height);
+                                       goto SKIP_LINK;
+                               }
+                       }
+               }
+       }
+
+       dpy = evaspixmapsink->xcontext->disp;
+
+       if (evaspixmapsink->use_origin_size || !evas_object_width || !evas_object_height) {
+               pixmap_width = evaspixmapsink->video_width;
+               pixmap_height = evaspixmapsink->video_height;
+               GST_INFO_OBJECT (evaspixmapsink,"set size to media src size(%dx%d)", pixmap_width, pixmap_height);
+       }
+
+       g_mutex_lock (evaspixmapsink->x_lock);
+       evaspixmapsink->sizediff_width = 0;
+       evaspixmapsink->sizediff_height = 0;
+       if (evaspixmapsink->use_origin_size || !evas_object_width || !evas_object_height) {
+               XvQueryBestSize(dpy, evaspixmapsink->xcontext->xv_port_id,0,0,0, pixmap_width, pixmap_height, &xw, &xh);
+               if (!evas_object_width || !evas_object_height) {
+                       evaspixmapsink->w = xw;
+                       evaspixmapsink->h = xh;
+               } else {
+                       evaspixmapsink->w = evas_object_width;
+                       evaspixmapsink->h = evas_object_height;
+               }
+               GST_DEBUG_OBJECT (evaspixmapsink,"XvQueryBestSize : xv_port_id(%d), w(%d),h(%d) => xw(%d),xh(%d)", evaspixmapsink->xcontext->xv_port_id, pixmap_width, pixmap_height, xw, xh);
+       } else {
+               XvQueryBestSize(dpy, evaspixmapsink->xcontext->xv_port_id,0,0,0, evas_object_width, evas_object_height, &xw, &xh);
+               GST_DEBUG_OBJECT (evaspixmapsink,"XvQueryBestSize : xv_port_id(%d), w(%d),h(%d) => xw(%d),xh(%d)", evaspixmapsink->xcontext->xv_port_id, evas_object_width, evas_object_height, xw, xh);
+               evaspixmapsink->w = xw;
+               evaspixmapsink->h = xh;
+               /* update difference of size information (between evas image object's and pixmap's) */
+               evaspixmapsink->sizediff_width = xw - evas_object_width;
+               evaspixmapsink->sizediff_height = xh - evas_object_height;
+       }
+
+       /* create xpixmap structure */
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               if (!evaspixmapsink->xpixmap[i]) {
+                       /* xpixmap can be created in this function only */
+                       evaspixmapsink->xpixmap[i] = g_new0 (GstXPixmap, 1);
+                       if(!evaspixmapsink->xpixmap[i]) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"xpixmap is not valid..");
+                               int j = 0;
+                               for (j = 0; j < i; j++) {
+                                       g_free(evaspixmapsink->xpixmap[j]);
+                               }
+                               goto GO_OUT_OF_FUNC;
+                       }
+               }
+       }
+
+       /* create pixmap */
+       if (!xw || !xh) {
+               GST_WARNING_OBJECT (evaspixmapsink,"skip creating pixmap..xw(%d),xh(%d)",xw,xh);
+               goto GO_OUT_OF_FUNC;
+       } else {
+               /* multiple pixmaps creation */
+               for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                       pixmap_id[i] = XCreatePixmap(dpy, DefaultRootWindow(dpy), xw, xh, DefaultDepth(dpy, DefaultScreen(dpy)));
+                       if ( (int)pixmap_id[i] == BadAlloc || (int)pixmap_id[i] == BadDrawable || (int)pixmap_id[i] == BadValue ) {
+                               GST_ERROR_OBJECT (evaspixmapsink,"pixmap[%d] allocation error..", i);
+                               int j = 0;
+                               for (j = 0; j < i; j++) {
+                                       XFreePixmap(dpy, pixmap_id[j]);
+                               }
+                               goto GO_OUT_OF_FUNC;
+                       }
+                       GST_INFO_OBJECT (evaspixmapsink,"creation pixmap_id[%d]:%d success", i, pixmap_id[i]);
+                       GST_DEBUG_OBJECT (evaspixmapsink,"evas_object_width(%d),evas_object_height(%d),pixmap:%d,depth:%d",
+                                                               evas_object_width,evas_object_height,pixmap_id[i],DefaultDepth(dpy, DefaultScreen(dpy)));
+               }
+       }
+
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               if (evaspixmapsink->xpixmap[i]->pixmap && pixmap_id[i] != evaspixmapsink->xpixmap[i]->pixmap) {
+                       g_mutex_unlock (evaspixmapsink->x_lock);
+                       g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+                       /* If we reset another pixmap, do below */
+                       evaspixmapsink->xpixmap[i]->prev_pixmap = evaspixmapsink->xpixmap[i]->pixmap;
+                       evaspixmapsink->xpixmap[i]->prev_gc = evaspixmapsink->xpixmap[i]->gc;
+                       evaspixmapsink->xpixmap[i]->pixmap = 0;
+                       evaspixmapsink->xpixmap[i]->ref = 0;
+                       evaspixmapsink->xpixmap[i]->damaged_time = 0;
+                       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+                       g_mutex_lock (evaspixmapsink->x_lock);
+               }
+       }
+
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               /* Set pixmap id and create GC */
+               evaspixmapsink->xpixmap[i]->pixmap = pixmap_id[i];
+               evaspixmapsink->xpixmap[i]->gc = XCreateGC(dpy, evaspixmapsink->xpixmap[i]->pixmap, 0,0);
+               evaspixmapsink->xpixmap[i]->width = xw;
+               evaspixmapsink->xpixmap[i]->height = xh;
+
+               /* Create XDamage */
+               if (evaspixmapsink->damage[i]) {
+                       evaspixmapsink->prev_damage[i] = evaspixmapsink->damage[i];
+               }
+               evaspixmapsink->damage[i] = XDamageCreate (dpy, evaspixmapsink->xpixmap[i]->pixmap, XDamageReportRawRectangles);
+
+               GST_WARNING_OBJECT (evaspixmapsink,"xpixmap[%d]->(pixmap:%d,gc:%p), damage[%d]:%d",
+                                       i, evaspixmapsink->xpixmap[i]->pixmap, evaspixmapsink->xpixmap[i]->gc, i, evaspixmapsink->damage[i]);
+       }
+
+       XSync(dpy, FALSE);
+
+       /* Set flag for mapping evas object with xpixmap */
+       evaspixmapsink->do_link = TRUE;
+       ecore_pipe_write(evaspixmapsink->epipe, evaspixmapsink, sizeof(GstEvasPixmapSink));
+
+       gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+
+       g_mutex_unlock (evaspixmapsink->x_lock);
+
+
+SKIP_LINK:
+       g_mutex_lock (evaspixmapsink->pixmap_ref_lock);
+       evaspixmapsink->last_updated_idx = -1;
+       g_mutex_unlock (evaspixmapsink->pixmap_ref_lock);
+
+       g_mutex_unlock (evaspixmapsink->flow_lock);
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+
+       return TRUE;
+
+GO_OUT_OF_FUNC:
+       g_mutex_unlock (evaspixmapsink->x_lock);
+       g_mutex_unlock (evaspixmapsink->flow_lock);
+       return FALSE;
+}
+
+static void
+gst_evaspixmapsink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (object));
+       evaspixmapsink = GST_EVASPIXMAPSINK (object);
+
+       switch (prop_id) {
+       case PROP_HUE:
+               evaspixmapsink->hue = g_value_get_int (value);
+               evaspixmapsink->cb_changed = TRUE;
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+               break;
+       case PROP_CONTRAST:
+               evaspixmapsink->contrast = g_value_get_int (value);
+               evaspixmapsink->cb_changed = TRUE;
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+               break;
+       case PROP_BRIGHTNESS:
+               evaspixmapsink->brightness = g_value_get_int (value);
+               evaspixmapsink->cb_changed = TRUE;
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+               break;
+       case PROP_SATURATION:
+               evaspixmapsink->saturation = g_value_get_int (value);
+               evaspixmapsink->cb_changed = TRUE;
+               gst_evaspixmapsink_update_colorbalance (evaspixmapsink);
+               break;
+       case PROP_DISPLAY:
+               evaspixmapsink->display_name = g_strdup (g_value_get_string (value));
+               break;
+       case PROP_SYNCHRONOUS:
+               evaspixmapsink->synchronous = g_value_get_boolean (value);
+               if (evaspixmapsink->xcontext) {
+                       XSynchronize (evaspixmapsink->xcontext->disp, evaspixmapsink->synchronous);
+                       GST_DEBUG_OBJECT (evaspixmapsink,"XSynchronize called with %s", evaspixmapsink->synchronous ? "TRUE" : "FALSE");
+               }
+               break;
+       case PROP_PIXEL_ASPECT_RATIO:
+               g_free (evaspixmapsink->par);
+               evaspixmapsink->par = g_new0 (GValue, 1);
+               g_value_init (evaspixmapsink->par, GST_TYPE_FRACTION);
+               if (!g_value_transform (value, evaspixmapsink->par)) {
+                       g_warning ("Could not transform string to aspect ratio");
+                       gst_value_set_fraction (evaspixmapsink->par, 1, 1);
+               }
+               GST_DEBUG_OBJECT (evaspixmapsink,"set PAR to %d/%d", gst_value_get_fraction_numerator (evaspixmapsink->par), gst_value_get_fraction_denominator (evaspixmapsink->par));
+               break;
+       case PROP_DEVICE:
+               evaspixmapsink->adaptor_no = atoi (g_value_get_string (value));
+               break;
+       case PROP_DOUBLE_BUFFER:
+               evaspixmapsink->double_buffer = g_value_get_boolean (value);
+               break;
+       case PROP_AUTOPAINT_COLORKEY:
+               evaspixmapsink->autopaint_colorkey = g_value_get_boolean (value);
+               break;
+       case PROP_COLORKEY:
+               evaspixmapsink->colorkey = g_value_get_int (value);
+               break;
+       case PROP_PIXMAP_WIDTH:
+       {
+               /* To do : code related to pixmap re-link */
+               GST_LOG_OBJECT (evaspixmapsink, "Not supported");
+               break;
+       }
+       case PROP_PIXMAP_HEIGHT:
+       {
+               /* To do : code related to pixmap re-link */
+               GST_LOG_OBJECT (evaspixmapsink, "Not supported");
+               break;
+       }
+       case PROP_DISPLAY_GEOMETRY_METHOD:
+       {
+               guint new_val = g_value_get_enum (value);
+               if (evaspixmapsink->display_geometry_method != new_val) {
+                       evaspixmapsink->display_geometry_method = new_val;
+                       GST_INFO_OBJECT (evaspixmapsink,"Overlay geometry method update, display_geometry_method(%d)",evaspixmapsink->display_geometry_method);
+                       if( evaspixmapsink->display_geometry_method != DISP_GEO_METHOD_FULL_SCREEN &&
+                                 evaspixmapsink->display_geometry_method != DISP_GEO_METHOD_CROPPED_FULL_SCREEN ) {
+                               if( evaspixmapsink->xcontext ) {
+                                       g_mutex_lock( evaspixmapsink->flow_lock );
+                                       int i = 0;
+                                       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                                               if (evaspixmapsink->xpixmap[i]) {
+                                                       gst_evaspixmapsink_xpixmap_clear (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+                                               }
+                                       }
+                                       g_mutex_unlock( evaspixmapsink->flow_lock );
+                               }
+                       }
+                       if (evaspixmapsink->xcontext) {
+                               gst_evaspixmap_buffer_put (evaspixmapsink, evaspixmapsink->evas_pixmap_buf);
+                       }
+               }
+               break;
+       }
+       case PROP_DST_ROI_X:
+               evaspixmapsink->dst_roi.x = g_value_get_int (value);
+               GST_INFO_OBJECT (evaspixmapsink, "ROI_X(%d)",evaspixmapsink->dst_roi.x );
+               break;
+       case PROP_DST_ROI_Y:
+               evaspixmapsink->dst_roi.y = g_value_get_int (value);
+               GST_INFO_OBJECT (evaspixmapsink, "ROI_Y(%d)",evaspixmapsink->dst_roi.y );
+               break;
+       case PROP_DST_ROI_W:
+               evaspixmapsink->dst_roi.w = g_value_get_int (value);
+               GST_INFO_OBJECT (evaspixmapsink, "ROI_W(%d)",evaspixmapsink->dst_roi.w );
+               break;
+       case PROP_DST_ROI_H:
+               evaspixmapsink->dst_roi.h = g_value_get_int (value);
+               GST_INFO_OBJECT (evaspixmapsink, "ROI_H(%d)",evaspixmapsink->dst_roi.h );
+               break;
+       case PROP_STOP_VIDEO:
+               evaspixmapsink->stop_video = g_value_get_int (value);
+               g_mutex_lock( evaspixmapsink->flow_lock );
+               if( evaspixmapsink->stop_video ) {
+                       GST_INFO_OBJECT (evaspixmapsink, "XPixmap CLEAR when set video-stop property" );
+                       int i = 0;
+                       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                               if (evaspixmapsink->xpixmap[i]) {
+                                       gst_evaspixmapsink_xpixmap_clear (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+                               }
+                       }
+               }
+               GST_INFO_OBJECT (evaspixmapsink, "video-stop property(%d)", evaspixmapsink->stop_video);
+
+               g_mutex_unlock( evaspixmapsink->flow_lock );
+               break;
+       case PROP_EVAS_OBJECT:
+       {
+               Evas_Object *eo = g_value_get_pointer (value);
+               if ( is_evas_image_object (eo)) {
+                       if (!evaspixmapsink->epipe) {
+                               evaspixmapsink->epipe = ecore_pipe_add (ecore_pipe_callback_handler, evaspixmapsink);
+                               if (!evaspixmapsink->epipe) {
+                                       GST_ERROR_OBJECT (evaspixmapsink,"Cannot set evas-object property: ecore_pipe_add() failed");
+                                       break;
+                               }
+                       }
+                       if (evaspixmapsink->eo == NULL) {
+                               evaspixmapsink->eo = eo;
+                               /* add evas object callbacks on a new evas image object */
+                               EVASPIXMAPSINK_SET_EVAS_OBJECT_EVENT_CALLBACK (eo, evaspixmapsink);
+                               if (GST_STATE(evaspixmapsink) < GST_STATE_PAUSED) {
+                                       GST_INFO_OBJECT (evaspixmapsink,"It's the first time the new evas image object(%x) is set, skip gst_evaspixmapsink_xpixmap_link()..", eo);
+                                       break;
+                               } else {
+                                       if (!gst_evaspixmapsink_xpixmap_link(evaspixmapsink)) {
+                                               GST_WARNING_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                                               evaspixmapsink->eo = NULL;
+                                               break;
+                                       }
+                               }
+                       }
+                       if (eo == evaspixmapsink->eo) {
+                               GST_LOG_OBJECT (evaspixmapsink,"new evas image object(%x) is same as the previous one(%x)", eo, evaspixmapsink->eo);
+                       } else {
+                               GST_INFO_OBJECT (evaspixmapsink,"new evas image object(%x), previous one(%x)", eo, evaspixmapsink->eo);
+                               /* delete evas object callbacks registrated on a former evas image object */
+                               EVASPIXMAPSINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK (evaspixmapsink->eo);
+                               evaspixmapsink->eo = eo;
+                               if (!gst_evaspixmapsink_xpixmap_link(evaspixmapsink)) {
+                                       GST_WARNING_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                                       evaspixmapsink->eo = NULL;
+                                       break;
+                               }
+                               /* add evas object callbacks on a new evas image object */
+                               EVASPIXMAPSINK_SET_EVAS_OBJECT_EVENT_CALLBACK (eo, evaspixmapsink);
+                       }
+                       GST_INFO_OBJECT (evaspixmapsink,"Evas image object(%x) is set", evaspixmapsink->eo);
+               } else {
+                       GST_ERROR_OBJECT (evaspixmapsink,"Cannot set evas-object property: value is not an evas image object");
+               }
+               break;
+       }
+       case PROP_FLIP:
+               evaspixmapsink->flip = g_value_get_enum(value);
+               break;
+       case PROP_ROTATE_ANGLE:
+               evaspixmapsink->rotate_angle = g_value_get_enum (value);
+               break;
+       case PROP_VISIBLE:
+       {
+               gboolean visible = g_value_get_boolean (value);
+               if (evaspixmapsink->visible != visible) {
+                       evaspixmapsink->visible = visible;
+                       if (evaspixmapsink->eo) {
+                               if (!visible) {
+                                       int i = 0;
+                                       g_mutex_lock( evaspixmapsink->flow_lock );
+                                       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+                                               if (evaspixmapsink->xpixmap[i]) {
+                                                       gst_evaspixmapsink_xpixmap_clear (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+                                               }
+                                       }
+                                       g_mutex_unlock( evaspixmapsink->flow_lock );
+                                       evas_object_hide(evaspixmapsink->eo);
+                                       GST_INFO_OBJECT (evaspixmapsink,"object hide..");
+                               } else {
+                                       evas_object_show(evaspixmapsink->eo);
+                                       GST_INFO_OBJECT (evaspixmapsink,"object show..");
+                                       gst_evaspixmap_buffer_put (evaspixmapsink, evaspixmapsink->evas_pixmap_buf);
+                               }
+                       } else {
+                               GST_WARNING_OBJECT (evaspixmapsink,"evas image object was not set");
+                       }
+               }
+               break;
+       }
+       case PROP_ORIGIN_SIZE:
+               evaspixmapsink->use_origin_size = g_value_get_boolean (value);
+               GST_INFO_OBJECT (evaspixmapsink,"set origin-size (%d)",evaspixmapsink->use_origin_size);
+               if (evaspixmapsink->previous_origin_size != evaspixmapsink->use_origin_size) {
+                       if (!gst_evaspixmapsink_xpixmap_link(evaspixmapsink)) {
+                               GST_WARNING_OBJECT (evaspixmapsink,"link evas image object with pixmap failed...");
+                       }
+                       evaspixmapsink->previous_origin_size = evaspixmapsink->use_origin_size;
+               }
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+gst_evaspixmapsink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+
+       g_return_if_fail (GST_IS_EVASPIXMAPSINK (object));
+
+       evaspixmapsink = GST_EVASPIXMAPSINK (object);
+
+       switch (prop_id) {
+       case PROP_HUE:
+               g_value_set_int (value, evaspixmapsink->hue);
+               break;
+       case PROP_CONTRAST:
+               g_value_set_int (value, evaspixmapsink->contrast);
+               break;
+       case PROP_BRIGHTNESS:
+               g_value_set_int (value, evaspixmapsink->brightness);
+               break;
+       case PROP_SATURATION:
+               g_value_set_int (value, evaspixmapsink->saturation);
+               break;
+       case PROP_DISPLAY:
+               g_value_set_string (value, evaspixmapsink->display_name);
+               break;
+       case PROP_SYNCHRONOUS:
+               g_value_set_boolean (value, evaspixmapsink->synchronous);
+               break;
+       case PROP_PIXEL_ASPECT_RATIO:
+               if (evaspixmapsink->par) {
+                       if (!g_value_transform (evaspixmapsink->par, value)) {
+                               g_warning ("g_value_transform() failure");
+                       }
+               }
+               break;
+       case PROP_DEVICE:
+       {
+               char *adaptor_no_s = g_strdup_printf ("%u", evaspixmapsink->adaptor_no);
+               g_value_set_string (value, adaptor_no_s);
+               g_free (adaptor_no_s);
+               break;
+       }
+       case PROP_DEVICE_NAME:
+               if (evaspixmapsink->xcontext && evaspixmapsink->xcontext->adaptors) {
+                       g_value_set_string (value,
+                       evaspixmapsink->xcontext->adaptors[evaspixmapsink->adaptor_no]);
+               } else {
+                       g_value_set_string (value, NULL);
+               }
+               break;
+       case PROP_DOUBLE_BUFFER:
+               g_value_set_boolean (value, evaspixmapsink->double_buffer);
+               break;
+       case PROP_AUTOPAINT_COLORKEY:
+               g_value_set_boolean (value, evaspixmapsink->autopaint_colorkey);
+               break;
+       case PROP_COLORKEY:
+               g_value_set_int (value, evaspixmapsink->colorkey);
+               break;
+       case PROP_PIXMAP_WIDTH:
+       {
+               GST_LOG_OBJECT (evaspixmapsink, "Not supported");
+               break;
+       }
+       case PROP_PIXMAP_HEIGHT:
+       {
+               GST_LOG_OBJECT (evaspixmapsink, "Not supported");
+               break;
+       }
+       case PROP_DISPLAY_GEOMETRY_METHOD:
+               g_value_set_enum (value, evaspixmapsink->display_geometry_method);
+               break;
+       case PROP_DST_ROI_X:
+               g_value_set_int (value, evaspixmapsink->dst_roi.x);
+               break;
+       case PROP_DST_ROI_Y:
+               g_value_set_int (value, evaspixmapsink->dst_roi.y);
+               break;
+       case PROP_DST_ROI_W:
+               g_value_set_int (value, evaspixmapsink->dst_roi.w);
+               break;
+       case PROP_DST_ROI_H:
+               g_value_set_int (value, evaspixmapsink->dst_roi.h);
+               break;
+       case PROP_STOP_VIDEO:
+               g_value_set_int (value, evaspixmapsink->stop_video);
+               break;
+       case PROP_EVAS_OBJECT:
+               g_value_set_pointer (value, evaspixmapsink->eo);
+               break;
+       case PROP_FLIP:
+               g_value_set_enum(value, evaspixmapsink->flip);
+               break;
+       case PROP_ROTATE_ANGLE:
+               g_value_set_enum (value, evaspixmapsink->rotate_angle);
+               break;
+       case PROP_VISIBLE:
+               g_value_set_boolean (value, evaspixmapsink->visible);
+               break;
+       case PROP_ORIGIN_SIZE:
+               g_value_set_boolean (value, evaspixmapsink->use_origin_size);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+  }
+}
+
+static void
+gst_evaspixmapsink_reset (GstEvasPixmapSink *evaspixmapsink)
+{
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START]");
+
+       GThread *thread;
+       GST_OBJECT_LOCK (evaspixmapsink);
+       evaspixmapsink->running = FALSE;
+       int i = 0;
+
+       /* grab thread and mark it as NULL */
+       thread = evaspixmapsink->event_thread;
+       evaspixmapsink->event_thread = NULL;
+       GST_OBJECT_UNLOCK (evaspixmapsink);
+
+       /* Wait for our event thread to finish before we clean up our stuff. */
+       if (thread) {
+               g_thread_join (thread);
+       }
+
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               if(evaspixmapsink->damage[i]) {
+                       XDamageDestroy(evaspixmapsink->xcontext->disp, evaspixmapsink->damage[i]);
+                       evaspixmapsink->damage[i] = NULL;
+               }
+       }
+       EVASPIXMAPSINK_UNSET_EVAS_OBJECT_EVENT_CALLBACK( evaspixmapsink->eo );
+
+       if (evaspixmapsink->evas_pixmap_buf) {
+               gst_buffer_unref (GST_BUFFER_CAST (evaspixmapsink->evas_pixmap_buf));
+               evaspixmapsink->evas_pixmap_buf = NULL;
+       }
+
+       for (i = 0; i < evaspixmapsink->num_of_pixmaps; i++) {
+               gst_evaspixmapsink_xpixmap_clear (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+               gst_evaspixmapsink_xpixmap_destroy (evaspixmapsink, evaspixmapsink->xpixmap[i]);
+               evaspixmapsink->xpixmap[i] = NULL;
+       }
+       if (evaspixmapsink->eo) {
+               evas_object_image_native_surface_set(evaspixmapsink->eo, NULL);
+               evaspixmapsink->eo = NULL;
+       }
+
+       evaspixmapsink->render_rect.x = evaspixmapsink->render_rect.y =
+       evaspixmapsink->render_rect.w = evaspixmapsink->render_rect.h = 0;
+       evaspixmapsink->have_render_rect = FALSE;
+
+       gst_evaspixmapsink_xcontext_clear (evaspixmapsink);
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+}
+
+/* Finalize is called only once, dispose can be called multiple times.
+ * We use mutexes and don't reset stuff to NULL here so let's register
+ * as a finalize. */
+static void
+gst_evaspixmapsink_finalize (GObject *object)
+{
+       GstEvasPixmapSink *evaspixmapsink;
+       evaspixmapsink = GST_EVASPIXMAPSINK (object);
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START]");
+
+       if (evaspixmapsink->display_name) {
+               g_free (evaspixmapsink->display_name);
+               evaspixmapsink->display_name = NULL;
+       }
+       if (evaspixmapsink->par) {
+               g_free (evaspixmapsink->par);
+               evaspixmapsink->par = NULL;
+       }
+       if (evaspixmapsink->x_lock) {
+               g_mutex_free (evaspixmapsink->x_lock);
+               evaspixmapsink->x_lock = NULL;
+       }
+       if (evaspixmapsink->flow_lock) {
+               g_mutex_free (evaspixmapsink->flow_lock);
+               evaspixmapsink->flow_lock = NULL;
+       }
+       if (evaspixmapsink->pixmap_ref_lock) {
+               g_mutex_free (evaspixmapsink->pixmap_ref_lock);
+               evaspixmapsink->pixmap_ref_lock = NULL;
+       }
+       if (evaspixmapsink->epipe) {
+               ecore_pipe_del (evaspixmapsink->epipe);
+               evaspixmapsink->epipe = NULL;
+       }
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+
+       G_OBJECT_CLASS (parent_class)->finalize (object);
+
+       MMTA_ACUM_ITEM_SHOW_RESULT_TO(MMTA_SHOW_FILE);
+       MMTA_RELEASE();
+}
+
+static void
+gst_evaspixmapsink_init (GstEvasPixmapSink *evaspixmapsink)
+{
+       int i = 0;
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[START]");
+
+       evaspixmapsink->display_name = NULL;
+       evaspixmapsink->adaptor_no = 0;
+       evaspixmapsink->xcontext = NULL;
+
+       for (i = 0; i < NUM_OF_PIXMAP; i++) {
+               evaspixmapsink->xpixmap[i] = NULL;
+               evaspixmapsink->damage[i] = 0;
+       }
+
+       evaspixmapsink->evas_pixmap_buf = NULL;
+
+       evaspixmapsink->hue = evaspixmapsink->saturation = 0;
+       evaspixmapsink->contrast = evaspixmapsink->brightness = 0;
+       evaspixmapsink->cb_changed = FALSE;
+
+       evaspixmapsink->fps_n = 0;
+       evaspixmapsink->fps_d = 0;
+       evaspixmapsink->video_width = 0;
+       evaspixmapsink->video_height = 0;
+
+       evaspixmapsink->x_lock = g_mutex_new ();
+       evaspixmapsink->flow_lock = g_mutex_new ();
+       evaspixmapsink->pixmap_ref_lock = g_mutex_new();
+
+       evaspixmapsink->synchronous = FALSE;
+       evaspixmapsink->double_buffer = TRUE;
+       evaspixmapsink->par = NULL;
+       evaspixmapsink->autopaint_colorkey = TRUE;
+       evaspixmapsink->running = FALSE;
+
+       /* on 16bit displays this becomes r,g,b = 1,2,3
+       * on 24bit displays this becomes r,g,b = 8,8,16
+       * as a port atom value
+       */
+       evaspixmapsink->colorkey = (8 << 16) | (8 << 8) | 16;
+
+       evaspixmapsink->display_geometry_method = DEF_DISPLAY_GEOMETRY_METHOD;
+       evaspixmapsink->dst_roi.x = 0;
+       evaspixmapsink->dst_roi.y = 0;
+       evaspixmapsink->dst_roi.w = 0;
+       evaspixmapsink->dst_roi.h = 0;
+       evaspixmapsink->scr_w = 0;
+       evaspixmapsink->scr_h = 0;
+       evaspixmapsink->aligned_width = 0;
+       evaspixmapsink->aligned_height = 0;
+       evaspixmapsink->stop_video = FALSE;
+       evaspixmapsink->eo = NULL;
+       evaspixmapsink->epipe = NULL;
+       evaspixmapsink->do_link = FALSE;
+       evaspixmapsink->flip = DEF_DISPLAY_FLIP;
+       evaspixmapsink->rotate_angle = DEGREE_0;
+       evaspixmapsink->visible = TRUE;
+       evaspixmapsink->use_origin_size = FALSE;
+       evaspixmapsink->previous_origin_size = FALSE;
+
+       evaspixmapsink->num_of_pixmaps = NUM_OF_PIXMAP;
+
+       evaspixmapsink->buf_shared_type = BUF_SHARE_METHOD_NONE;
+
+       MMTA_INIT();
+
+       GST_DEBUG_OBJECT (evaspixmapsink,"[END]");
+ }
+
+static void
+gst_evaspixmapsink_base_init (gpointer g_class)
+{
+  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details_simple (element_class,
+      "EvasPixmapSink", "Sink/Video",
+      "evas image object videosink based on Xv extension", "Sangchul Lee <sc11.lee@samsung.com>");
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&gst_evaspixmapsink_sink_template_factory));
+}
+
+static void
+gst_evaspixmapsink_class_init (GstEvasPixmapSinkClass *klass)
+{
+  GObjectClass *gobject_class;
+  GstElementClass *gstelement_class;
+  GstBaseSinkClass *gstbasesink_class;
+  GstVideoSinkClass *videosink_class;
+
+  gobject_class = (GObjectClass *) klass;
+  gstelement_class = (GstElementClass *) klass;
+  gstbasesink_class = (GstBaseSinkClass *) klass;
+  videosink_class = (GstVideoSinkClass *) klass;
+
+  parent_class = g_type_class_peek_parent (klass);
+
+  gobject_class->set_property = gst_evaspixmapsink_set_property;
+  gobject_class->get_property = gst_evaspixmapsink_get_property;
+
+  g_object_class_install_property (gobject_class, PROP_CONTRAST,
+      g_param_spec_int ("contrast", "Contrast", "The contrast of the video",
+          -1000, 1000, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_BRIGHTNESS,
+      g_param_spec_int ("brightness", "Brightness",
+          "The brightness of the video", -1000, 1000, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_HUE,
+      g_param_spec_int ("hue", "Hue", "The hue of the video", -1000, 1000, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_SATURATION,
+      g_param_spec_int ("saturation", "Saturation",
+          "The saturation of the video", -1000, 1000, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_DISPLAY,
+      g_param_spec_string ("display", "Display", "X Display name", NULL,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_SYNCHRONOUS,
+      g_param_spec_boolean ("synchronous", "Synchronous",
+          "When enabled, runs "
+          "the X display in synchronous mode. (used only for debugging)", FALSE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_PIXEL_ASPECT_RATIO,
+      g_param_spec_string ("pixel-aspect-ratio", "Pixel Aspect Ratio",
+          "The pixel aspect ratio of the device", "1/1",
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_DEVICE,
+      g_param_spec_string ("device", "Adaptor number",
+          "The number of the video adaptor", "0",
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
+      g_param_spec_string ("device-name", "Adaptor name",
+          "The name of the video adaptor", NULL,
+          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:double-buffer
+   *
+   * Whether to double-buffer the output.
+   *
+   * Since: 0.10.14
+   */
+  g_object_class_install_property (gobject_class, PROP_DOUBLE_BUFFER,
+      g_param_spec_boolean ("double-buffer", "Double-buffer",
+          "Whether to double-buffer the output", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstEvasPixmapSink:autopaint-colorkey
+   *
+   * Whether to autofill overlay with colorkey
+   *
+   * Since: 0.10.21
+   */
+  g_object_class_install_property (gobject_class, PROP_AUTOPAINT_COLORKEY,
+      g_param_spec_boolean ("autopaint-colorkey", "Autofill with colorkey",
+          "Whether to autofill overlay with colorkey", TRUE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  /**
+   * GstEvasPixmapSink:colorkey
+   *
+   * Color to use for the overlay mask.
+   *
+   * Since: 0.10.21
+   */
+  g_object_class_install_property (gobject_class, PROP_COLORKEY,
+      g_param_spec_int ("colorkey", "Colorkey",
+          "Color to use for the overlay mask", G_MININT, G_MAXINT, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:pixmap-width
+   *
+   * Actual width of the pixmap.
+   */
+  g_object_class_install_property (gobject_class, PROP_PIXMAP_WIDTH,
+      g_param_spec_uint64 ("pixmap-width", "pixmap-width", "Width of the pixmap", 0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:pixmap-height
+   *
+   * Actual height of the pixmap.
+   */
+  g_object_class_install_property (gobject_class, PROP_PIXMAP_HEIGHT,
+      g_param_spec_uint64 ("pixmap-height", "pixmap-height", "Height of the pixmap", 0, G_MAXUINT64, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:display-geometry-method
+   *
+   * Display geometrical method setting
+   */
+  g_object_class_install_property(gobject_class, PROP_DISPLAY_GEOMETRY_METHOD,
+    g_param_spec_enum("display-geometry-method", "Display geometry method",
+      "Geometrical method for display",
+      GST_TYPE_EVASPIXMAPSINK_DISPLAY_GEOMETRY_METHOD, DEF_DISPLAY_GEOMETRY_METHOD,
+      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:dst-roi-x
+   *
+   * X value of Destination ROI
+   */
+  g_object_class_install_property (gobject_class, PROP_DST_ROI_X,
+      g_param_spec_int ("dst-roi-x", "Dst-ROI-X",
+          "X value of Destination ROI(only effective \"CUSTOM_ROI\")", 0, XV_SCREEN_SIZE_WIDTH, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:dst-roi-y
+   *
+   * Y value of Destination ROI
+   */
+  g_object_class_install_property (gobject_class, PROP_DST_ROI_Y,
+      g_param_spec_int ("dst-roi-y", "Dst-ROI-Y",
+          "Y value of Destination ROI(only effective \"CUSTOM_ROI\")", 0, XV_SCREEN_SIZE_HEIGHT, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:dst-roi-w
+   *
+   * W value of Destination ROI
+   */
+  g_object_class_install_property (gobject_class, PROP_DST_ROI_W,
+      g_param_spec_int ("dst-roi-w", "Dst-ROI-W",
+          "W value of Destination ROI(only effective \"CUSTOM_ROI\")", 0, XV_SCREEN_SIZE_WIDTH, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:dst-roi-h
+   *
+   * H value of Destination ROI
+   */
+  g_object_class_install_property (gobject_class, PROP_DST_ROI_H,
+      g_param_spec_int ("dst-roi-h", "Dst-ROI-H",
+          "H value of Destination ROI(only effective \"CUSTOM_ROI\")", 0, XV_SCREEN_SIZE_HEIGHT, 0,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:stop-video
+   *
+   * Stop video for releasing video source buffer
+   */
+  g_object_class_install_property (gobject_class, PROP_STOP_VIDEO,
+      g_param_spec_int ("stop-video", "Stop-Video", "Stop video for releasing video source buffer", 0, 1, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:evas-object
+   *
+   * Evas image object for rendering
+   */
+  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));
+
+  /**
+   * GstEvasPixmapSink:display-flip
+   *
+   * Display flip setting
+   */
+  g_object_class_install_property(gobject_class, PROP_FLIP,
+    g_param_spec_enum("flip", "Display flip",
+      "Flip for display",
+      GST_TYPE_EVASPIXMAPSINK_FLIP, DEF_DISPLAY_FLIP,
+      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:rotate
+   *
+   * draw rotation angle setting
+   */
+  g_object_class_install_property(gobject_class, PROP_ROTATE_ANGLE,
+    g_param_spec_enum("rotate", "Rotate angle", "Rotate angle of display output",GST_TYPE_EVASPIXMAPSINK_ROTATE_ANGLE, DEGREE_0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstEvasPixmapSink:visible
+   *
+   * visible setting for a evas image object
+   */
+  g_object_class_install_property (gobject_class, PROP_VISIBLE,
+       g_param_spec_boolean ("visible", "Visible", "When setting it false, evas image object does not show", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+   /**
+   * GstEvasPixmapSink:origin-size
+   *
+   * Set pixmap size with media source's width and height
+   */
+  g_object_class_install_property (gobject_class, PROP_ORIGIN_SIZE,
+       g_param_spec_boolean ("origin-size", "Origin-Size", "When setting it true, pixmap will be created with media source's width and height", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  gobject_class->finalize = gst_evaspixmapsink_finalize;
+
+  gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_change_state);
+  gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_getcaps);
+  gstbasesink_class->set_caps = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_setcaps);
+  gstbasesink_class->get_times = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_get_times);
+  gstbasesink_class->event = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_event);
+  videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_evaspixmapsink_show_frame);
+}
+
+/* Object typing & Creation */
+GType
+gst_evaspixmapsink_get_type (void)
+{
+  static GType evaspixmapsink_type = 0;
+
+  if (!evaspixmapsink_type) {
+    static const GTypeInfo evaspixmapsink_info = {
+      sizeof (GstEvasPixmapSinkClass),
+      gst_evaspixmapsink_base_init,
+      NULL,
+      (GClassInitFunc) gst_evaspixmapsink_class_init,
+      NULL,
+      NULL,
+      sizeof (GstEvasPixmapSink),
+      0,
+      (GInstanceInitFunc) gst_evaspixmapsink_init,
+    };
+    static const GInterfaceInfo iface_info = {
+      (GInterfaceInitFunc) gst_evaspixmapsink_interface_init,
+      NULL,
+      NULL,
+    };
+    static const GInterfaceInfo navigation_info = {
+      (GInterfaceInitFunc) gst_evaspixmapsink_navigation_init,
+      NULL,
+      NULL,
+    };
+    static const GInterfaceInfo colorbalance_info = {
+      (GInterfaceInitFunc) gst_evaspixmapsink_colorbalance_init,
+      NULL,
+      NULL,
+    };
+    static const GInterfaceInfo propertyprobe_info = {
+      (GInterfaceInitFunc) gst_evaspixmapsink_property_probe_interface_init,
+      NULL,
+      NULL,
+    };
+    evaspixmapsink_type = g_type_register_static (GST_TYPE_VIDEO_SINK, "GstEvasPixmapSink", &evaspixmapsink_info, 0);
+
+    g_type_add_interface_static (evaspixmapsink_type, GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
+    g_type_add_interface_static (evaspixmapsink_type, GST_TYPE_NAVIGATION, &navigation_info);
+    g_type_add_interface_static (evaspixmapsink_type, GST_TYPE_COLOR_BALANCE, &colorbalance_info);
+    g_type_add_interface_static (evaspixmapsink_type, GST_TYPE_PROPERTY_PROBE, &propertyprobe_info);
+
+    /* register type and create class in a more safe place instead of at
+     * runtime since the type registration and class creation is not
+     * threadsafe. */
+    g_type_class_ref (gst_evaspixmap_buffer_get_type ());
+  }
+
+  return evaspixmapsink_type;
+}
+
+static gboolean
+plugin_init (GstPlugin *plugin)
+{
+       if (!gst_element_register (plugin, "evaspixmapsink", GST_RANK_NONE, GST_TYPE_EVASPIXMAPSINK)) {
+               return FALSE;
+       }
+       GST_DEBUG_CATEGORY_INIT (gst_debug_evaspixmapsink, "evaspixmapsink", 0, "evaspixmapsink element");
+       GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
+
+       return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR,
+       "evaspixmapsink","Evas image object render plugin using Xv extension", plugin_init,
+       VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
diff --git a/wearable/evaspixmapsink/evaspixmapsink.h b/wearable/evaspixmapsink/evaspixmapsink.h
new file mode 100644 (file)
index 0000000..12dc839
--- /dev/null
@@ -0,0 +1,400 @@
+/*
+ * EvasPixmapSink
+ *
+ * Copyright (c) 2000 - 2012 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_EVASPIXMAPSINK_H__
+#define __GST_EVASPIXMAPSINK_H__
+
+#include <gst/video/gstvideosink.h>
+#include <mm_ta.h>
+
+#ifdef HAVE_XSHM
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif /* HAVE_XSHM */
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+#ifdef HAVE_XSHM
+#include <X11/extensions/XShm.h>
+#endif /* HAVE_XSHM */
+
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvlib.h>
+#include <X11/extensions/Xdamage.h>
+#include <X11/extensions/damagewire.h>
+#include <X11/Xatom.h>
+#include <stdio.h>
+
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_X.h>
+
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+
+#define MAX_PLANE_NUM          3
+#define MAX_BUFFER_NUM         20
+#define MAX_GEM_BUFFER_NUM     (MAX_PLANE_NUM * MAX_BUFFER_NUM)
+typedef struct _gem_info_t {
+       int dmabuf_fd;
+       unsigned int gem_handle;
+       unsigned int gem_name;
+       unsigned int bo;
+       Pixmap ref_pixmap;
+} gem_info_t;
+
+typedef enum {
+       BUF_SHARE_METHOD_NONE = -1,
+       BUF_SHARE_METHOD_PADDR = 0,
+       BUF_SHARE_METHOD_FD,
+       BUF_SHARE_METHOD_TIZEN_BUFFER
+} buf_share_method_t;
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_EVASPIXMAPSINK \
+  (gst_evaspixmapsink_get_type())
+#define GST_EVASPIXMAPSINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_EVASPIXMAPSINK, GstEvasPixmapSink))
+#define GST_EVASPIXMAPSINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_EVASPIXMAPSINK, GstEvasPixmapSinkClass))
+#define GST_IS_EVASPIXMAPSINK(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_EVASPIXMAPSINK))
+#define GST_IS_EVASPIXMAPSINK_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_EVASPIXMAPSINK))
+
+#define XV_SCREEN_SIZE_WIDTH  4096
+#define XV_SCREEN_SIZE_HEIGHT 4096
+
+#define MARGIN_OF_ERROR       0.005
+#define NUM_OF_PIXMAP         3
+
+typedef struct _GstXContext GstXContext;
+typedef struct _GstXPixmap GstXPixmap;
+typedef struct _GstEvasPixmapFormat GstEvasPixmapFormat;
+typedef struct _GstEvasPixmapBuffer GstEvasPixmapBuffer;
+typedef struct _GstEvasPixmapBufferClass GstEvasPixmapBufferClass;
+typedef struct _GstEvasPixmapSink GstEvasPixmapSink;
+typedef struct _GstEvasPixmapSinkClass GstEvasPixmapSinkClass;
+
+/*
+ * GstXContext:
+ * @disp: the X11 Display of this context
+ * @screen: the default Screen of Display @disp
+ * @screen_num: the Screen number of @screen
+ * @visual: the default Visual of Screen @screen
+ * @root: the root Window of Display @disp
+ * @white: the value of a white pixel on Screen @screen
+ * @black: the value of a black pixel on Screen @screen
+ * @depth: the color depth of Display @disp
+ * @bpp: the number of bits per pixel on Display @disp
+ * @endianness: the endianness of image bytes on Display @disp
+ * @width: the width in pixels of Display @disp
+ * @height: the height in pixels of Display @disp
+ * @widthmm: the width in millimeters of Display @disp
+ * @heightmm: the height in millimeters of Display @disp
+ * @par: the pixel aspect ratio calculated from @width, @widthmm and @height,
+ * @heightmm ratio
+ * @use_xshm: used to known wether of not XShm extension is usable or not even
+ * if the Extension is present
+ * @xv_port_id: the XVideo port ID
+ * @im_format: used to store at least a valid format for XShm calls checks
+ * @formats_list: list of supported image formats on @xv_port_id
+ * @channels_list: list of #GstColorBalanceChannels
+ * @caps: the #GstCaps that Display @disp can accept
+ *
+ * Structure used to store various informations collected/calculated for a
+ * Display.
+ */
+struct _GstXContext {
+       Display *disp;
+
+       Screen *screen;
+       gint screen_num;
+
+       Visual *visual;
+
+       Window root;
+
+       gulong white, black;
+
+       gint depth;
+       gint bpp;
+       gint endianness;
+
+       gint width, height;
+       gint widthmm, heightmm;
+       GValue *par;                  /* calculated pixel aspect ratio */
+
+       gboolean use_xshm;
+
+       XvPortID xv_port_id;
+       guint nb_adaptors;
+       gchar ** adaptors;
+       gint im_format;
+
+       GList *formats_list;
+       GList *channels_list;
+
+       GstCaps *caps;
+};
+
+/*
+ * GstXPixmap:
+ * @pixmap: the pixmap ID of this X11 pixmap
+ * @width: the width in pixels of Pixmap @pixmap
+ * @height: the height in pixels of Pixmap @pixmap
+ * @gc: the Graphical Context of Pixmap @pixmap
+ *
+ * Structure used to store informations about a Pixmap.
+ */
+struct _GstXPixmap {
+       Pixmap pixmap;
+       gint x, y;
+       gint width, height;
+       GC gc;
+       guint ref;
+       gint damaged_time;
+       Pixmap prev_pixmap;
+       GC prev_gc;
+};
+
+/**
+ * GstEvasPixmapFormat:
+ * @format: the image format
+ * @caps: generated #GstCaps for this image format
+ *
+ * Structure storing image format to #GstCaps association.
+ */
+struct _GstEvasPixmapFormat {
+       gint format;
+       GstCaps *caps;
+};
+
+/**
+ * GstEvasPixmapBuffer:
+ * @evaspixmapsink: a reference to our #GstEvasPixmapSink
+ * @xvimage: the XvImage of this buffer
+ * @width: the width in pixels of XvImage @xvimage
+ * @height: the height in pixels of XvImage @xvimage
+ * @im_format: the image format of XvImage @xvimage
+ * @size: the size in bytes of XvImage @xvimage
+ *
+ * Subclass of #GstBuffer containing additional information about an XvImage.
+ */
+struct _GstEvasPixmapBuffer {
+       GstBuffer buffer;
+
+       /* Reference to the evaspixmapsink we belong to */
+       GstEvasPixmapSink *evaspixmapsink;
+       XvImage *xvimage;
+
+#ifdef HAVE_XSHM
+       XShmSegmentInfo SHMInfo;
+#endif /* HAVE_XSHM */
+
+       gint width, height;
+       gint im_format;
+       size_t size;
+};
+
+/**
+ * GstEvasPixmapSink:
+ * @display_name: the name of the Display we want to render to
+ * @xcontext: our instance's #GstXContext
+ * @xpixmap: the #GstXPixmap we are rendering to
+ * @fps_n: the framerate fraction numerator
+ * @fps_d: the framerate fraction denominator
+ * @x_lock: used to protect X calls as we are not using the XLib in threaded
+ * mode
+ * @flow_lock: used to protect data flow routines from external calls such as
+ * methods from the #GstXOverlay interface
+ * @par: used to override calculated pixel aspect ratio from @xcontext
+ * @synchronous: used to store if XSynchronous should be used or not (for
+ * debugging purpose only)
+ * @keep_aspect: used to remember if reverse negotiation scaling should respect
+ * aspect ratio
+ * @brightness: used to store the user settings for color balance brightness
+ * @contrast: used to store the user settings for color balance contrast
+ * @hue: used to store the user settings for color balance hue
+ * @saturation: used to store the user settings for color balance saturation
+ * @cb_changed: used to store if the color balance settings where changed
+ * @video_width: the width of incoming video frames in pixels
+ * @video_height: the height of incoming video frames in pixels
+ *
+ * The #GstEvasPixmapSink data structure.
+ */
+struct _GstEvasPixmapSink {
+       /* Our element stuff */
+       GstVideoSink videosink;
+
+       char *display_name;
+       guint adaptor_no;
+
+       GstXContext *xcontext;
+       GstXPixmap *xpixmap[NUM_OF_PIXMAP];
+       GstEvasPixmapBuffer *evas_pixmap_buf;
+
+       GThread *event_thread;
+       gboolean running;
+
+       gint fps_n;
+       gint fps_d;
+
+       GMutex *x_lock;
+       GMutex *flow_lock;
+       GMutex *pixmap_ref_lock;
+
+       /* object-set pixel aspect ratio */
+       GValue *par;
+
+       gboolean synchronous;
+       gboolean double_buffer;
+
+       gint brightness;
+       gint contrast;
+       gint hue;
+       gint saturation;
+       gboolean cb_changed;
+
+       /* size of incoming video, used as the size for XvImage */
+       guint video_width, video_height;
+
+       /* display sizes, used for clipping the image */
+       gint disp_x, disp_y;
+       gint disp_width, disp_height;
+
+       /* port attributes */
+       gboolean autopaint_colorkey;
+       gint colorkey;
+
+       /* port features */
+       gboolean have_autopaint_colorkey;
+       gboolean have_colorkey;
+       gboolean have_double_buffer;
+
+       /* target video rectagle */
+       GstVideoRectangle render_rect;
+       gboolean have_render_rect;
+
+       /* display */
+       guint flip;
+       guint rotate_angle;
+       guint display_geometry_method;
+       GstVideoRectangle dst_roi;
+       guint scr_w, scr_h;
+       /* needed if fourcc is one if S series */
+       guint aligned_width;
+       guint aligned_height;
+
+       gboolean stop_video;
+       buf_share_method_t buf_shared_type;
+
+       /* ecore & evas object */
+       Evas_Object *eo;
+       Evas_Coord w;
+       Evas_Coord h;
+       gboolean visible;
+       gint last_updated_idx;
+
+       /* pixmap */
+       gboolean do_link;
+       gboolean use_origin_size;
+       gboolean previous_origin_size;
+       gint sizediff_width;
+       gint sizediff_height;
+       guint num_of_pixmaps;
+
+       /* damage event */
+       Damage damage[NUM_OF_PIXMAP];
+       Damage prev_damage[NUM_OF_PIXMAP];
+       int damage_case;
+       Ecore_Pipe *epipe;
+
+       gint drm_fd;
+       gem_info_t gem_info[MAX_GEM_BUFFER_NUM];
+};
+
+/* max plane count *********************************************************/
+#define MPLANE_IMGB_MAX_COUNT         (4)
+
+/* image buffer definition ***************************************************
+
+    +------------------------------------------+ ---
+    |                                          |  ^
+    |     uaddr[], index[]                     |  |
+    |     +---------------------------+ ---    |  |
+    |     |                           |  ^     |  |
+    |     |<-------- width[] -------->|  |     |  |
+    |     |                           |  |     |  |
+    |     |                           |        |
+    |     |                           |height[]|elevation[]
+    |     |                           |        |
+    |     |                           |  |     |  |
+    |     |                           |  |     |  |
+    |     |                           |  v     |  |
+    |     +---------------------------+ ---    |  |
+    |                                          |  v
+    +------------------------------------------+ ---
+
+    |<----------------- stride[] ------------------>|
+*/
+typedef struct _GstMultiPlaneImageBuffer GstMultiPlaneImageBuffer;
+struct _GstMultiPlaneImageBuffer
+{
+    GstBuffer buffer;
+
+    /* width of each image plane */
+    gint      width[MPLANE_IMGB_MAX_COUNT];
+    /* height of each image plane */
+    gint      height[MPLANE_IMGB_MAX_COUNT];
+    /* stride of each image plane */
+    gint      stride[MPLANE_IMGB_MAX_COUNT];
+    /* elevation of each image plane */
+    gint      elevation[MPLANE_IMGB_MAX_COUNT];
+    /* user space address of each image plane */
+    gpointer uaddr[MPLANE_IMGB_MAX_COUNT];
+    /* Index of real address of each image plane, if needs */
+    gpointer index[MPLANE_IMGB_MAX_COUNT];
+    /* left postion, if needs */
+    gint      x;
+    /* top position, if needs */
+    gint      y;
+    /* to align memory */
+    gint      __dummy2;
+    /* arbitrary data */
+    gint      data[16];
+};
+
+struct _GstEvasPixmapSinkClass {
+  GstVideoSinkClass parent_class;
+};
+
+GType gst_evaspixmapsink_get_type(void);
+
+G_END_DECLS
+
+#endif /* __GST_EVASPIXMAPSINK_H__ */
diff --git a/wearable/evaspixmapsink/xv_types.h b/wearable/evaspixmapsink/xv_types.h
new file mode 100644 (file)
index 0000000..8266e34
--- /dev/null
@@ -0,0 +1,101 @@
+/**************************************************************************
+
+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_TYPE_H__
+#define __XV_TYPE_H__
+
+#define XV_DATA_HEADER 0xDEADCD01
+#define XV_DATA_VERSION        0x00010001
+
+/* Return Values */
+#define XV_OK 0
+#define XV_HEADER_ERROR -1
+#define XV_VERSION_MISMATCH -2
+
+/* Video Mode */
+#define DISPLAY_MODE_DEFAULT                                      0
+#define DISPLAY_MODE_PRI_VIDEO_ON_AND_SEC_VIDEO_FULL_SCREEN       1
+#define DISPLAY_MODE_PRI_VIDEO_OFF_AND_SEC_VIDEO_FULL_SCREEN      2
+
+/* Color space range */
+#define CSC_RANGE_NARROW        0
+#define CSC_RANGE_WIDE          1
+
+/* Buffer Type */
+#define XV_BUF_TYPE_DMABUF  0
+#define XV_BUF_TYPE_LEGACY  1
+#define XV_BUF_PLANE_NUM    3
+
+/* 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;
+    unsigned int dmabuf_fd[XV_BUF_PLANE_NUM];
+    unsigned int gem_handle[XV_BUF_PLANE_NUM];
+    void *bo[XV_BUF_PLANE_NUM];
+} XV_DATA, * XV_DATA_PTR;
+
+static void
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_INIT_DATA (XV_DATA_PTR data)
+{
+    data->_header = XV_DATA_HEADER;
+    data->_version = XV_DATA_VERSION;
+}
+
+static int
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_VALIDATE_DATA (XV_DATA_PTR data)
+{
+    if (data->_header != XV_DATA_HEADER)
+        return XV_HEADER_ERROR;
+    if (data->_version != XV_DATA_VERSION)
+        return XV_VERSION_MISMATCH;
+    return XV_OK;
+}
+
+#endif
diff --git a/wearable/gst-autogen.sh b/wearable/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/wearable/gst-plugins-ext0.10.manifest b/wearable/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/wearable/install-sh b/wearable/install-sh
new file mode 100755 (executable)
index 0000000..4d4a951
--- /dev/null
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+       shift
+       shift
+       continue;;
+
+    -T) no_target_directory=true
+       shift
+       continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+       # When -t is used, the destination is already specified.
+       test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+       for arg
+       do
+          if test -n "$dstarg"; then
+           # $@ is not empty: it contains at least $arg.
+           set fnord "$@" "$dstarg"
+           shift # fnord
+         fi
+         shift # arg
+         dstarg=$arg
+       done
+       break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+       echo "$0: $dstarg: Is a directory" >&2
+       exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+        '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+       # mkdir can fail with a `File exist' error in case several
+       # install-sh are creating the directory concurrently.  This
+       # is OK.
+       test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+          # The rename failed, perhaps because mv can't rename something else
+          # to itself, or perhaps because mv is so ancient that it does not
+          # support -f.
+
+          # Now remove or move aside any old file at destination location.
+          # We try this two ways since rm can't unlink itself on some
+          # systems and the destination file might be busy for other
+          # reasons.  In this case, the final cleanup might fail but the new
+          # file should still install successfully.
+          {
+            if test -f "$dstdir/$dstfile"; then
+              $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+              || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+              || {
+                echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+                (exit 1); exit 1
+              }
+            else
+              :
+            fi
+          } &&
+
+          # Now rename the file to the real destination.
+          $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+        }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/wearable/ltmain.sh b/wearable/ltmain.sh
new file mode 100755 (executable)
index 0000000..d88da2c
--- /dev/null
@@ -0,0 +1,8413 @@
+# Generated from ltmain.m4sh.
+
+# ltmain.sh (GNU libtool) 2.2.6b
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with 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.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+#     --config             show all configuration variables
+#     --debug              enable verbose shell tracing
+# -n, --dry-run            display commands without modifying any files
+#     --features           display basic configuration information and exit
+#     --mode=MODE          use operation mode MODE
+#     --preserve-dup-deps  don't remove duplicate dependency libraries
+#     --quiet, --silent    don't print informational messages
+#     --tag=TAG            use configuration variables from tag TAG
+# -v, --verbose            print informational messages (default)
+#     --version            print version information
+# -h, --help               print short or long help message
+#
+# MODE must be one of the following:
+#
+#       clean              remove files from the build directory
+#       compile            compile a source file into a libtool object
+#       execute            automatically set library path, then run a program
+#       finish             complete the installation of libtool libraries
+#       install            install libraries or executables
+#       link               create a library or an executable
+#       uninstall          remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+#       host-triplet:  $host
+#       shell:         $SHELL
+#       compiler:              $LTCC
+#       compiler flags:                $LTCFLAGS
+#       linker:                $LD (gnu? $with_gnu_ld)
+#       $progname:             (GNU libtool) 2.2.6b Debian-2.2.6b-2
+#       automake:              $automake_version
+#       autoconf:              $autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION="2.2.6b Debian-2.2.6b-2"
+TIMESTAMP=""
+package_revision=1.3017
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# NLS nuisances: We save the old values to restore during execute mode.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+          save_$lt_var=\$$lt_var
+          $lt_var=C
+         export $lt_var
+         lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+         lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+       fi"
+done
+
+$lt_unset CDPATH
+
+
+
+
+
+: ${CP="cp -f"}
+: ${ECHO="echo"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
+: ${LN_S="ln -s"}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SED="/bin/sed"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77     # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS="  $lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# 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 ()
+{
+  # 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_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+# Generated shell functions inserted here.
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+# In the unlikely event $progname began with a '-', it would play havoc with
+# func_echo (imagine progname=-n), so we prepend ./ in that case:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+case $progname in
+  -*) progname=./$progname ;;
+esac
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+  [\\/]*|[A-Za-z]:\\*) ;;
+  *[\\/]*)
+     progdir=$func_dirname_result
+     progdir=`cd "$progdir" && pwd`
+     progpath="$progdir/$progname"
+     ;;
+  *)
+     save_IFS="$IFS"
+     IFS=:
+     for progdir in $PATH; do
+       IFS="$save_IFS"
+       test -x "$progdir/$progname" && break
+     done
+     IFS="$save_IFS"
+     test -n "$progdir" || progdir=`pwd`
+     progpath="$progdir/$progname"
+     ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+  s/$bs4/&\\
+/g
+  s/^$bs2$dollar/$bs&/
+  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+  s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+    $ECHO "$progname${mode+: }$mode: $*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $opt_verbose && func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
+
+    # bash bug again:
+    :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+    func_error ${1+"$@"}
+    func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information."  ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+    my_directory_path="$1"
+    my_dir_list=
+
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+      # Protect directory names starting with `-'
+      case $my_directory_path in
+        -*) my_directory_path="./$my_directory_path" ;;
+      esac
+
+      # While some portion of DIR does not yet exist...
+      while test ! -d "$my_directory_path"; do
+        # ...make a list in topmost first order.  Use a colon delimited
+       # list incase some portion of path contains whitespace.
+        my_dir_list="$my_directory_path:$my_dir_list"
+
+        # If the last portion added has no slash in it, the list is done
+        case $my_directory_path in */*) ;; *) break ;; esac
+
+        # ...otherwise throw away the child directory and loop
+        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
+      done
+      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
+
+      save_mkdir_p_IFS="$IFS"; IFS=':'
+      for my_dir in $my_dir_list; do
+       IFS="$save_mkdir_p_IFS"
+        # mkdir can fail with a `File exist' error if two processes
+        # try to create one of the directories concurrently.  Don't
+        # stop in that case!
+        $MKDIR "$my_dir" 2>/dev/null || :
+      done
+      IFS="$save_mkdir_p_IFS"
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$opt_dry_run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+        save_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$my_tmpdir"
+        umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || \
+        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+    fi
+
+    $ECHO "X$my_tmpdir" | $Xsed
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+    case $1 in
+      *[\\\`\"\$]*)
+       func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
+      *)
+        func_quote_for_eval_unquoted_result="$1" ;;
+    esac
+
+    case $func_quote_for_eval_unquoted_result in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting, command substitution and and variable
+      # expansion for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+        ;;
+      *)
+        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+    esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    case $1 in
+      *[\\\`\"]*)
+       my_arg=`$ECHO "X$1" | $Xsed \
+           -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        my_arg="$1" ;;
+    esac
+
+    case $my_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*|"")
+        my_arg="\"$my_arg\""
+        ;;
+    esac
+
+    func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$my_cmd"
+      my_status=$?
+      if test "$my_status" -eq 0; then :; else
+       eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$lt_user_locale
+           $my_cmd"
+      my_status=$?
+      eval "$lt_safe_locale"
+      if test "$my_status" -eq 0; then :; else
+       eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
+        s/^# //
+       s/^# *$//
+        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+        p
+     }' < "$progpath"
+     exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+    $SED -n '/^# Usage:/,/# -h/ {
+        s/^# //
+       s/^# *$//
+       s/\$progname/'$progname'/
+       p
+    }' < "$progpath"
+    $ECHO
+    $ECHO "run \`$progname --help | more' for full usage"
+    exit $?
+}
+
+# func_help
+# Echo long help message to standard output and exit.
+func_help ()
+{
+    $SED -n '/^# Usage:/,/# Report bugs to/ {
+        s/^# //
+       s/^# *$//
+       s*\$progname*'$progname'*
+       s*\$host*'"$host"'*
+       s*\$SHELL*'"$SHELL"'*
+       s*\$LTCC*'"$LTCC"'*
+       s*\$LTCFLAGS*'"$LTCFLAGS"'*
+       s*\$LD*'"$LD"'*
+       s/\$with_gnu_ld/'"$with_gnu_ld"'/
+       s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+       s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+       p
+     }' < "$progpath"
+    exit $?
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+    func_error "missing argument for $1"
+    exit_cmd=exit
+}
+
+exit_cmd=:
+
+
+
+
+
+# Check that we have a working $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, and then maybe $ECHO will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+# $mode is unset
+nonopt=
+execute_dlfiles=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+opt_dry_run=false
+opt_duplicate_deps=false
+opt_silent=false
+opt_debug=:
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+    func_error ${1+"$@"}
+    func_error "See the $PACKAGE documentation for more information."
+    func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+    re_begincf='^# ### BEGIN LIBTOOL'
+    re_endcf='^# ### END LIBTOOL'
+
+    # Default configuration.
+    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+    done
+
+    exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+    $ECHO "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $ECHO "enable shared libraries"
+    else
+      $ECHO "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $ECHO "enable static libraries"
+    else
+      $ECHO "disable static libraries"
+    fi
+
+    exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+  # Global variable:
+  tagname="$1"
+
+  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+  # Validate tagname.
+  case $tagname in
+    *[!-_A-Za-z0-9,/]*)
+      func_fatal_error "invalid tag name: $tagname"
+      ;;
+  esac
+
+  # Don't test for the "default" C tag, as we know it's
+  # there but not specially marked.
+  case $tagname in
+    CC) ;;
+    *)
+      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+       taglist="$taglist $tagname"
+
+       # Evaluate the configuration.  Be careful to quote the path
+       # and the sed script, to avoid splitting on whitespace, but
+       # also don't use non-portable quotes within backquotes within
+       # quotes we have to do it in 2 steps:
+       extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+       eval "$extractedcf"
+      else
+       func_error "ignoring unknown tag $tagname"
+      fi
+      ;;
+  esac
+}
+
+# Parse options once, thoroughly.  This comes as soon as possible in
+# the script to make things like `libtool --version' happen quickly.
+{
+
+  # Shorthand for --mode=foo, only valid as the first argument
+  case $1 in
+  clean|clea|cle|cl)
+    shift; set dummy --mode clean ${1+"$@"}; shift
+    ;;
+  compile|compil|compi|comp|com|co|c)
+    shift; set dummy --mode compile ${1+"$@"}; shift
+    ;;
+  execute|execut|execu|exec|exe|ex|e)
+    shift; set dummy --mode execute ${1+"$@"}; shift
+    ;;
+  finish|finis|fini|fin|fi|f)
+    shift; set dummy --mode finish ${1+"$@"}; shift
+    ;;
+  install|instal|insta|inst|ins|in|i)
+    shift; set dummy --mode install ${1+"$@"}; shift
+    ;;
+  link|lin|li|l)
+    shift; set dummy --mode link ${1+"$@"}; shift
+    ;;
+  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+    shift; set dummy --mode uninstall ${1+"$@"}; shift
+    ;;
+  esac
+
+  # Parse non-mode specific arguments:
+  while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+      --config)                func_config                                     ;;
+
+      --debug)         preserve_args="$preserve_args $opt"
+                       func_echo "enabling shell trace mode"
+                       opt_debug='set -x'
+                       $opt_debug
+                       ;;
+
+      -dlopen)         test "$#" -eq 0 && func_missing_arg "$opt" && break
+                       execute_dlfiles="$execute_dlfiles $1"
+                       shift
+                       ;;
+
+      --dry-run | -n)  opt_dry_run=:                                   ;;
+      --features)       func_features                                  ;;
+      --finish)                mode="finish"                                   ;;
+
+      --mode)          test "$#" -eq 0 && func_missing_arg "$opt" && break
+                       case $1 in
+                         # Valid mode arguments:
+                         clean)        ;;
+                         compile)      ;;
+                         execute)      ;;
+                         finish)       ;;
+                         install)      ;;
+                         link)         ;;
+                         relink)       ;;
+                         uninstall)    ;;
+
+                         # Catch anything else as an error
+                         *) func_error "invalid argument for $opt"
+                            exit_cmd=exit
+                            break
+                            ;;
+                       esac
+
+                       mode="$1"
+                       shift
+                       ;;
+
+      --preserve-dup-deps)
+                       opt_duplicate_deps=:                            ;;
+
+      --quiet|--silent)        preserve_args="$preserve_args $opt"
+                       opt_silent=:
+                       ;;
+
+      --verbose| -v)   preserve_args="$preserve_args $opt"
+                       opt_silent=false
+                       ;;
+
+      --tag)           test "$#" -eq 0 && func_missing_arg "$opt" && break
+                       preserve_args="$preserve_args $opt $1"
+                       func_enable_tag "$1"    # tagname is set here
+                       shift
+                       ;;
+
+      # Separate optargs to long options:
+      -dlopen=*|--mode=*|--tag=*)
+                       func_opt_split "$opt"
+                       set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
+                       shift
+                       ;;
+
+      -\?|-h)          func_usage                                      ;;
+      --help)          opt_help=:                                      ;;
+      --version)       func_version                                    ;;
+
+      -*)              func_fatal_help "unrecognized option \`$opt'"   ;;
+
+      *)               nonopt="$opt"
+                       break
+                       ;;
+    esac
+  done
+
+
+  case $host in
+    *cygwin* | *mingw* | *pw32* | *cegcc*)
+      # don't eliminate duplications in $postdeps and $predeps
+      opt_duplicate_compiler_generated_deps=:
+      ;;
+    *)
+      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
+      ;;
+  esac
+
+  # Having warned about all mis-specified options, bail out if
+  # anything was wrong.
+  $exit_cmd $EXIT_FAILURE
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
+
+    exit $EXIT_MISMATCH
+  fi
+}
+
+
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+$opt_help || {
+  # Sanity checks first:
+  func_check_version_match
+
+  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+    func_fatal_configuration "not configured to build any kind of library"
+  fi
+
+  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+
+
+  # Darwin sucks
+  eval std_shrext=\"$shrext_cmds\"
+
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    func_error "unrecognized option \`-dlopen'"
+    $ECHO "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$progname --help --mode=$mode' for more information."
+}
+
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null \
+        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+       for lalib_p_l in 1 2 3 4
+       do
+           read lalib_p_line
+           case "$lalib_p_line" in
+               \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+           esac
+       done
+       exec 0<&5 5<&-
+    fi
+    test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+    func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+    func_ltwrapper_exec_suffix=
+    case $1 in
+    *.exe) ;;
+    *) func_ltwrapper_exec_suffix=.exe ;;
+    esac
+    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+    func_ltwrapper_scriptname_result=""
+    if func_ltwrapper_executable_p "$1"; then
+       func_dirname_and_basename "$1" "" "."
+       func_stripname '' '.exe' "$func_basename_result"
+       func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+    fi
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+    $opt_debug
+    save_ifs=$IFS; IFS='~'
+    for cmd in $1; do
+      IFS=$save_ifs
+      eval cmd=\"$cmd\"
+      func_show_eval "$cmd" "${2-:}"
+    done
+    IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)!  Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+    $opt_debug
+    case $1 in
+    */* | *\\*)        . "$1" ;;
+    *)         . "./$1" ;;
+    esac
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    $opt_debug
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+        func_quote_for_eval "$arg"
+       CC_quoted="$CC_quoted $func_quote_for_eval_result"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+       for z in $available_tags; do
+         if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+           # Evaluate the configuration.
+           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+           CC_quoted=
+           for arg in $CC; do
+             # Double-quote args containing other shell metacharacters.
+             func_quote_for_eval "$arg"
+             CC_quoted="$CC_quoted $func_quote_for_eval_result"
+           done
+           case "$@ " in
+             " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
+             # The compiler in the base compile command matches
+             # the one in the tagged configuration.
+             # Assume this is the tagged configuration we want.
+             tagname=$z
+             break
+             ;;
+           esac
+         fi
+       done
+       # If $tagname still isn't set, then no tagged configuration
+       # was found and let the user know that the "--tag" command
+       # line option must be used.
+       if test -z "$tagname"; then
+         func_echo "unable to infer tagged configuration"
+         func_fatal_error "specify a tag with \`--tag'"
+#      else
+#        func_verbose "using $tagname tagged configuration"
+       fi
+       ;;
+      esac
+    fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=${1}
+    if test "$build_libtool_libs" = yes; then
+      write_lobj=\'${2}\'
+    else
+      write_lobj=none
+    fi
+
+    if test "$build_old_libs" = yes; then
+      write_oldobj=\'${3}\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+      $MV "${write_libobj}T" "${write_libobj}"
+    }
+}
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+    $opt_debug
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+    pie_flag=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+       # do not "continue".  Instead, add this to base_compile
+       lastarg="$arg"
+       arg_mode=normal
+       ;;
+
+      target )
+       libobj="$arg"
+       arg_mode=normal
+       continue
+       ;;
+
+      normal )
+       # Accept any command-line options.
+       case $arg in
+       -o)
+         test -n "$libobj" && \
+           func_fatal_error "you cannot specify \`-o' more than once"
+         arg_mode=target
+         continue
+         ;;
+
+       -pie | -fpie | -fPIE)
+          pie_flag="$pie_flag $arg"
+         continue
+         ;;
+
+       -shared | -static | -prefer-pic | -prefer-non-pic)
+         later="$later $arg"
+         continue
+         ;;
+
+       -no-suppress)
+         suppress_opt=no
+         continue
+         ;;
+
+       -Xcompiler)
+         arg_mode=arg  #  the next one goes into the "base_compile" arg list
+         continue      #  The current "srcfile" will either be retained or
+         ;;            #  replaced later.  I would guess that would be a bug.
+
+       -Wc,*)
+         func_stripname '-Wc,' '' "$arg"
+         args=$func_stripname_result
+         lastarg=
+         save_ifs="$IFS"; IFS=','
+         for arg in $args; do
+           IFS="$save_ifs"
+           func_quote_for_eval "$arg"
+           lastarg="$lastarg $func_quote_for_eval_result"
+         done
+         IFS="$save_ifs"
+         func_stripname ' ' '' "$lastarg"
+         lastarg=$func_stripname_result
+
+         # Add the arguments to base_compile.
+         base_compile="$base_compile $lastarg"
+         continue
+         ;;
+
+       *)
+         # Accept the current argument as the source file.
+         # The previous "srcfile" becomes the current argument.
+         #
+         lastarg="$srcfile"
+         srcfile="$arg"
+         ;;
+       esac  #  case $arg
+       ;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      func_quote_for_eval "$lastarg"
+      base_compile="$base_compile $func_quote_for_eval_result"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      func_fatal_error "you must specify an argument for -Xcompile"
+      ;;
+    target)
+      func_fatal_error "you must specify a target with \`-o'"
+      ;;
+    *)
+      # Get the name of the library object.
+      test -z "$libobj" && {
+       func_basename "$srcfile"
+       libobj="$func_basename_result"
+      }
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    case $libobj in
+    *.[cCFSifmso] | \
+    *.ada | *.adb | *.ads | *.asm | \
+    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+      func_xform "$libobj"
+      libobj=$func_xform_result
+      ;;
+    esac
+
+    case $libobj in
+    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+    *)
+      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -shared)
+       test "$build_libtool_libs" != yes && \
+         func_fatal_configuration "can not build a shared library"
+       build_old_libs=no
+       continue
+       ;;
+
+      -static)
+       build_libtool_libs=no
+       build_old_libs=yes
+       continue
+       ;;
+
+      -prefer-pic)
+       pic_mode=yes
+       continue
+       ;;
+
+      -prefer-non-pic)
+       pic_mode=no
+       continue
+       ;;
+      esac
+    done
+
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'   &()|`$[]' \
+      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+    func_dirname_and_basename "$obj" "/" ""
+    objname="$func_basename_result"
+    xdir="$func_dirname_result"
+    lobj=${xdir}$objdir/$objname
+
+    test -z "$base_compile" && \
+      func_fatal_help "you must specify a compilation command"
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+       func_echo "Waiting for $lockfile to be removed"
+       sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+       $ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $opt_dry_run || $RM $removelist
+       exit $EXIT_FAILURE
+      fi
+      removelist="$removelist $output_obj"
+      $ECHO "$srcfile" > "$lockfile"
+    fi
+
+    $opt_dry_run || $RM $removelist
+    removelist="$removelist $lockfile"
+    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+       command="$base_compile $qsrcfile $pic_flag"
+      else
+       # Don't build PIC code
+       command="$base_compile $qsrcfile"
+      fi
+
+      func_mkdir_p "$xdir$objdir"
+
+      if test -z "$output_obj"; then
+       # Place PIC objects in $objdir
+       command="$command -o $lobj"
+      fi
+
+      func_show_eval_locale "$command" \
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $opt_dry_run || $RM $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+       func_show_eval '$MV "$output_obj" "$lobj"' \
+         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+       suppress_output=' >/dev/null 2>&1'
+      fi
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+       # Don't build PIC code
+       command="$base_compile $qsrcfile$pie_flag"
+      else
+       command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+       command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      func_show_eval_locale "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+        test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+       $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+       $opt_dry_run || $RM $removelist
+       exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+       func_show_eval '$MV "$output_obj" "$obj"' \
+         'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+    fi
+
+    $opt_dry_run || {
+      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+      # Unlock the critical section if it was locked
+      if test "$need_locks" != no; then
+       removelist=$lockfile
+        $RM "$lockfile"
+      fi
+    }
+
+    exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+test "$mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+    # We need to display help for each of the modes.
+    case $mode in
+      "")
+        # Generic help is extracted from the usage comments
+        # at the start of this file.
+        func_help
+        ;;
+
+      clean)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      compile)
+      $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -no-suppress      do not suppress compiler output for multiple passes
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -shared           do not build a \`.o' file suitable for static linking
+  -static           only build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+        ;;
+
+      execute)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+        ;;
+
+      finish)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+        ;;
+
+      install)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+        ;;
+
+      link)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -shared           only do dynamic linking of libtool libraries
+  -shrext SUFFIX    override the standard shared library file extension
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+  -weak LIBNAME     declare that the target provides the LIBNAME interface
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+        ;;
+
+      uninstall)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      *)
+        func_fatal_help "invalid operation mode \`$mode'"
+        ;;
+    esac
+
+    $ECHO
+    $ECHO "Try \`$progname --help' for more information about other modes."
+
+    exit $?
+}
+
+  # Now that we've collected a possible --mode arg, show help if necessary
+  $opt_help && func_mode_help
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+    $opt_debug
+    # The first argument is the command name.
+    cmd="$nonopt"
+    test -z "$cmd" && \
+      func_fatal_help "you must specify a COMMAND"
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      test -f "$file" \
+       || func_fatal_help "\`$file' is not a file"
+
+      dir=
+      case $file in
+      *.la)
+       # Check to see that this really is a libtool archive.
+       func_lalib_unsafe_p "$file" \
+         || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+       # Read the libtool library.
+       dlname=
+       library_names=
+       func_source "$file"
+
+       # Skip this library if it cannot be dlopened.
+       if test -z "$dlname"; then
+         # Warn if it was a shared library.
+         test -n "$library_names" && \
+           func_warning "\`$file' was not linked with \`-export-dynamic'"
+         continue
+       fi
+
+       func_dirname "$file" "" "."
+       dir="$func_dirname_result"
+
+       if test -f "$dir/$objdir/$dlname"; then
+         dir="$dir/$objdir"
+       else
+         if test ! -f "$dir/$dlname"; then
+           func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+         fi
+       fi
+       ;;
+
+      *.lo)
+       # Just add the directory containing the .lo file.
+       func_dirname "$file" "" "."
+       dir="$func_dirname_result"
+       ;;
+
+      *)
+       func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+       continue
+       ;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+       eval "$shlibpath_var=\"\$dir\""
+      else
+       eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+       # Do a test to see if this is really a libtool program.
+       if func_ltwrapper_script_p "$file"; then
+         func_source "$file"
+         # Transform arg to wrapped name.
+         file="$progdir/$program"
+       elif func_ltwrapper_executable_p "$file"; then
+         func_ltwrapper_scriptname "$file"
+         func_source "$func_ltwrapper_scriptname_result"
+         # Transform arg to wrapped name.
+         file="$progdir/$program"
+       fi
+       ;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      func_quote_for_eval "$file"
+      args="$args $func_quote_for_eval_result"
+    done
+
+    if test "X$opt_dry_run" = Xfalse; then
+      if test -n "$shlibpath_var"; then
+       # Export the shlibpath_var.
+       eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+       eval "if test \"\${save_$lt_var+set}\" = set; then
+                $lt_var=\$save_$lt_var; export $lt_var
+             else
+               $lt_unset $lt_var
+             fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+       eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+       $ECHO "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+       libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+       if test -n "$finish_cmds"; then
+         # Do each command in the finish commands.
+         func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+       fi
+       if test -n "$finish_eval"; then
+         # Do the single finish_eval.
+         eval cmds=\"$finish_eval\"
+         $opt_dry_run || eval "$cmds" || admincmds="$admincmds
+       $cmds"
+       fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    $opt_silent && exit $EXIT_SUCCESS
+
+    $ECHO "X----------------------------------------------------------------------" | $Xsed
+    $ECHO "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $ECHO "   $libdir"
+    done
+    $ECHO
+    $ECHO "If you ever happen to want to link against installed libraries"
+    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
+    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $ECHO "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $ECHO "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $ECHO "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $ECHO "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $ECHO "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $ECHO
+
+    $ECHO "See any operating system documentation about shared libraries for"
+    case $host in
+      solaris2.[6789]|solaris2.1[0-9])
+        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+       $ECHO "pages."
+       ;;
+      *)
+        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
+        ;;
+    esac
+    $ECHO "X----------------------------------------------------------------------" | $Xsed
+    exit $EXIT_SUCCESS
+}
+
+test "$mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+    $opt_debug
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
+      # Aesthetically quote it.
+      func_quote_for_eval "$nonopt"
+      install_prog="$func_quote_for_eval_result "
+      arg=$1
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    func_quote_for_eval "$arg"
+    install_prog="$install_prog$func_quote_for_eval_result"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+       files="$files $dest"
+       dest=$arg
+       continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f)
+       case " $install_prog " in
+       *[\\\ /]cp\ *) ;;
+       *) prev=$arg ;;
+       esac
+       ;;
+      -g | -m | -o)
+       prev=$arg
+       ;;
+      -s)
+       stripme=" -s"
+       continue
+       ;;
+      -*)
+       ;;
+      *)
+       # If the previous option needed an argument, then skip it.
+       if test -n "$prev"; then
+         prev=
+       else
+         dest=$arg
+         continue
+       fi
+       ;;
+      esac
+
+      # Aesthetically quote the argument.
+      func_quote_for_eval "$arg"
+      install_prog="$install_prog $func_quote_for_eval_result"
+    done
+
+    test -z "$install_prog" && \
+      func_fatal_help "you must specify an install program"
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prev' option requires an argument"
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+       func_fatal_help "no file or destination specified"
+      else
+       func_fatal_help "you must specify a destination"
+      fi
+    fi
+
+    # Strip any trailing slash from the destination.
+    func_stripname '' '/' "$dest"
+    dest=$func_stripname_result
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      func_dirname_and_basename "$dest" "" "."
+      destdir="$func_dirname_result"
+      destname="$func_basename_result"
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files; shift
+      test "$#" -gt 1 && \
+       func_fatal_help "\`$dest' is not a directory"
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+       case $file in
+       *.lo) ;;
+       *)
+         func_fatal_help "\`$destdir' must be an absolute directory name"
+         ;;
+       esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+       # Do the static libraries later.
+       staticlibs="$staticlibs $file"
+       ;;
+
+      *.la)
+       # Check to see that this really is a libtool archive.
+       func_lalib_unsafe_p "$file" \
+         || func_fatal_help "\`$file' is not a valid libtool archive"
+
+       library_names=
+       old_library=
+       relink_command=
+       func_source "$file"
+
+       # Add the libdir to current_libdirs if it is the destination.
+       if test "X$destdir" = "X$libdir"; then
+         case "$current_libdirs " in
+         *" $libdir "*) ;;
+         *) current_libdirs="$current_libdirs $libdir" ;;
+         esac
+       else
+         # Note the libdir as a future libdir.
+         case "$future_libdirs " in
+         *" $libdir "*) ;;
+         *) future_libdirs="$future_libdirs $libdir" ;;
+         esac
+       fi
+
+       func_dirname "$file" "/" ""
+       dir="$func_dirname_result"
+       dir="$dir$objdir"
+
+       if test -n "$relink_command"; then
+         # Determine the prefix the user has applied to our future dir.
+         inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
+
+         # Don't allow the user to place us outside of our expected
+         # location b/c this prevents finding dependent libraries that
+         # are installed to the same prefix.
+         # At present, this check doesn't affect windows .dll's that
+         # are installed into $libdir/../bin (currently, that works fine)
+         # but it's something to keep an eye on.
+         test "$inst_prefix_dir" = "$destdir" && \
+           func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+         if test -n "$inst_prefix_dir"; then
+           # Stick the inst_prefix_dir data into the link command.
+           relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+         else
+           relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
+         fi
+
+         func_warning "relinking \`$file'"
+         func_show_eval "$relink_command" \
+           'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+       fi
+
+       # See the names of the shared library.
+       set dummy $library_names; shift
+       if test -n "$1"; then
+         realname="$1"
+         shift
+
+         srcname="$realname"
+         test -n "$relink_command" && srcname="$realname"T
+
+         # Install the shared library and build the symlinks.
+         func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+             'exit $?'
+         tstripme="$stripme"
+         case $host_os in
+         cygwin* | mingw* | pw32* | cegcc*)
+           case $realname in
+           *.dll.a)
+             tstripme=""
+             ;;
+           esac
+           ;;
+         esac
+         if test -n "$tstripme" && test -n "$striplib"; then
+           func_show_eval "$striplib $destdir/$realname" 'exit $?'
+         fi
+
+         if test "$#" -gt 0; then
+           # Delete the old symlinks, and create new ones.
+           # Try `ln -sf' first, because the `ln' binary might depend on
+           # the symlink we replace!  Solaris /bin/ln does not understand -f,
+           # so we also need to try rm && ln -s.
+           for linkname
+           do
+             test "$linkname" != "$realname" \
+               && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+           done
+         fi
+
+         # Do each command in the postinstall commands.
+         lib="$destdir/$realname"
+         func_execute_cmds "$postinstall_cmds" 'exit $?'
+       fi
+
+       # Install the pseudo-library for information purposes.
+       func_basename "$file"
+       name="$func_basename_result"
+       instname="$dir/$name"i
+       func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+       # Maybe install the static library, too.
+       test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+       ;;
+
+      *.lo)
+       # Install (i.e. copy) a libtool object.
+
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         func_basename "$file"
+         destfile="$func_basename_result"
+         destfile="$destdir/$destfile"
+       fi
+
+       # Deduce the name of the destination old-style object file.
+       case $destfile in
+       *.lo)
+         func_lo2o "$destfile"
+         staticdest=$func_lo2o_result
+         ;;
+       *.$objext)
+         staticdest="$destfile"
+         destfile=
+         ;;
+       *)
+         func_fatal_help "cannot copy a libtool object to \`$destfile'"
+         ;;
+       esac
+
+       # Install the libtool object if requested.
+       test -n "$destfile" && \
+         func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+       # Install the old object if enabled.
+       if test "$build_old_libs" = yes; then
+         # Deduce the name of the old-style object file.
+         func_lo2o "$file"
+         staticobj=$func_lo2o_result
+         func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+       fi
+       exit $EXIT_SUCCESS
+       ;;
+
+      *)
+       # Figure out destination file name, if it wasn't already specified.
+       if test -n "$destname"; then
+         destfile="$destdir/$destname"
+       else
+         func_basename "$file"
+         destfile="$func_basename_result"
+         destfile="$destdir/$destfile"
+       fi
+
+       # If the file is missing, and there is a .exe on the end, strip it
+       # because it is most likely a libtool script we actually want to
+       # install
+       stripped_ext=""
+       case $file in
+         *.exe)
+           if test ! -f "$file"; then
+             func_stripname '' '.exe' "$file"
+             file=$func_stripname_result
+             stripped_ext=".exe"
+           fi
+           ;;
+       esac
+
+       # Do a test to see if this is really a libtool program.
+       case $host in
+       *cygwin* | *mingw*)
+           if func_ltwrapper_executable_p "$file"; then
+             func_ltwrapper_scriptname "$file"
+             wrapper=$func_ltwrapper_scriptname_result
+           else
+             func_stripname '' '.exe' "$file"
+             wrapper=$func_stripname_result
+           fi
+           ;;
+       *)
+           wrapper=$file
+           ;;
+       esac
+       if func_ltwrapper_script_p "$wrapper"; then
+         notinst_deplibs=
+         relink_command=
+
+         func_source "$wrapper"
+
+         # Check the variables that should have been set.
+         test -z "$generated_by_libtool_version" && \
+           func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+         finalize=yes
+         for lib in $notinst_deplibs; do
+           # Check to see that each library is installed.
+           libdir=
+           if test -f "$lib"; then
+             func_source "$lib"
+           fi
+           libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+           if test -n "$libdir" && test ! -f "$libfile"; then
+             func_warning "\`$lib' has not been installed in \`$libdir'"
+             finalize=no
+           fi
+         done
+
+         relink_command=
+         func_source "$wrapper"
+
+         outputname=
+         if test "$fast_install" = no && test -n "$relink_command"; then
+           $opt_dry_run || {
+             if test "$finalize" = yes; then
+               tmpdir=`func_mktempdir`
+               func_basename "$file$stripped_ext"
+               file="$func_basename_result"
+               outputname="$tmpdir/$file"
+               # Replace the output file specification.
+               relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+               $opt_silent || {
+                 func_quote_for_expand "$relink_command"
+                 eval "func_echo $func_quote_for_expand_result"
+               }
+               if eval "$relink_command"; then :
+                 else
+                 func_error "error: relink \`$file' with the above command before installing it"
+                 $opt_dry_run || ${RM}r "$tmpdir"
+                 continue
+               fi
+               file="$outputname"
+             else
+               func_warning "cannot relink \`$file'"
+             fi
+           }
+         else
+           # Install the binary that we compiled earlier.
+           file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+         fi
+       fi
+
+       # remove .exe since cygwin /usr/bin/install will append another
+       # one anyway
+       case $install_prog,$host in
+       */usr/bin/install*,*cygwin*)
+         case $file:$destfile in
+         *.exe:*.exe)
+           # this is ok
+           ;;
+         *.exe:*)
+           destfile=$destfile.exe
+           ;;
+         *:*.exe)
+           func_stripname '' '.exe' "$destfile"
+           destfile=$func_stripname_result
+           ;;
+         esac
+         ;;
+       esac
+       func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+       $opt_dry_run || if test -n "$outputname"; then
+         ${RM}r "$tmpdir"
+       fi
+       ;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      func_basename "$file"
+      name="$func_basename_result"
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+       func_show_eval "$old_striplib $oldlib" 'exit $?'
+      fi
+
+      # Do each command in the postinstall commands.
+      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+    done
+
+    test -n "$future_libdirs" && \
+      func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+    $opt_debug
+    my_outputname="$1"
+    my_originator="$2"
+    my_pic_p="${3-no}"
+    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    my_dlsyms=
+
+    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+      if test -n "$NM" && test -n "$global_symbol_pipe"; then
+       my_dlsyms="${my_outputname}S.c"
+      else
+       func_error "not configured to extract global symbols from dlpreopened files"
+      fi
+    fi
+
+    if test -n "$my_dlsyms"; then
+      case $my_dlsyms in
+      "") ;;
+      *.c)
+       # Discover the nlist of each of the dlfiles.
+       nlist="$output_objdir/${my_outputname}.nm"
+
+       func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+       # Parse the name list into a source file.
+       func_verbose "creating $output_objdir/$my_dlsyms"
+
+       $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+       if test "$dlself" = yes; then
+         func_verbose "generating symbol list for \`$output'"
+
+         $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+         # Add our own program objects to the symbol list.
+         progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+         for progfile in $progfiles; do
+           func_verbose "extracting global C symbols from \`$progfile'"
+           $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+         done
+
+         if test -n "$exclude_expsyms"; then
+           $opt_dry_run || {
+             eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+           }
+         fi
+
+         if test -n "$export_symbols_regex"; then
+           $opt_dry_run || {
+             eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+           }
+         fi
+
+         # Prepare the list of exported symbols
+         if test -z "$export_symbols"; then
+           export_symbols="$output_objdir/$outputname.exp"
+           $opt_dry_run || {
+             $RM $export_symbols
+             eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+             case $host in
+             *cygwin* | *mingw* | *cegcc* )
+                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+               ;;
+             esac
+           }
+         else
+           $opt_dry_run || {
+             eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+             eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+             eval '$MV "$nlist"T "$nlist"'
+             case $host in
+               *cygwin | *mingw* | *cegcc* )
+                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+                 ;;
+             esac
+           }
+         fi
+       fi
+
+       for dlprefile in $dlprefiles; do
+         func_verbose "extracting global C symbols from \`$dlprefile'"
+         func_basename "$dlprefile"
+         name="$func_basename_result"
+         $opt_dry_run || {
+           eval '$ECHO ": $name " >> "$nlist"'
+           eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+         }
+       done
+
+       $opt_dry_run || {
+         # Make sure we have at least an empty file.
+         test -f "$nlist" || : > "$nlist"
+
+         if test -n "$exclude_expsyms"; then
+           $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+           $MV "$nlist"T "$nlist"
+         fi
+
+         # Try sorting and uniquifying the output.
+         if $GREP -v "^: " < "$nlist" |
+             if sort -k 3 </dev/null >/dev/null 2>&1; then
+               sort -k 3
+             else
+               sort +2
+             fi |
+             uniq > "$nlist"S; then
+           :
+         else
+           $GREP -v "^: " < "$nlist" > "$nlist"S
+         fi
+
+         if test -f "$nlist"S; then
+           eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+         else
+           $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
+         fi
+
+         $ECHO >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols.  */
+typedef struct {
+  const char *name;
+  void *address;
+} lt_dlsymlist;
+"
+         case $host in
+         *cygwin* | *mingw* | *cegcc* )
+           $ECHO >> "$output_objdir/$my_dlsyms" "\
+/* DATA imports from DLLs on WIN32 con't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs.  */"
+           lt_dlsym_const= ;;
+         *osf5*)
+           echo >> "$output_objdir/$my_dlsyms" "\
+/* This system does not cope well with relocations in const data */"
+           lt_dlsym_const= ;;
+         *)
+           lt_dlsym_const=const ;;
+         esac
+
+         $ECHO >> "$output_objdir/$my_dlsyms" "\
+extern $lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+$lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+  { \"$my_originator\", (void *) 0 },"
+
+         case $need_lib_prefix in
+         no)
+           eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+           ;;
+         *)
+           eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+           ;;
+         esac
+         $ECHO >> "$output_objdir/$my_dlsyms" "\
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+       } # !$opt_dry_run
+
+       pic_flag_for_symtable=
+       case "$compile_command " in
+       *" -static "*) ;;
+       *)
+         case $host in
+         # compiling the symbol table file with pic_flag works around
+         # a FreeBSD bug that causes programs to crash when -lm is
+         # linked before any other PIC object.  But we must not use
+         # pic_flag when linking with -static.  The problem exists in
+         # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+         *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+           pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+         *-*-hpux*)
+           pic_flag_for_symtable=" $pic_flag"  ;;
+         *)
+           if test "X$my_pic_p" != Xno; then
+             pic_flag_for_symtable=" $pic_flag"
+           fi
+           ;;
+         esac
+         ;;
+       esac
+       symtab_cflags=
+       for arg in $LTCFLAGS; do
+         case $arg in
+         -pie | -fpie | -fPIE) ;;
+         *) symtab_cflags="$symtab_cflags $arg" ;;
+         esac
+       done
+
+       # Now compile the dynamic symbol file.
+       func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+       # Clean up the generated files.
+       func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+       # Transform the symbol file into the correct name.
+       symfileobj="$output_objdir/${my_outputname}S.$objext"
+       case $host in
+       *cygwin* | *mingw* | *cegcc* )
+         if test -f "$output_objdir/$my_outputname.def"; then
+           compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+           finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+         else
+           compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+           finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+         fi
+         ;;
+       *)
+         compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+         finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+         ;;
+       esac
+       ;;
+      *)
+       func_fatal_error "unknown suffix for \`$my_dlsyms'"
+       ;;
+      esac
+    else
+      # We keep going just in case the user didn't refer to
+      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+      # really was required.
+
+      # Nullify the symbol file.
+      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+    fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+  $opt_debug
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 |
+       $SED -n -e '
+           1,100{
+               / I /{
+                   s,.*,import,
+                   p
+                   q
+               }
+           }'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $ECHO "$win32_libid_type"
+}
+
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    $opt_debug
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    $opt_debug
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+       [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+       *) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      func_basename "$my_xlib"
+      my_xlib="$func_basename_result"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+       *" $my_xlib_u "*)
+         func_arith $extracted_serial + 1
+         extracted_serial=$func_arith_result
+         my_xlib_u=lt$extracted_serial-$my_xlib ;;
+       *) break ;;
+       esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      func_mkdir_p "$my_xdir"
+
+      case $host in
+      *-darwin*)
+       func_verbose "Extracting $my_xabs"
+       # Do not bother doing anything if just a dry run
+       $opt_dry_run || {
+         darwin_orig_dir=`pwd`
+         cd $my_xdir || exit $?
+         darwin_archive=$my_xabs
+         darwin_curdir=`pwd`
+         darwin_base_archive=`basename "$darwin_archive"`
+         darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+         if test -n "$darwin_arches"; then
+           darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+           darwin_arch=
+           func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+           for darwin_arch in  $darwin_arches ; do
+             func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+             $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+             cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+             func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+             cd "$darwin_curdir"
+             $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+           done # $darwin_arches
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+           darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+           darwin_file=
+           darwin_files=
+           for darwin_file in $darwin_filelist; do
+             darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+             $LIPO -create -output "$darwin_file" $darwin_files
+           done # $darwin_filelist
+           $RM -rf unfat-$$
+           cd "$darwin_orig_dir"
+         else
+           cd $darwin_orig_dir
+           func_extract_an_archive "$my_xdir" "$my_xabs"
+         fi # $darwin_arches
+       } # !$opt_dry_run
+       ;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+       ;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+
+
+
+# func_emit_wrapper_part1 [arg=no]
+#
+# Emit the first part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part1 ()
+{
+       func_emit_wrapper_part1_arg1=no
+       if test -n "$1" ; then
+         func_emit_wrapper_part1_arg1=$1
+       fi
+
+       $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='$macro_version'
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$ECHO are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    ECHO=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$ECHO works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$ECHO will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+       $ECHO "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+"
+}
+# end: func_emit_wrapper_part1
+
+# func_emit_wrapper_part2 [arg=no]
+#
+# Emit the second part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part2 ()
+{
+       func_emit_wrapper_part2_arg1=no
+       if test -n "$1" ; then
+         func_emit_wrapper_part2_arg1=$1
+       fi
+
+       $ECHO "\
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
+  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+    # special case for '.'
+    if test \"\$thisdir\" = \".\"; then
+      thisdir=\`pwd\`
+    fi
+    # remove .libs from thisdir
+    case \"\$thisdir\" in
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    $objdir )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+       if test "$fast_install" = yes; then
+         $ECHO "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" ||
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $MKDIR \"\$progdir\"
+    else
+      $RM \"\$progdir/\$file\"
+    fi"
+
+         $ECHO "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+       $ECHO \"\$relink_command_output\" >&2
+       $RM \"\$progdir/\$file\"
+       exit 1
+      fi
+    fi
+
+    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $RM \"\$progdir/\$program\";
+      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $RM \"\$progdir/\$file\"
+  fi"
+       else
+         $ECHO "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+       fi
+
+       $ECHO "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+       # Export our shlibpath_var if we have one.
+       if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+         $ECHO "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+       fi
+
+       # fixup the dll searchpath if we need to.
+       if test -n "$dllsearchpath"; then
+         $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+       fi
+
+       $ECHO "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+       case $host in
+       # Backslashes separate directories on plain windows
+       *-*-mingw | *-*-os2* | *-cegcc*)
+         $ECHO "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+         ;;
+
+       *)
+         $ECHO "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+         ;;
+       esac
+       $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+    fi
+  else
+    # The program doesn't exist.
+    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+}
+# end: func_emit_wrapper_part2
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+       func_emit_wrapper_arg1=no
+       if test -n "$1" ; then
+         func_emit_wrapper_arg1=$1
+       fi
+
+       # split this up so that func_emit_cwrapperexe_src
+       # can call each part independently.
+       func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
+       func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
+}
+
+
+# func_to_host_path arg
+#
+# Convert paths to host format when used with build tools.
+# Intended for use with "native" mingw (where libtool itself
+# is running under the msys shell), or in the following cross-
+# build environments:
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+# where wine is equipped with the `winepath' executable.
+# In the native mingw case, the (msys) shell automatically
+# converts paths for any non-msys applications it launches,
+# but that facility isn't available from inside the cwrapper.
+# Similar accommodations are necessary for $host mingw and
+# $build cygwin.  Calling this function does no harm for other
+# $host/$build combinations not listed above.
+#
+# ARG is the path (on $build) that should be converted to
+# the proper representation for $host. The result is stored
+# in $func_to_host_path_result.
+func_to_host_path ()
+{
+  func_to_host_path_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        case $build in
+          *mingw* ) # actually, msys
+            # awkward: cmd appends spaces to result
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_path_tmp1=`cygpath -w "$1"`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # Unfortunately, winepath does not exit with a non-zero
+            # error code, so we are forced to check the contents of
+            # stdout. On the other hand, if the command is not
+            # found, the shell will set an exit code of 127 and print
+            # *an error message* to stdout. So we must check for both
+            # error code of zero AND non-empty stdout, which explains
+            # the odd construction:
+            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
+            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
+              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+                $SED -e "$lt_sed_naive_backslashify"`
+            else
+              # Allow warning below.
+              func_to_host_path_result=""
+            fi
+            ;;
+        esac
+        if test -z "$func_to_host_path_result" ; then
+          func_error "Could not determine host path corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback:
+          func_to_host_path_result="$1"
+        fi
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_path
+
+# func_to_host_pathlist arg
+#
+# Convert pathlists to host format when used with build tools.
+# See func_to_host_path(), above. This function supports the
+# following $build/$host combinations (but does no harm for
+# combinations not listed here):
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+#
+# Path separators are also converted from $build format to
+# $host format. If ARG begins or ends with a path separator
+# character, it is preserved (but converted to $host format)
+# on output.
+#
+# ARG is a pathlist (on $build) that should be converted to
+# the proper representation on $host. The result is stored
+# in $func_to_host_pathlist_result.
+func_to_host_pathlist ()
+{
+  func_to_host_pathlist_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        # Remove leading and trailing path separator characters from
+        # ARG. msys behavior is inconsistent here, cygpath turns them
+        # into '.;' and ';.', and winepath ignores them completely.
+        func_to_host_pathlist_tmp2="$1"
+        # Once set for this call, this variable should not be
+        # reassigned. It is used in tha fallback case.
+        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
+          $SED -e 's|^:*||' -e 's|:*$||'`
+        case $build in
+          *mingw* ) # Actually, msys.
+            # Awkward: cmd appends spaces to result.
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # unfortunately, winepath doesn't convert pathlists
+            func_to_host_pathlist_result=""
+            func_to_host_pathlist_oldIFS=$IFS
+            IFS=:
+            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
+              IFS=$func_to_host_pathlist_oldIFS
+              if test -n "$func_to_host_pathlist_f" ; then
+                func_to_host_path "$func_to_host_pathlist_f"
+                if test -n "$func_to_host_path_result" ; then
+                  if test -z "$func_to_host_pathlist_result" ; then
+                    func_to_host_pathlist_result="$func_to_host_path_result"
+                  else
+                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+                  fi
+                fi
+              fi
+              IFS=:
+            done
+            IFS=$func_to_host_pathlist_oldIFS
+            ;;
+        esac
+        if test -z "$func_to_host_pathlist_result" ; then
+          func_error "Could not determine the host path(s) corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback. This may break if $1 contains DOS-style drive
+          # specifications. The fix is not to complicate the expression
+          # below, but for the user to provide a working wine installation
+          # with winepath so that path translation in the cross-to-mingw
+          # case works properly.
+          lt_replace_pathsep_nix_to_dos="s|:|;|g"
+          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
+            $SED -e "$lt_replace_pathsep_nix_to_dos"`
+        fi
+        # Now, add the leading and trailing path separators back
+        case "$1" in
+          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
+            ;;
+        esac
+        case "$1" in
+          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+            ;;
+        esac
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_pathlist
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+       cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "$SHELL $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+           cat <<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+# define setmode _setmode
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+#  include <io.h>
+#  define HAVE_SETENV
+#  ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+#  endif
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+#ifdef _MSC_VER
+# define S_IXUSR _S_IEXEC
+# define stat _stat
+# ifndef _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+       (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifdef __CYGWIN__
+# define FOPEN_WB "wb"
+#endif
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#undef LTWRAPPER_DEBUGPRINTF
+#if defined DEBUGWRAPPER
+# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
+static void
+ltwrapper_debugprintf (const char *fmt, ...)
+{
+    va_list args;
+    va_start (args, fmt);
+    (void) vfprintf (stderr, fmt, args);
+    va_end (args);
+}
+#else
+# define LTWRAPPER_DEBUGPRINTF(args)
+#endif
+
+const char *program_name = NULL;
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_opt_process_env_set (const char *arg);
+void lt_opt_process_env_prepend (const char *arg);
+void lt_opt_process_env_append (const char *arg);
+int lt_split_name_value (const char *arg, char** name, char** value);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+
+static const char *script_text_part1 =
+EOF
+
+           func_emit_wrapper_part1 yes |
+               $SED -e 's/\([\\"]\)/\\\1/g' \
+                    -e 's/^/  "/' -e 's/$/\\n"/'
+           echo ";"
+           cat <<EOF
+
+static const char *script_text_part2 =
+EOF
+           func_emit_wrapper_part2 yes |
+               $SED -e 's/\([\\"]\)/\\\1/g' \
+                    -e 's/^/  "/' -e 's/$/\\n"/'
+           echo ";"
+
+           cat <<EOF
+const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+           if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+              func_to_host_pathlist "$temp_rpath"
+             cat <<EOF
+const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
+EOF
+           else
+             cat <<"EOF"
+const char * LIB_PATH_VALUE   = "";
+EOF
+           fi
+
+           if test -n "$dllsearchpath"; then
+              func_to_host_pathlist "$dllsearchpath:"
+             cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
+EOF
+           else
+             cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE   = "";
+EOF
+           fi
+
+           if test "$fast_install" = yes; then
+             cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+           else
+             cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+           fi
+
+
+           cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
+
+static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+
+static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
+  /* argument is putenv-style "foo=bar", value of foo is set to bar */
+
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
+  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
+
+static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
+  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int  newargc;
+  char *tmp_pathspec;
+  char *actual_cwrapper_path;
+  char *actual_cwrapper_name;
+  char *target_name;
+  char *lt_argv_zero;
+  intptr_t rval = 127;
+
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
+  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+
+  /* very simple arg parsing; don't want to rely on getopt */
+  for (i = 1; i < argc; i++)
+    {
+      if (strcmp (argv[i], dumpscript_opt) == 0)
+       {
+EOF
+           case "$host" in
+             *mingw* | *cygwin* )
+               # make stdout use "unix" line endings
+               echo "          setmode(1,_O_BINARY);"
+               ;;
+             esac
+
+           cat <<"EOF"
+         printf ("%s", script_text_part1);
+         printf ("%s", script_text_part2);
+         return 0;
+       }
+    }
+
+  newargz = XMALLOC (char *, argc + 1);
+  tmp_pathspec = find_executable (argv[0]);
+  if (tmp_pathspec == NULL)
+    lt_fatal ("Couldn't find %s", argv[0]);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
+                         tmp_pathspec));
+
+  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
+                         actual_cwrapper_path));
+  XFREE (tmp_pathspec);
+
+  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
+  strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+  /* wrapper name transforms */
+  strendzap (actual_cwrapper_name, ".exe");
+  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+  XFREE (actual_cwrapper_name);
+  actual_cwrapper_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  /* target_name transforms -- use actual target program name; might have lt- prefix */
+  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+  strendzap (target_name, ".exe");
+  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+  XFREE (target_name);
+  target_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
+                         target_name));
+EOF
+
+           cat <<EOF
+  newargz[0] =
+    XMALLOC (char, (strlen (actual_cwrapper_path) +
+                   strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+  strcpy (newargz[0], actual_cwrapper_path);
+  strcat (newargz[0], "$objdir");
+  strcat (newargz[0], "/");
+EOF
+
+           cat <<"EOF"
+  /* stop here, and copy so we don't have to do this twice */
+  tmp_pathspec = xstrdup (newargz[0]);
+
+  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+  strcat (newargz[0], actual_cwrapper_name);
+
+  /* DO want the lt- prefix here if it exists, so use target_name */
+  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+  XFREE (tmp_pathspec);
+  tmp_pathspec = NULL;
+EOF
+
+           case $host_os in
+             mingw*)
+           cat <<"EOF"
+  {
+    char* p;
+    while ((p = strchr (newargz[0], '\\')) != NULL)
+      {
+       *p = '/';
+      }
+    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+      {
+       *p = '/';
+      }
+  }
+EOF
+           ;;
+           esac
+
+           cat <<"EOF"
+  XFREE (target_name);
+  XFREE (actual_cwrapper_path);
+  XFREE (actual_cwrapper_name);
+
+  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+
+  newargc=0;
+  for (i = 1; i < argc; i++)
+    {
+      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
+        {
+          if (argv[i][env_set_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_set_opt_len + 1;
+              lt_opt_process_env_set (p);
+            }
+          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_set (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_set_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
+        {
+          if (argv[i][env_prepend_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_prepend_opt_len + 1;
+              lt_opt_process_env_prepend (p);
+            }
+          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_prepend_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
+        {
+          if (argv[i][env_append_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_append_opt_len + 1;
+              lt_opt_process_env_append (p);
+            }
+          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_append (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_append_opt);
+          continue;
+        }
+      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal ("Unrecognized option in %s namespace: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
+
+  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
+  for (i = 0; i < newargc; i++)
+    {
+      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
+    }
+
+EOF
+
+           case $host_os in
+             mingw*)
+               cat <<"EOF"
+  /* execv doesn't actually work on mingw as expected on unix */
+  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+  if (rval == -1)
+    {
+      /* failed to start process */
+      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
+      return 127;
+    }
+  return rval;
+EOF
+               ;;
+             *)
+               cat <<"EOF"
+  execv (lt_argv_zero, newargz);
+  return rval; /* =127, but avoids unused variable warning */
+EOF
+               ;;
+           esac
+
+           cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void *p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+                         string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable (const char *path)
+{
+  struct stat st;
+
+  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
+                         path ? (*path ? path : "EMPTY!") : "NULL!"));
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0)
+      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+    return 1;
+  else
+    return 0;
+}
+
+int
+make_executable (const char *path)
+{
+  int rval = 0;
+  struct stat st;
+
+  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
+                         path ? (*path ? path : "EMPTY!") : "NULL!"));
+  if ((!path) || (!*path))
+    return 0;
+
+  if (stat (path, &st) >= 0)
+    {
+      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+    }
+  return rval;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise
+   Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+  int has_slash = 0;
+  const char *p;
+  const char *p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char *concat_name;
+
+  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
+                         wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable (concat_name))
+       return concat_name;
+      XFREE (concat_name);
+    }
+  else
+    {
+#endif
+      if (IS_DIR_SEPARATOR (wrapper[0]))
+       {
+         concat_name = xstrdup (wrapper);
+         if (check_executable (concat_name))
+           return concat_name;
+         XFREE (concat_name);
+       }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+    }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+      {
+       has_slash = 1;
+       break;
+      }
+  if (!has_slash)
+    {
+      /* no slashes; search PATH */
+      const char *path = getenv ("PATH");
+      if (path != NULL)
+       {
+         for (p = path; *p; p = p_next)
+           {
+             const char *q;
+             size_t p_len;
+             for (q = p; *q; q++)
+               if (IS_PATH_SEPARATOR (*q))
+                 break;
+             p_len = q - p;
+             p_next = (*q == '\0' ? q : q + 1);
+             if (p_len == 0)
+               {
+                 /* empty path: current directory */
+                 if (getcwd (tmp, LT_PATHMAX) == NULL)
+                   lt_fatal ("getcwd failed");
+                 tmp_len = strlen (tmp);
+                 concat_name =
+                   XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+                 memcpy (concat_name, tmp, tmp_len);
+                 concat_name[tmp_len] = '/';
+                 strcpy (concat_name + tmp_len + 1, wrapper);
+               }
+             else
+               {
+                 concat_name =
+                   XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+                 memcpy (concat_name, p, p_len);
+                 concat_name[p_len] = '/';
+                 strcpy (concat_name + p_len + 1, wrapper);
+               }
+             if (check_executable (concat_name))
+               return concat_name;
+             XFREE (concat_name);
+           }
+       }
+      /* not found in PATH; assume curdir */
+    }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  tmp_len = strlen (tmp);
+  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable (concat_name))
+    return concat_name;
+  XFREE (concat_name);
+  return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+  return xstrdup (pathspec);
+#else
+  char buf[LT_PATHMAX];
+  struct stat s;
+  char *tmp_pathspec = xstrdup (pathspec);
+  char *p;
+  int has_symlinks = 0;
+  while (strlen (tmp_pathspec) && !has_symlinks)
+    {
+      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
+                             tmp_pathspec));
+      if (lstat (tmp_pathspec, &s) == 0)
+       {
+         if (S_ISLNK (s.st_mode) != 0)
+           {
+             has_symlinks = 1;
+             break;
+           }
+
+         /* search backwards for last DIR_SEPARATOR */
+         p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+         while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+           p--;
+         if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+           {
+             /* no more DIR_SEPARATORS left */
+             break;
+           }
+         *p = '\0';
+       }
+      else
+       {
+         char *errstr = strerror (errno);
+         lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
+       }
+    }
+  XFREE (tmp_pathspec);
+
+  if (!has_symlinks)
+    {
+      return xstrdup (pathspec);
+    }
+
+  tmp_pathspec = realpath (pathspec, buf);
+  if (tmp_pathspec == 0)
+    {
+      lt_fatal ("Could not follow symlinks for %s", pathspec);
+    }
+  return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert (str != NULL);
+  assert (pat != NULL);
+
+  len = strlen (str);
+  patlen = strlen (pat);
+
+  if (patlen <= len)
+    {
+      str += len - patlen;
+      if (strcmp (str, pat) == 0)
+       *str = '\0';
+    }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char *mode,
+              const char *message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    int len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      int orig_value_len = strlen (orig_value);
+      int add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+int
+lt_split_name_value (const char *arg, char** name, char** value)
+{
+  const char *p;
+  int len;
+  if (!arg || !*arg)
+    return 1;
+
+  p = strchr (arg, (int)'=');
+
+  if (!p)
+    return 1;
+
+  *value = xstrdup (++p);
+
+  len = strlen (arg) - strlen (*value);
+  *name = XMALLOC (char, len);
+  strncpy (*name, arg, len-1);
+  (*name)[len - 1] = '\0';
+
+  return 0;
+}
+
+void
+lt_opt_process_env_set (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
+    }
+
+  lt_setenv (name, value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_prepend (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 0);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_append (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 1);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      int len = strlen (new_value);
+      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[len-1] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_mode_link arg...
+func_mode_link ()
+{
+    $opt_debug
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args=$nonopt
+    base_compile="$nonopt $@"
+    compile_command=$nonopt
+    finalize_command=$nonopt
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+    new_inherited_linker_flags=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    weak_libs=
+    single_module="${wl}-single_module"
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -shared)
+       test "$build_libtool_libs" != yes && \
+         func_fatal_configuration "can not build a shared library"
+       build_old_libs=no
+       break
+       ;;
+      -all-static | -static | -static-libtool-libs)
+       case $arg in
+       -all-static)
+         if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+           func_warning "complete static linking is impossible in this configuration"
+         fi
+         if test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+         ;;
+       -static)
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=built
+         ;;
+       -static-libtool-libs)
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+         ;;
+       esac
+       build_libtool_libs=no
+       build_old_libs=yes
+       break
+       ;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      func_quote_for_eval "$arg"
+      qarg=$func_quote_for_eval_unquoted_result
+      func_append libtool_args " $func_quote_for_eval_result"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+       case $prev in
+       output)
+         func_append compile_command " @OUTPUT@"
+         func_append finalize_command " @OUTPUT@"
+         ;;
+       esac
+
+       case $prev in
+       dlfiles|dlprefiles)
+         if test "$preload" = no; then
+           # Add the symbol object into the linking commands.
+           func_append compile_command " @SYMFILE@"
+           func_append finalize_command " @SYMFILE@"
+           preload=yes
+         fi
+         case $arg in
+         *.la | *.lo) ;;  # We handle these cases below.
+         force)
+           if test "$dlself" = no; then
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         self)
+           if test "$prev" = dlprefiles; then
+             dlself=yes
+           elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+             dlself=yes
+           else
+             dlself=needless
+             export_dynamic=yes
+           fi
+           prev=
+           continue
+           ;;
+         *)
+           if test "$prev" = dlfiles; then
+             dlfiles="$dlfiles $arg"
+           else
+             dlprefiles="$dlprefiles $arg"
+           fi
+           prev=
+           continue
+           ;;
+         esac
+         ;;
+       expsyms)
+         export_symbols="$arg"
+         test -f "$arg" \
+           || func_fatal_error "symbol file \`$arg' does not exist"
+         prev=
+         continue
+         ;;
+       expsyms_regex)
+         export_symbols_regex="$arg"
+         prev=
+         continue
+         ;;
+       framework)
+         case $host in
+           *-*-darwin*)
+             case "$deplibs " in
+               *" $qarg.ltframework "*) ;;
+               *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
+                  ;;
+             esac
+             ;;
+         esac
+         prev=
+         continue
+         ;;
+       inst_prefix)
+         inst_prefix_dir="$arg"
+         prev=
+         continue
+         ;;
+       objectlist)
+         if test -f "$arg"; then
+           save_arg=$arg
+           moreargs=
+           for fil in `cat "$save_arg"`
+           do
+#            moreargs="$moreargs $fil"
+             arg=$fil
+             # A libtool-controlled object.
+
+             # Check to see that this really is a libtool object.
+             if func_lalib_unsafe_p "$arg"; then
+               pic_object=
+               non_pic_object=
+
+               # Read the .lo file
+               func_source "$arg"
+
+               if test -z "$pic_object" ||
+                  test -z "$non_pic_object" ||
+                  test "$pic_object" = none &&
+                  test "$non_pic_object" = none; then
+                 func_fatal_error "cannot find name of object for \`$arg'"
+               fi
+
+               # Extract subdirectory from the argument.
+               func_dirname "$arg" "/" ""
+               xdir="$func_dirname_result"
+
+               if test "$pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 pic_object="$xdir$pic_object"
+
+                 if test "$prev" = dlfiles; then
+                   if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+                     dlfiles="$dlfiles $pic_object"
+                     prev=
+                     continue
+                   else
+                     # If libtool objects are unsupported, then we need to preload.
+                     prev=dlprefiles
+                   fi
+                 fi
+
+                 # CHECK ME:  I think I busted this.  -Ossama
+                 if test "$prev" = dlprefiles; then
+                   # Preload the old-style object.
+                   dlprefiles="$dlprefiles $pic_object"
+                   prev=
+                 fi
+
+                 # A PIC object.
+                 func_append libobjs " $pic_object"
+                 arg="$pic_object"
+               fi
+
+               # Non-PIC object.
+               if test "$non_pic_object" != none; then
+                 # Prepend the subdirectory the object is found in.
+                 non_pic_object="$xdir$non_pic_object"
+
+                 # A standard non-PIC object
+                 func_append non_pic_objects " $non_pic_object"
+                 if test -z "$pic_object" || test "$pic_object" = none ; then
+                   arg="$non_pic_object"
+                 fi
+               else
+                 # If the PIC object exists, use it instead.
+                 # $xdir was prepended to $pic_object above.
+                 non_pic_object="$pic_object"
+                 func_append non_pic_objects " $non_pic_object"
+               fi
+             else
+               # Only an error if not doing a dry-run.
+               if $opt_dry_run; then
+                 # Extract subdirectory from the argument.
+                 func_dirname "$arg" "/" ""
+                 xdir="$func_dirname_result"
+
+                 func_lo2o "$arg"
+                 pic_object=$xdir$objdir/$func_lo2o_result
+                 non_pic_object=$xdir$func_lo2o_result
+                 func_append libobjs " $pic_object"
+                 func_append non_pic_objects " $non_pic_object"
+               else
+                 func_fatal_error "\`$arg' is not a valid libtool object"
+               fi
+             fi
+           done
+         else
+           func_fatal_error "link input file \`$arg' does not exist"
+         fi
+         arg=$save_arg
+         prev=
+         continue
+         ;;
+       precious_regex)
+         precious_files_regex="$arg"
+         prev=
+         continue
+         ;;
+       release)
+         release="-$arg"
+         prev=
+         continue
+         ;;
+       rpath | xrpath)
+         # We need an absolute path.
+         case $arg in
+         [\\/]* | [A-Za-z]:[\\/]*) ;;
+         *)
+           func_fatal_error "only absolute run-paths are allowed"
+           ;;
+         esac
+         if test "$prev" = rpath; then
+           case "$rpath " in
+           *" $arg "*) ;;
+           *) rpath="$rpath $arg" ;;
+           esac
+         else
+           case "$xrpath " in
+           *" $arg "*) ;;
+           *) xrpath="$xrpath $arg" ;;
+           esac
+         fi
+         prev=
+         continue
+         ;;
+       shrext)
+         shrext_cmds="$arg"
+         prev=
+         continue
+         ;;
+       weak)
+         weak_libs="$weak_libs $arg"
+         prev=
+         continue
+         ;;
+       xcclinker)
+         linker_flags="$linker_flags $qarg"
+         compiler_flags="$compiler_flags $qarg"
+         prev=
+         func_append compile_command " $qarg"
+         func_append finalize_command " $qarg"
+         continue
+         ;;
+       xcompiler)
+         compiler_flags="$compiler_flags $qarg"
+         prev=
+         func_append compile_command " $qarg"
+         func_append finalize_command " $qarg"
+         continue
+         ;;
+       xlinker)
+         linker_flags="$linker_flags $qarg"
+         compiler_flags="$compiler_flags $wl$qarg"
+         prev=
+         func_append compile_command " $wl$qarg"
+         func_append finalize_command " $wl$qarg"
+         continue
+         ;;
+       *)
+         eval "$prev=\"\$arg\""
+         prev=
+         continue
+         ;;
+       esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+       if test -n "$link_static_flag"; then
+         # See comment for -static flag below, for more details.
+         func_append compile_command " $link_static_flag"
+         func_append finalize_command " $link_static_flag"
+       fi
+       continue
+       ;;
+
+      -allow-undefined)
+       # FIXME: remove this flag sometime in the future.
+       func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+       ;;
+
+      -avoid-version)
+       avoid_version=yes
+       continue
+       ;;
+
+      -dlopen)
+       prev=dlfiles
+       continue
+       ;;
+
+      -dlpreopen)
+       prev=dlprefiles
+       continue
+       ;;
+
+      -export-dynamic)
+       export_dynamic=yes
+       continue
+       ;;
+
+      -export-symbols | -export-symbols-regex)
+       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+         func_fatal_error "more than one -exported-symbols argument is not allowed"
+       fi
+       if test "X$arg" = "X-export-symbols"; then
+         prev=expsyms
+       else
+         prev=expsyms_regex
+       fi
+       continue
+       ;;
+
+      -framework)
+       prev=framework
+       continue
+       ;;
+
+      -inst-prefix-dir)
+       prev=inst_prefix
+       continue
+       ;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+       case $with_gcc/$host in
+       no/*-*-irix* | /*-*-irix*)
+         func_append compile_command " $arg"
+         func_append finalize_command " $arg"
+         ;;
+       esac
+       continue
+       ;;
+
+      -L*)
+       func_stripname '-L' '' "$arg"
+       dir=$func_stripname_result
+       if test -z "$dir"; then
+         if test "$#" -gt 0; then
+           func_fatal_error "require no space between \`-L' and \`$1'"
+         else
+           func_fatal_error "need path for \`-L' option"
+         fi
+       fi
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         absdir=`cd "$dir" && pwd`
+         test -z "$absdir" && \
+           func_fatal_error "cannot determine absolute directory name of \`$dir'"
+         dir="$absdir"
+         ;;
+       esac
+       case "$deplibs " in
+       *" -L$dir "*) ;;
+       *)
+         deplibs="$deplibs -L$dir"
+         lib_search_path="$lib_search_path $dir"
+         ;;
+       esac
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+         testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$dir:"*) ;;
+         ::) dllsearchpath=$dir;;
+         *) dllsearchpath="$dllsearchpath:$dir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         ::) dllsearchpath=$testbindir;;
+         *) dllsearchpath="$dllsearchpath:$testbindir";;
+         esac
+         ;;
+       esac
+       continue
+       ;;
+
+      -l*)
+       if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
+           # These systems don't actually have a C or math library (as such)
+           continue
+           ;;
+         *-*-os2*)
+           # These systems don't actually have a C library (as such)
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+           # Do not include libc due to us having libc/libc_r.
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C and math libraries are in the System framework
+           deplibs="$deplibs System.ltframework"
+           continue
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           test "X$arg" = "X-lc" && continue
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           test "X$arg" = "X-lc" && continue
+           ;;
+         esac
+       elif test "X$arg" = "X-lc_r"; then
+        case $host in
+        *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+          # Do not include libc_r directly, use -pthread flag.
+          continue
+          ;;
+        esac
+       fi
+       deplibs="$deplibs $arg"
+       continue
+       ;;
+
+      -module)
+       module=yes
+       continue
+       ;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      # Darwin uses the -arch flag to determine output architecture.
+      -model|-arch|-isysroot)
+       compiler_flags="$compiler_flags $arg"
+       func_append compile_command " $arg"
+       func_append finalize_command " $arg"
+       prev=xcompiler
+       continue
+       ;;
+
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+       compiler_flags="$compiler_flags $arg"
+       func_append compile_command " $arg"
+       func_append finalize_command " $arg"
+       case "$new_inherited_linker_flags " in
+           *" $arg "*) ;;
+           * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
+       esac
+       continue
+       ;;
+
+      -multi_module)
+       single_module="${wl}-multi_module"
+       continue
+       ;;
+
+      -no-fast-install)
+       fast_install=no
+       continue
+       ;;
+
+      -no-install)
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+         # The PATH hackery in wrapper scripts is required on Windows
+         # and Darwin in order for the loader to find any dlls it needs.
+         func_warning "\`-no-install' is ignored for $host"
+         func_warning "assuming \`-no-fast-install' instead"
+         fast_install=no
+         ;;
+       *) no_install=yes ;;
+       esac
+       continue
+       ;;
+
+      -no-undefined)
+       allow_undefined=no
+       continue
+       ;;
+
+      -objectlist)
+       prev=objectlist
+       continue
+       ;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+       prev=precious_regex
+       continue
+       ;;
+
+      -release)
+       prev=release
+       continue
+       ;;
+
+      -rpath)
+       prev=rpath
+       continue
+       ;;
+
+      -R)
+       prev=xrpath
+       continue
+       ;;
+
+      -R*)
+       func_stripname '-R' '' "$arg"
+       dir=$func_stripname_result
+       # We need an absolute path.
+       case $dir in
+       [\\/]* | [A-Za-z]:[\\/]*) ;;
+       *)
+         func_fatal_error "only absolute run-paths are allowed"
+         ;;
+       esac
+       case "$xrpath " in
+       *" $dir "*) ;;
+       *) xrpath="$xrpath $dir" ;;
+       esac
+       continue
+       ;;
+
+      -shared)
+       # The effects of -shared are defined in a previous loop.
+       continue
+       ;;
+
+      -shrext)
+       prev=shrext
+       continue
+       ;;
+
+      -static | -static-libtool-libs)
+       # The effects of -static are defined in a previous loop.
+       # We used to do the same as -all-static on platforms that
+       # didn't have a PIC flag, but the assumption that the effects
+       # would be equivalent was wrong.  It would break on at least
+       # Digital Unix and AIX.
+       continue
+       ;;
+
+      -thread-safe)
+       thread_safe=yes
+       continue
+       ;;
+
+      -version-info)
+       prev=vinfo
+       continue
+       ;;
+
+      -version-number)
+       prev=vinfo
+       vinfo_number=yes
+       continue
+       ;;
+
+      -weak)
+        prev=weak
+       continue
+       ;;
+
+      -Wc,*)
+       func_stripname '-Wc,' '' "$arg"
+       args=$func_stripname_result
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+         arg="$arg $wl$func_quote_for_eval_result"
+         compiler_flags="$compiler_flags $func_quote_for_eval_result"
+       done
+       IFS="$save_ifs"
+       func_stripname ' ' '' "$arg"
+       arg=$func_stripname_result
+       ;;
+
+      -Wl,*)
+       func_stripname '-Wl,' '' "$arg"
+       args=$func_stripname_result
+       arg=
+       save_ifs="$IFS"; IFS=','
+       for flag in $args; do
+         IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+         arg="$arg $wl$func_quote_for_eval_result"
+         compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
+         linker_flags="$linker_flags $func_quote_for_eval_result"
+       done
+       IFS="$save_ifs"
+       func_stripname ' ' '' "$arg"
+       arg=$func_stripname_result
+       ;;
+
+      -Xcompiler)
+       prev=xcompiler
+       continue
+       ;;
+
+      -Xlinker)
+       prev=xlinker
+       continue
+       ;;
+
+      -XCClinker)
+       prev=xcclinker
+       continue
+       ;;
+
+      # -msg_* for osf cc
+      -msg_*)
+       func_quote_for_eval "$arg"
+       arg="$func_quote_for_eval_result"
+       ;;
+
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # @file GCC response files
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+        func_quote_for_eval "$arg"
+       arg="$func_quote_for_eval_result"
+        func_append compile_command " $arg"
+        func_append finalize_command " $arg"
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
+      # Some other compiler flag.
+      -* | +*)
+        func_quote_for_eval "$arg"
+       arg="$func_quote_for_eval_result"
+       ;;
+
+      *.$objext)
+       # A standard object.
+       objs="$objs $arg"
+       ;;
+
+      *.lo)
+       # A libtool-controlled object.
+
+       # Check to see that this really is a libtool object.
+       if func_lalib_unsafe_p "$arg"; then
+         pic_object=
+         non_pic_object=
+
+         # Read the .lo file
+         func_source "$arg"
+
+         if test -z "$pic_object" ||
+            test -z "$non_pic_object" ||
+            test "$pic_object" = none &&
+            test "$non_pic_object" = none; then
+           func_fatal_error "cannot find name of object for \`$arg'"
+         fi
+
+         # Extract subdirectory from the argument.
+         func_dirname "$arg" "/" ""
+         xdir="$func_dirname_result"
+
+         if test "$pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           pic_object="$xdir$pic_object"
+
+           if test "$prev" = dlfiles; then
+             if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+               dlfiles="$dlfiles $pic_object"
+               prev=
+               continue
+             else
+               # If libtool objects are unsupported, then we need to preload.
+               prev=dlprefiles
+             fi
+           fi
+
+           # CHECK ME:  I think I busted this.  -Ossama
+           if test "$prev" = dlprefiles; then
+             # Preload the old-style object.
+             dlprefiles="$dlprefiles $pic_object"
+             prev=
+           fi
+
+           # A PIC object.
+           func_append libobjs " $pic_object"
+           arg="$pic_object"
+         fi
+
+         # Non-PIC object.
+         if test "$non_pic_object" != none; then
+           # Prepend the subdirectory the object is found in.
+           non_pic_object="$xdir$non_pic_object"
+
+           # A standard non-PIC object
+           func_append non_pic_objects " $non_pic_object"
+           if test -z "$pic_object" || test "$pic_object" = none ; then
+             arg="$non_pic_object"
+           fi
+         else
+           # If the PIC object exists, use it instead.
+           # $xdir was prepended to $pic_object above.
+           non_pic_object="$pic_object"
+           func_append non_pic_objects " $non_pic_object"
+         fi
+       else
+         # Only an error if not doing a dry-run.
+         if $opt_dry_run; then
+           # Extract subdirectory from the argument.
+           func_dirname "$arg" "/" ""
+           xdir="$func_dirname_result"
+
+           func_lo2o "$arg"
+           pic_object=$xdir$objdir/$func_lo2o_result
+           non_pic_object=$xdir$func_lo2o_result
+           func_append libobjs " $pic_object"
+           func_append non_pic_objects " $non_pic_object"
+         else
+           func_fatal_error "\`$arg' is not a valid libtool object"
+         fi
+       fi
+       ;;
+
+      *.$libext)
+       # An archive.
+       deplibs="$deplibs $arg"
+       old_deplibs="$old_deplibs $arg"
+       continue
+       ;;
+
+      *.la)
+       # A libtool-controlled library.
+
+       if test "$prev" = dlfiles; then
+         # This library was specified with -dlopen.
+         dlfiles="$dlfiles $arg"
+         prev=
+       elif test "$prev" = dlprefiles; then
+         # The library was specified with -dlpreopen.
+         dlprefiles="$dlprefiles $arg"
+         prev=
+       else
+         deplibs="$deplibs $arg"
+       fi
+       continue
+       ;;
+
+      # Some other compiler argument.
+      *)
+       # Unknown arguments in both finalize_command and compile_command need
+       # to be aesthetically quoted because they are evaled later.
+       func_quote_for_eval "$arg"
+       arg="$func_quote_for_eval_result"
+       ;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+       func_append compile_command " $arg"
+       func_append finalize_command " $arg"
+      fi
+    done # argument parsing loop
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prevarg' option requires an argument"
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      func_append compile_command " $arg"
+      func_append finalize_command " $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    func_basename "$output"
+    outputname="$func_basename_result"
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    func_dirname "$output" "/" ""
+    output_objdir="$func_dirname_result$objdir"
+    # Create the object directory.
+    func_mkdir_p "$output_objdir"
+
+    # Determine the type of output
+    case $output in
+    "")
+      func_fatal_help "you must specify an output file"
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if $opt_duplicate_deps ; then
+       case "$libs " in
+       *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+       esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if $opt_duplicate_compiler_generated_deps; then
+       for pre_post_dep in $predeps $postdeps; do
+         case "$pre_post_deps " in
+         *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+         esac
+         pre_post_deps="$pre_post_deps $pre_post_dep"
+       done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+
+    case $linkmode in
+    lib)
+       passes="conv dlpreopen link"
+       for file in $dlfiles $dlprefiles; do
+         case $file in
+         *.la) ;;
+         *)
+           func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+           ;;
+         esac
+       done
+       ;;
+    prog)
+       compile_deplibs=
+       finalize_deplibs=
+       alldeplibs=no
+       newdlfiles=
+       newdlprefiles=
+       passes="conv scan dlopen dlpreopen link"
+       ;;
+    *)  passes="conv"
+       ;;
+    esac
+
+    for pass in $passes; do
+      # The preopen pass in lib mode reverses $deplibs; put it back here
+      # so that -L comes before libs that need it for instance...
+      if test "$linkmode,$pass" = "lib,link"; then
+       ## FIXME: Find the place where the list is rebuilt in the wrong
+       ##        order, and fix it there properly
+        tmp_deplibs=
+       for deplib in $deplibs; do
+         tmp_deplibs="$deplib $tmp_deplibs"
+       done
+       deplibs="$tmp_deplibs"
+      fi
+
+      if test "$linkmode,$pass" = "lib,link" ||
+        test "$linkmode,$pass" = "prog,scan"; then
+       libs="$deplibs"
+       deplibs=
+      fi
+      if test "$linkmode" = prog; then
+       case $pass in
+       dlopen) libs="$dlfiles" ;;
+       dlpreopen) libs="$dlprefiles" ;;
+       link)
+         libs="$deplibs %DEPLIBS%"
+         test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+         ;;
+       esac
+      fi
+      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+       # Collect and forward deplibs of preopened libtool libs
+       for lib in $dlprefiles; do
+         # Ignore non-libtool-libs
+         dependency_libs=
+         case $lib in
+         *.la) func_source "$lib" ;;
+         esac
+
+         # Collect preopened libtool deplibs, except any this library
+         # has declared as weak libs
+         for deplib in $dependency_libs; do
+            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
+           case " $weak_libs " in
+           *" $deplib_base "*) ;;
+           *) deplibs="$deplibs $deplib" ;;
+           esac
+         done
+       done
+       libs="$dlprefiles"
+      fi
+      if test "$pass" = dlopen; then
+       # Collect dlpreopened libraries
+       save_deplibs="$deplibs"
+       deplibs=
+      fi
+
+      for deplib in $libs; do
+       lib=
+       found=no
+       case $deplib in
+       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+         if test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           compiler_flags="$compiler_flags $deplib"
+           if test "$linkmode" = lib ; then
+               case "$new_inherited_linker_flags " in
+                   *" $deplib "*) ;;
+                   * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+               esac
+           fi
+         fi
+         continue
+         ;;
+       -l*)
+         if test "$linkmode" != lib && test "$linkmode" != prog; then
+           func_warning "\`-l' is ignored for archives/objects"
+           continue
+         fi
+         func_stripname '-l' '' "$deplib"
+         name=$func_stripname_result
+         if test "$linkmode" = lib; then
+           searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+         else
+           searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+         fi
+         for searchdir in $searchdirs; do
+           for search_ext in .la $std_shrext .so .a; do
+             # Search the libtool library
+             lib="$searchdir/lib${name}${search_ext}"
+             if test -f "$lib"; then
+               if test "$search_ext" = ".la"; then
+                 found=yes
+               else
+                 found=no
+               fi
+               break 2
+             fi
+           done
+         done
+         if test "$found" != yes; then
+           # deplib doesn't seem to be a libtool library
+           if test "$linkmode,$pass" = "prog,link"; then
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             deplibs="$deplib $deplibs"
+             test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+           fi
+           continue
+         else # deplib is a libtool library
+           # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+           # We need to do some special things here, and not later.
+           if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+             case " $predeps $postdeps " in
+             *" $deplib "*)
+               if func_lalib_p "$lib"; then
+                 library_names=
+                 old_library=
+                 func_source "$lib"
+                 for l in $old_library $library_names; do
+                   ll="$l"
+                 done
+                 if test "X$ll" = "X$old_library" ; then # only static version available
+                   found=no
+                   func_dirname "$lib" "" "."
+                   ladir="$func_dirname_result"
+                   lib=$ladir/$old_library
+                   if test "$linkmode,$pass" = "prog,link"; then
+                     compile_deplibs="$deplib $compile_deplibs"
+                     finalize_deplibs="$deplib $finalize_deplibs"
+                   else
+                     deplibs="$deplib $deplibs"
+                     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+                   fi
+                   continue
+                 fi
+               fi
+               ;;
+             *) ;;
+             esac
+           fi
+         fi
+         ;; # -l
+       *.ltframework)
+         if test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           deplibs="$deplib $deplibs"
+           if test "$linkmode" = lib ; then
+               case "$new_inherited_linker_flags " in
+                   *" $deplib "*) ;;
+                   * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+               esac
+           fi
+         fi
+         continue
+         ;;
+       -L*)
+         case $linkmode in
+         lib)
+           deplibs="$deplib $deplibs"
+           test "$pass" = conv && continue
+           newdependency_libs="$deplib $newdependency_libs"
+           func_stripname '-L' '' "$deplib"
+           newlib_search_path="$newlib_search_path $func_stripname_result"
+           ;;
+         prog)
+           if test "$pass" = conv; then
+             deplibs="$deplib $deplibs"
+             continue
+           fi
+           if test "$pass" = scan; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           func_stripname '-L' '' "$deplib"
+           newlib_search_path="$newlib_search_path $func_stripname_result"
+           ;;
+         *)
+           func_warning "\`-L' is ignored for archives/objects"
+           ;;
+         esac # linkmode
+         continue
+         ;; # -L
+       -R*)
+         if test "$pass" = link; then
+           func_stripname '-R' '' "$deplib"
+           dir=$func_stripname_result
+           # Make sure the xrpath contains only unique directories.
+           case "$xrpath " in
+           *" $dir "*) ;;
+           *) xrpath="$xrpath $dir" ;;
+           esac
+         fi
+         deplibs="$deplib $deplibs"
+         continue
+         ;;
+       *.la) lib="$deplib" ;;
+       *.$libext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+           continue
+         fi
+         case $linkmode in
+         lib)
+           # Linking convenience modules into shared libraries is allowed,
+           # but linking other static libraries is non-portable.
+           case " $dlpreconveniencelibs " in
+           *" $deplib "*) ;;
+           *)
+             valid_a_lib=no
+             case $deplibs_check_method in
+               match_pattern*)
+                 set dummy $deplibs_check_method; shift
+                 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+                 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
+                   | $EGREP "$match_pattern_regex" > /dev/null; then
+                   valid_a_lib=yes
+                 fi
+               ;;
+               pass_all)
+                 valid_a_lib=yes
+               ;;
+             esac
+             if test "$valid_a_lib" != yes; then
+               $ECHO
+               $ECHO "*** Warning: Trying to link with static lib archive $deplib."
+               $ECHO "*** I have the capability to make that library automatically link in when"
+               $ECHO "*** you link to this library.  But I can only do this if you have a"
+               $ECHO "*** shared version of the library, which you do not appear to have"
+               $ECHO "*** because the file extensions .$libext of this argument makes me believe"
+               $ECHO "*** that it is just a static archive that I should not use here."
+             else
+               $ECHO
+               $ECHO "*** Warning: Linking the shared library $output against the"
+               $ECHO "*** static library $deplib is not portable!"
+               deplibs="$deplib $deplibs"
+             fi
+             ;;
+           esac
+           continue
+           ;;
+         prog)
+           if test "$pass" != link; then
+             deplibs="$deplib $deplibs"
+           else
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           fi
+           continue
+           ;;
+         esac # linkmode
+         ;; # *.$libext
+       *.lo | *.$objext)
+         if test "$pass" = conv; then
+           deplibs="$deplib $deplibs"
+         elif test "$linkmode" = prog; then
+           if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+             # If there is no dlopen support or we're linking statically,
+             # we need to preload.
+             newdlprefiles="$newdlprefiles $deplib"
+             compile_deplibs="$deplib $compile_deplibs"
+             finalize_deplibs="$deplib $finalize_deplibs"
+           else
+             newdlfiles="$newdlfiles $deplib"
+           fi
+         fi
+         continue
+         ;;
+       %DEPLIBS%)
+         alldeplibs=yes
+         continue
+         ;;
+       esac # case $deplib
+
+       if test "$found" = yes || test -f "$lib"; then :
+       else
+         func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+       fi
+
+       # Check to see that this really is a libtool archive.
+       func_lalib_unsafe_p "$lib" \
+         || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+       func_dirname "$lib" "" "."
+       ladir="$func_dirname_result"
+
+       dlname=
+       dlopen=
+       dlpreopen=
+       libdir=
+       library_names=
+       old_library=
+       inherited_linker_flags=
+       # If the library was installed with an old release of libtool,
+       # it will not redefine variables installed, or shouldnotlink
+       installed=yes
+       shouldnotlink=no
+       avoidtemprpath=
+
+
+       # Read the .la file
+       func_source "$lib"
+
+       # Convert "-framework foo" to "foo.ltframework"
+       if test -n "$inherited_linker_flags"; then
+         tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
+         for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+           case " $new_inherited_linker_flags " in
+             *" $tmp_inherited_linker_flag "*) ;;
+             *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
+           esac
+         done
+       fi
+       dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+       if test "$linkmode,$pass" = "lib,link" ||
+          test "$linkmode,$pass" = "prog,scan" ||
+          { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+         test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+         test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+       fi
+
+       if test "$pass" = conv; then
+         # Only check for convenience libraries
+         deplibs="$lib $deplibs"
+         if test -z "$libdir"; then
+           if test -z "$old_library"; then
+             func_fatal_error "cannot find name of link library for \`$lib'"
+           fi
+           # It is a libtool convenience library, so add in its objects.
+           convenience="$convenience $ladir/$objdir/$old_library"
+           old_convenience="$old_convenience $ladir/$objdir/$old_library"
+           tmp_libs=
+           for deplib in $dependency_libs; do
+             deplibs="$deplib $deplibs"
+             if $opt_duplicate_deps ; then
+               case "$tmp_libs " in
+               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+               esac
+             fi
+             tmp_libs="$tmp_libs $deplib"
+           done
+         elif test "$linkmode" != prog && test "$linkmode" != lib; then
+           func_fatal_error "\`$lib' is not a convenience library"
+         fi
+         continue
+       fi # $pass = conv
+
+
+       # Get the name of the library we link against.
+       linklib=
+       for l in $old_library $library_names; do
+         linklib="$l"
+       done
+       if test -z "$linklib"; then
+         func_fatal_error "cannot find name of link library for \`$lib'"
+       fi
+
+       # This library was specified with -dlopen.
+       if test "$pass" = dlopen; then
+         if test -z "$libdir"; then
+           func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+         fi
+         if test -z "$dlname" ||
+            test "$dlopen_support" != yes ||
+            test "$build_libtool_libs" = no; then
+           # If there is no dlname, no dlopen support or we're linking
+           # statically, we need to preload.  We also need to preload any
+           # dependent libraries so libltdl's deplib preloader doesn't
+           # bomb out in the load deplibs phase.
+           dlprefiles="$dlprefiles $lib $dependency_libs"
+         else
+           newdlfiles="$newdlfiles $lib"
+         fi
+         continue
+       fi # $pass = dlopen
+
+       # We need an absolute path.
+       case $ladir in
+       [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+       *)
+         abs_ladir=`cd "$ladir" && pwd`
+         if test -z "$abs_ladir"; then
+           func_warning "cannot determine absolute directory name of \`$ladir'"
+           func_warning "passing it literally to the linker, although it might fail"
+           abs_ladir="$ladir"
+         fi
+         ;;
+       esac
+       func_basename "$lib"
+       laname="$func_basename_result"
+
+       # Find the relevant object directory and library name.
+       if test "X$installed" = Xyes; then
+         if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           func_warning "library \`$lib' was moved."
+           dir="$ladir"
+           absdir="$abs_ladir"
+           libdir="$abs_ladir"
+         else
+           dir="$libdir"
+           absdir="$libdir"
+         fi
+         test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+       else
+         if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+           dir="$ladir"
+           absdir="$abs_ladir"
+           # Remove this search path later
+           notinst_path="$notinst_path $abs_ladir"
+         else
+           dir="$ladir/$objdir"
+           absdir="$abs_ladir/$objdir"
+           # Remove this search path later
+           notinst_path="$notinst_path $abs_ladir"
+         fi
+       fi # $installed = yes
+       func_stripname 'lib' '.la' "$laname"
+       name=$func_stripname_result
+
+       # This library was specified with -dlpreopen.
+       if test "$pass" = dlpreopen; then
+         if test -z "$libdir" && test "$linkmode" = prog; then
+           func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+         fi
+         # Prefer using a static library (so that no silly _DYNAMIC symbols
+         # are required to link).
+         if test -n "$old_library"; then
+           newdlprefiles="$newdlprefiles $dir/$old_library"
+           # Keep a list of preopened convenience libraries to check
+           # that they are being used correctly in the link pass.
+           test -z "$libdir" && \
+               dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
+         # Otherwise, use the dlname, so that lt_dlopen finds it.
+         elif test -n "$dlname"; then
+           newdlprefiles="$newdlprefiles $dir/$dlname"
+         else
+           newdlprefiles="$newdlprefiles $dir/$linklib"
+         fi
+       fi # $pass = dlpreopen
+
+       if test -z "$libdir"; then
+         # Link the convenience library
+         if test "$linkmode" = lib; then
+           deplibs="$dir/$old_library $deplibs"
+         elif test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$dir/$old_library $compile_deplibs"
+           finalize_deplibs="$dir/$old_library $finalize_deplibs"
+         else
+           deplibs="$lib $deplibs" # used for prog,scan pass
+         fi
+         continue
+       fi
+
+
+       if test "$linkmode" = prog && test "$pass" != link; then
+         newlib_search_path="$newlib_search_path $ladir"
+         deplibs="$lib $deplibs"
+
+         linkalldeplibs=no
+         if test "$link_all_deplibs" != no || test -z "$library_names" ||
+            test "$build_libtool_libs" = no; then
+           linkalldeplibs=yes
+         fi
+
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           case $deplib in
+           -L*) func_stripname '-L' '' "$deplib"
+                newlib_search_path="$newlib_search_path $func_stripname_result"
+                ;;
+           esac
+           # Need to link against all dependency_libs?
+           if test "$linkalldeplibs" = yes; then
+             deplibs="$deplib $deplibs"
+           else
+             # Need to hardcode shared library paths
+             # or/and link against static libraries
+             newdependency_libs="$deplib $newdependency_libs"
+           fi
+           if $opt_duplicate_deps ; then
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+           fi
+           tmp_libs="$tmp_libs $deplib"
+         done # for deplib
+         continue
+       fi # $linkmode = prog...
+
+       if test "$linkmode,$pass" = "prog,link"; then
+         if test -n "$library_names" &&
+            { { test "$prefer_static_libs" = no ||
+                test "$prefer_static_libs,$installed" = "built,yes"; } ||
+              test -z "$old_library"; }; then
+           # We need to hardcode the library path
+           if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+             # Make sure the rpath contains only unique directories.
+             case "$temp_rpath:" in
+             *"$absdir:"*) ;;
+             *) temp_rpath="$temp_rpath$absdir:" ;;
+             esac
+           fi
+
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) compile_rpath="$compile_rpath $absdir"
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) finalize_rpath="$finalize_rpath $libdir"
+             esac
+             ;;
+           esac
+         fi # $linkmode,$pass = prog,link...
+
+         if test "$alldeplibs" = yes &&
+            { test "$deplibs_check_method" = pass_all ||
+              { test "$build_libtool_libs" = yes &&
+                test -n "$library_names"; }; }; then
+           # We only need to search for static libraries
+           continue
+         fi
+       fi
+
+       link_static=no # Whether the deplib will be linked statically
+       use_static_libs=$prefer_static_libs
+       if test "$use_static_libs" = built && test "$installed" = yes; then
+         use_static_libs=no
+       fi
+       if test -n "$library_names" &&
+          { test "$use_static_libs" = no || test -z "$old_library"; }; then
+         case $host in
+         *cygwin* | *mingw* | *cegcc*)
+             # No point in relinking DLLs because paths are not encoded
+             notinst_deplibs="$notinst_deplibs $lib"
+             need_relink=no
+           ;;
+         *)
+           if test "$installed" = no; then
+             notinst_deplibs="$notinst_deplibs $lib"
+             need_relink=yes
+           fi
+           ;;
+         esac
+         # This is a shared library
+
+         # Warn about portability, can't link against -module's on some
+         # systems (darwin).  Don't bleat about dlopened modules though!
+         dlopenmodule=""
+         for dlpremoduletest in $dlprefiles; do
+           if test "X$dlpremoduletest" = "X$lib"; then
+             dlopenmodule="$dlpremoduletest"
+             break
+           fi
+         done
+         if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+           $ECHO
+           if test "$linkmode" = prog; then
+             $ECHO "*** Warning: Linking the executable $output against the loadable module"
+           else
+             $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+           fi
+           $ECHO "*** $linklib is not portable!"
+         fi
+         if test "$linkmode" = lib &&
+            test "$hardcode_into_libs" = yes; then
+           # Hardcode the library path.
+           # Skip directories that are in the system default run-time
+           # search path.
+           case " $sys_lib_dlsearch_path " in
+           *" $absdir "*) ;;
+           *)
+             case "$compile_rpath " in
+             *" $absdir "*) ;;
+             *) compile_rpath="$compile_rpath $absdir"
+             esac
+             ;;
+           esac
+           case " $sys_lib_dlsearch_path " in
+           *" $libdir "*) ;;
+           *)
+             case "$finalize_rpath " in
+             *" $libdir "*) ;;
+             *) finalize_rpath="$finalize_rpath $libdir"
+             esac
+             ;;
+           esac
+         fi
+
+         if test -n "$old_archive_from_expsyms_cmds"; then
+           # figure out the soname
+           set dummy $library_names
+           shift
+           realname="$1"
+           shift
+           libname=`eval "\\$ECHO \"$libname_spec\""`
+           # use dlname if we got it. it's perfectly good, no?
+           if test -n "$dlname"; then
+             soname="$dlname"
+           elif test -n "$soname_spec"; then
+             # bleh windows
+             case $host in
+             *cygwin* | mingw* | *cegcc*)
+               func_arith $current - $age
+               major=$func_arith_result
+               versuffix="-$major"
+               ;;
+             esac
+             eval soname=\"$soname_spec\"
+           else
+             soname="$realname"
+           fi
+
+           # Make a new name for the extract_expsyms_cmds to use
+           soroot="$soname"
+           func_basename "$soroot"
+           soname="$func_basename_result"
+           func_stripname 'lib' '.dll' "$soname"
+           newlib=libimp-$func_stripname_result.a
+
+           # If the library has no export list, then create one now
+           if test -f "$output_objdir/$soname-def"; then :
+           else
+             func_verbose "extracting exported symbol list from \`$soname'"
+             func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+           fi
+
+           # Create $newlib
+           if test -f "$output_objdir/$newlib"; then :; else
+             func_verbose "generating import library for \`$soname'"
+             func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+           fi
+           # make sure the library variables are pointing to the new library
+           dir=$output_objdir
+           linklib=$newlib
+         fi # test -n "$old_archive_from_expsyms_cmds"
+
+         if test "$linkmode" = prog || test "$mode" != relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           lib_linked=yes
+           case $hardcode_action in
+           immediate | unsupported)
+             if test "$hardcode_direct" = no; then
+               add="$dir/$linklib"
+               case $host in
+                 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+                 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+                 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+                   *-*-unixware7*) add_dir="-L$dir" ;;
+                 *-*-darwin* )
+                   # if the lib is a (non-dlopened) module then we can not
+                   # link against it, someone is ignoring the earlier warnings
+                   if /usr/bin/file -L $add 2> /dev/null |
+                        $GREP ": [^:]* bundle" >/dev/null ; then
+                     if test "X$dlopenmodule" != "X$lib"; then
+                       $ECHO "*** Warning: lib $linklib is a module, not a shared library"
+                       if test -z "$old_library" ; then
+                         $ECHO
+                         $ECHO "*** And there doesn't seem to be a static archive available"
+                         $ECHO "*** The link will probably fail, sorry"
+                       else
+                         add="$dir/$old_library"
+                       fi
+                     elif test -n "$old_library"; then
+                       add="$dir/$old_library"
+                     fi
+                   fi
+               esac
+             elif test "$hardcode_minus_L" = no; then
+               case $host in
+               *-*-sunos*) add_shlibpath="$dir" ;;
+               esac
+               add_dir="-L$dir"
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = no; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           relink)
+             if test "$hardcode_direct" = yes &&
+                test "$hardcode_direct_absolute" = no; then
+               add="$dir/$linklib"
+             elif test "$hardcode_minus_L" = yes; then
+               add_dir="-L$dir"
+               # Try looking first in the location we're being installed to.
+               if test -n "$inst_prefix_dir"; then
+                 case $libdir in
+                   [\\/]*)
+                     add_dir="$add_dir -L$inst_prefix_dir$libdir"
+                     ;;
+                 esac
+               fi
+               add="-l$name"
+             elif test "$hardcode_shlibpath_var" = yes; then
+               add_shlibpath="$dir"
+               add="-l$name"
+             else
+               lib_linked=no
+             fi
+             ;;
+           *) lib_linked=no ;;
+           esac
+
+           if test "$lib_linked" != yes; then
+             func_fatal_configuration "unsupported hardcode properties"
+           fi
+
+           if test -n "$add_shlibpath"; then
+             case :$compile_shlibpath: in
+             *":$add_shlibpath:"*) ;;
+             *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+             esac
+           fi
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+             test -n "$add" && compile_deplibs="$add $compile_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+             if test "$hardcode_direct" != yes &&
+                test "$hardcode_minus_L" != yes &&
+                test "$hardcode_shlibpath_var" = yes; then
+               case :$finalize_shlibpath: in
+               *":$libdir:"*) ;;
+               *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+               esac
+             fi
+           fi
+         fi
+
+         if test "$linkmode" = prog || test "$mode" = relink; then
+           add_shlibpath=
+           add_dir=
+           add=
+           # Finalize command for both is simple: just hardcode it.
+           if test "$hardcode_direct" = yes &&
+              test "$hardcode_direct_absolute" = no; then
+             add="$libdir/$linklib"
+           elif test "$hardcode_minus_L" = yes; then
+             add_dir="-L$libdir"
+             add="-l$name"
+           elif test "$hardcode_shlibpath_var" = yes; then
+             case :$finalize_shlibpath: in
+             *":$libdir:"*) ;;
+             *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+             esac
+             add="-l$name"
+           elif test "$hardcode_automatic" = yes; then
+             if test -n "$inst_prefix_dir" &&
+                test -f "$inst_prefix_dir$libdir/$linklib" ; then
+               add="$inst_prefix_dir$libdir/$linklib"
+             else
+               add="$libdir/$linklib"
+             fi
+           else
+             # We cannot seem to hardcode it, guess we'll fake it.
+             add_dir="-L$libdir"
+             # Try looking first in the location we're being installed to.
+             if test -n "$inst_prefix_dir"; then
+               case $libdir in
+                 [\\/]*)
+                   add_dir="$add_dir -L$inst_prefix_dir$libdir"
+                   ;;
+               esac
+             fi
+             add="-l$name"
+           fi
+
+           if test "$linkmode" = prog; then
+             test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+             test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+           else
+             test -n "$add_dir" && deplibs="$add_dir $deplibs"
+             test -n "$add" && deplibs="$add $deplibs"
+           fi
+         fi
+       elif test "$linkmode" = prog; then
+         # Here we assume that one of hardcode_direct or hardcode_minus_L
+         # is not unsupported.  This is valid on all known static and
+         # shared platforms.
+         if test "$hardcode_direct" != unsupported; then
+           test -n "$old_library" && linklib="$old_library"
+           compile_deplibs="$dir/$linklib $compile_deplibs"
+           finalize_deplibs="$dir/$linklib $finalize_deplibs"
+         else
+           compile_deplibs="-l$name -L$dir $compile_deplibs"
+           finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+         fi
+       elif test "$build_libtool_libs" = yes; then
+         # Not a shared library
+         if test "$deplibs_check_method" != pass_all; then
+           # We're trying link a shared library against a static one
+           # but the system doesn't support it.
+
+           # Just print a warning and add the library to dependency_libs so
+           # that the program can be linked against the static library.
+           $ECHO
+           $ECHO "*** Warning: This system can not link to static lib archive $lib."
+           $ECHO "*** I have the capability to make that library automatically link in when"
+           $ECHO "*** you link to this library.  But I can only do this if you have a"
+           $ECHO "*** shared version of the library, which you do not appear to have."
+           if test "$module" = yes; then
+             $ECHO "*** But as you try to build a module library, libtool will still create "
+             $ECHO "*** a static module, that should work as long as the dlopening application"
+             $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
+             if test -z "$global_symbol_pipe"; then
+               $ECHO
+               $ECHO "*** However, this would only work if libtool was able to extract symbol"
+               $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+               $ECHO "*** not find such a program.  So, this module is probably useless."
+               $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+             fi
+             if test "$build_old_libs" = no; then
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         else
+           deplibs="$dir/$old_library $deplibs"
+           link_static=yes
+         fi
+       fi # link shared/static library?
+
+       if test "$linkmode" = lib; then
+         if test -n "$dependency_libs" &&
+            { test "$hardcode_into_libs" != yes ||
+              test "$build_old_libs" = yes ||
+              test "$link_static" = yes; }; then
+           # Extract -R from dependency_libs
+           temp_deplibs=
+           for libdir in $dependency_libs; do
+             case $libdir in
+             -R*) func_stripname '-R' '' "$libdir"
+                  temp_xrpath=$func_stripname_result
+                  case " $xrpath " in
+                  *" $temp_xrpath "*) ;;
+                  *) xrpath="$xrpath $temp_xrpath";;
+                  esac;;
+             *) temp_deplibs="$temp_deplibs $libdir";;
+             esac
+           done
+           dependency_libs="$temp_deplibs"
+         fi
+
+         newlib_search_path="$newlib_search_path $absdir"
+         # Link against this library
+         test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+         # ... and its dependency_libs
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           newdependency_libs="$deplib $newdependency_libs"
+           if $opt_duplicate_deps ; then
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+           fi
+           tmp_libs="$tmp_libs $deplib"
+         done
+
+         if test "$link_all_deplibs" != no; then
+           # Add the search paths of all dependency libraries
+           for deplib in $dependency_libs; do
+             path=
+             case $deplib in
+             -L*) path="$deplib" ;;
+             *.la)
+               func_dirname "$deplib" "" "."
+               dir="$func_dirname_result"
+               # We need an absolute path.
+               case $dir in
+               [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+               *)
+                 absdir=`cd "$dir" && pwd`
+                 if test -z "$absdir"; then
+                   func_warning "cannot determine absolute directory name of \`$dir'"
+                   absdir="$dir"
+                 fi
+                 ;;
+               esac
+               if $GREP "^installed=no" $deplib > /dev/null; then
+               case $host in
+               *-*-darwin*)
+                 depdepl=
+                 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+                 if test -n "$deplibrary_names" ; then
+                   for tmp in $deplibrary_names ; do
+                     depdepl=$tmp
+                   done
+                   if test -f "$absdir/$objdir/$depdepl" ; then
+                     depdepl="$absdir/$objdir/$depdepl"
+                     darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+                      if test -z "$darwin_install_name"; then
+                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                      fi
+                     compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+                     linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
+                     path=
+                   fi
+                 fi
+                 ;;
+               *)
+                 path="-L$absdir/$objdir"
+                 ;;
+               esac
+               else
+                 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+                 test -z "$libdir" && \
+                   func_fatal_error "\`$deplib' is not a valid libtool archive"
+                 test "$absdir" != "$libdir" && \
+                   func_warning "\`$deplib' seems to be moved"
+
+                 path="-L$absdir"
+               fi
+               ;;
+             esac
+             case " $deplibs " in
+             *" $path "*) ;;
+             *) deplibs="$path $deplibs" ;;
+             esac
+           done
+         fi # link_all_deplibs != no
+       fi # linkmode = lib
+      done # for deplib in $libs
+      if test "$pass" = link; then
+       if test "$linkmode" = "prog"; then
+         compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+         finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+       else
+         compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+       fi
+      fi
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+       # Link the dlpreopened libraries before other libraries
+       for deplib in $save_deplibs; do
+         deplibs="$deplib $deplibs"
+       done
+      fi
+      if test "$pass" != dlopen; then
+       if test "$pass" != conv; then
+         # Make sure lib_search_path contains only unique directories.
+         lib_search_path=
+         for dir in $newlib_search_path; do
+           case "$lib_search_path " in
+           *" $dir "*) ;;
+           *) lib_search_path="$lib_search_path $dir" ;;
+           esac
+         done
+         newlib_search_path=
+       fi
+
+       if test "$linkmode,$pass" != "prog,link"; then
+         vars="deplibs"
+       else
+         vars="compile_deplibs finalize_deplibs"
+       fi
+       for var in $vars dependency_libs; do
+         # Add libraries to $var in reverse order
+         eval tmp_libs=\"\$$var\"
+         new_libs=
+         for deplib in $tmp_libs; do
+           # FIXME: Pedantically, this is the right thing to do, so
+           #        that some nasty dependency loop isn't accidentally
+           #        broken:
+           #new_libs="$deplib $new_libs"
+           # Pragmatically, this seems to cause very few problems in
+           # practice:
+           case $deplib in
+           -L*) new_libs="$deplib $new_libs" ;;
+           -R*) ;;
+           *)
+             # And here is the reason: when a library appears more
+             # than once as an explicit dependence of a library, or
+             # is implicitly linked in more than once by the
+             # compiler, it is considered special, and multiple
+             # occurrences thereof are not removed.  Compare this
+             # with having the same library being listed as a
+             # dependency of multiple other libraries: in this case,
+             # we know (pedantically, we assume) the library does not
+             # need to be listed more than once, so we keep only the
+             # last copy.  This is not always right, but it is rare
+             # enough that we require users that really mean to play
+             # such unportable linking tricks to link the library
+             # using -Wl,-lname, so that libtool does not consider it
+             # for duplicate removal.
+             case " $specialdeplibs " in
+             *" $deplib "*) new_libs="$deplib $new_libs" ;;
+             *)
+               case " $new_libs " in
+               *" $deplib "*) ;;
+               *) new_libs="$deplib $new_libs" ;;
+               esac
+               ;;
+             esac
+             ;;
+           esac
+         done
+         tmp_libs=
+         for deplib in $new_libs; do
+           case $deplib in
+           -L*)
+             case " $tmp_libs " in
+             *" $deplib "*) ;;
+             *) tmp_libs="$tmp_libs $deplib" ;;
+             esac
+             ;;
+           *) tmp_libs="$tmp_libs $deplib" ;;
+           esac
+         done
+         eval $var=\"$tmp_libs\"
+       done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+       case " $predeps $postdeps $compiler_lib_search_path " in
+       *" $i "*)
+         i=""
+         ;;
+       esac
+       if test -n "$i" ; then
+         tmp_libs="$tmp_libs $i"
+       fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+    fi
+    if test "$linkmode" = prog || test "$linkmode" = lib; then
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       func_warning "\`-dlopen' is ignored for archives"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+       func_warning "\`-l' and \`-L' are ignored for archives" ;;
+      esac
+
+      test -n "$rpath" && \
+       func_warning "\`-rpath' is ignored for archives"
+
+      test -n "$xrpath" && \
+       func_warning "\`-R' is ignored for archives"
+
+      test -n "$vinfo" && \
+       func_warning "\`-version-info/-version-number' is ignored for archives"
+
+      test -n "$release" && \
+       func_warning "\`-release' is ignored for archives"
+
+      test -n "$export_symbols$export_symbols_regex" && \
+       func_warning "\`-export-symbols' is ignored for archives"
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+       func_stripname 'lib' '.la' "$outputname"
+       name=$func_stripname_result
+       eval shared_ext=\"$shrext_cmds\"
+       eval libname=\"$libname_spec\"
+       ;;
+      *)
+       test "$module" = no && \
+         func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+       if test "$need_lib_prefix" != no; then
+         # Add the "lib" prefix for modules if required
+         func_stripname '' '.la' "$outputname"
+         name=$func_stripname_result
+         eval shared_ext=\"$shrext_cmds\"
+         eval libname=\"$libname_spec\"
+       else
+         func_stripname '' '.la' "$outputname"
+         libname=$func_stripname_result
+       fi
+       ;;
+      esac
+
+      if test -n "$objs"; then
+       if test "$deplibs_check_method" != pass_all; then
+         func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+       else
+         $ECHO
+         $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+         $ECHO "*** objects $objs is not portable!"
+         libobjs="$libobjs $objs"
+       fi
+      fi
+
+      test "$dlself" != no && \
+       func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+      set dummy $rpath
+      shift
+      test "$#" -gt 1 && \
+       func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+      install_libdir="$1"
+
+      oldlibs=
+      if test -z "$rpath"; then
+       if test "$build_libtool_libs" = yes; then
+         # Building a libtool convenience library.
+         # Some compilers have problems with a `.al' extension so
+         # convenience libraries should have the same extension an
+         # archive normally would.
+         oldlibs="$output_objdir/$libname.$libext $oldlibs"
+         build_libtool_libs=convenience
+         build_old_libs=yes
+       fi
+
+       test -n "$vinfo" && \
+         func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+       test -n "$release" && \
+         func_warning "\`-release' is ignored for convenience libraries"
+      else
+
+       # Parse the version information argument.
+       save_ifs="$IFS"; IFS=':'
+       set dummy $vinfo 0 0 0
+       shift
+       IFS="$save_ifs"
+
+       test -n "$7" && \
+         func_fatal_help "too many parameters to \`-version-info'"
+
+       # convert absolute version numbers to libtool ages
+       # this retains compatibility with .la files and attempts
+       # to make the code below a bit more comprehensible
+
+       case $vinfo_number in
+       yes)
+         number_major="$1"
+         number_minor="$2"
+         number_revision="$3"
+         #
+         # There are really only two kinds -- those that
+         # use the current revision as the major version
+         # and those that subtract age and use age as
+         # a minor version.  But, then there is irix
+         # which has an extra 1 added just for fun
+         #
+         case $version_type in
+         darwin|linux|osf|windows|none)
+           func_arith $number_major + $number_minor
+           current=$func_arith_result
+           age="$number_minor"
+           revision="$number_revision"
+           ;;
+         freebsd-aout|freebsd-elf|sunos)
+           current="$number_major"
+           revision="$number_minor"
+           age="0"
+           ;;
+         irix|nonstopux)
+           func_arith $number_major + $number_minor
+           current=$func_arith_result
+           age="$number_minor"
+           revision="$number_minor"
+           lt_irix_increment=no
+           ;;
+         *)
+           func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+           ;;
+         esac
+         ;;
+       no)
+         current="$1"
+         revision="$2"
+         age="$3"
+         ;;
+       esac
+
+       # Check that each of the things are valid numbers.
+       case $current in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         func_error "CURRENT \`$current' must be a nonnegative integer"
+         func_fatal_error "\`$vinfo' is not valid version information"
+         ;;
+       esac
+
+       case $revision in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         func_error "REVISION \`$revision' must be a nonnegative integer"
+         func_fatal_error "\`$vinfo' is not valid version information"
+         ;;
+       esac
+
+       case $age in
+       0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+       *)
+         func_error "AGE \`$age' must be a nonnegative integer"
+         func_fatal_error "\`$vinfo' is not valid version information"
+         ;;
+       esac
+
+       if test "$age" -gt "$current"; then
+         func_error "AGE \`$age' is greater than the current interface number \`$current'"
+         func_fatal_error "\`$vinfo' is not valid version information"
+       fi
+
+       # Calculate the version variables.
+       major=
+       versuffix=
+       verstring=
+       case $version_type in
+       none) ;;
+
+       darwin)
+         # Like Linux, but with the current version available in
+         # verstring for coding it into the library header
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix="$major.$age.$revision"
+         # Darwin ld doesn't like 0 for these options...
+         func_arith $current + 1
+         minor_current=$func_arith_result
+         xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+         verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+         ;;
+
+       freebsd-aout)
+         major=".$current"
+         versuffix=".$current.$revision";
+         ;;
+
+       freebsd-elf)
+         major=".$current"
+         versuffix=".$current"
+         ;;
+
+       irix | nonstopux)
+         if test "X$lt_irix_increment" = "Xno"; then
+           func_arith $current - $age
+         else
+           func_arith $current - $age + 1
+         fi
+         major=$func_arith_result
+
+         case $version_type in
+           nonstopux) verstring_prefix=nonstopux ;;
+           *)         verstring_prefix=sgi ;;
+         esac
+         verstring="$verstring_prefix$major.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$revision
+         while test "$loop" -ne 0; do
+           func_arith $revision - $loop
+           iface=$func_arith_result
+           func_arith $loop - 1
+           loop=$func_arith_result
+           verstring="$verstring_prefix$major.$iface:$verstring"
+         done
+
+         # Before this point, $major must not contain `.'.
+         major=.$major
+         versuffix="$major.$revision"
+         ;;
+
+       linux)
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix="$major.$age.$revision"
+         ;;
+
+       osf)
+         func_arith $current - $age
+         major=.$func_arith_result
+         versuffix=".$current.$age.$revision"
+         verstring="$current.$age.$revision"
+
+         # Add in all the interfaces that we are compatible with.
+         loop=$age
+         while test "$loop" -ne 0; do
+           func_arith $current - $loop
+           iface=$func_arith_result
+           func_arith $loop - 1
+           loop=$func_arith_result
+           verstring="$verstring:${iface}.0"
+         done
+
+         # Make executables depend on our current version.
+         verstring="$verstring:${current}.0"
+         ;;
+
+       qnx)
+         major=".$current"
+         versuffix=".$current"
+         ;;
+
+       sunos)
+         major=".$current"
+         versuffix=".$current.$revision"
+         ;;
+
+       windows)
+         # Use '-' rather than '.', since we only want one
+         # extension on DOS 8.3 filesystems.
+         func_arith $current - $age
+         major=$func_arith_result
+         versuffix="-$major"
+         ;;
+
+       *)
+         func_fatal_configuration "unknown library version type \`$version_type'"
+         ;;
+       esac
+
+       # Clear the version info if we defaulted, and they specified a release.
+       if test -z "$vinfo" && test -n "$release"; then
+         major=
+         case $version_type in
+         darwin)
+           # we can't check for "0.0" in archive_cmds due to quoting
+           # problems, so we reset it completely
+           verstring=
+           ;;
+         *)
+           verstring="0.0"
+           ;;
+         esac
+         if test "$need_version" = no; then
+           versuffix=
+         else
+           versuffix=".0.0"
+         fi
+       fi
+
+       # Remove version info from name if versioning should be avoided
+       if test "$avoid_version" = yes && test "$need_version" = no; then
+         major=
+         versuffix=
+         verstring=""
+       fi
+
+       # Check to see if the archive will have undefined symbols.
+       if test "$allow_undefined" = yes; then
+         if test "$allow_undefined_flag" = unsupported; then
+           func_warning "undefined symbols not allowed in $host shared libraries"
+           build_libtool_libs=no
+           build_old_libs=yes
+         fi
+       else
+         # Don't allow undefined symbols.
+         allow_undefined_flag="$no_undefined_flag"
+       fi
+
+      fi
+
+      func_generate_dlsyms "$libname" "$libname" "yes"
+      libobjs="$libobjs $symfileobj"
+      test "X$libobjs" = "X " && libobjs=
+
+      if test "$mode" != relink; then
+       # Remove our outputs, but don't remove object files since they
+       # may have been created when compiling PIC objects.
+       removelist=
+       tempremovelist=`$ECHO "$output_objdir/*"`
+       for p in $tempremovelist; do
+         case $p in
+           *.$objext | *.gcno)
+              ;;
+           $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+              if test "X$precious_files_regex" != "X"; then
+                if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+                then
+                  continue
+                fi
+              fi
+              removelist="$removelist $p"
+              ;;
+           *) ;;
+         esac
+       done
+       test -n "$removelist" && \
+         func_show_eval "${RM}r \$removelist"
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+       oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+       # Transform .lo files to .o files.
+       oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #        lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
+      #        deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
+      #        dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       temp_xrpath=
+       for libdir in $xrpath; do
+         temp_xrpath="$temp_xrpath -R$libdir"
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_rpath="$finalize_rpath $libdir" ;;
+         esac
+       done
+       if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+         dependency_libs="$temp_xrpath $dependency_libs"
+       fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+       case " $dlprefiles $dlfiles " in
+       *" $lib "*) ;;
+       *) dlfiles="$dlfiles $lib" ;;
+       esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+       case "$dlprefiles " in
+       *" $lib "*) ;;
+       *) dlprefiles="$dlprefiles $lib" ;;
+       esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+       if test -n "$rpath"; then
+         case $host in
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
+           # these systems don't actually have a c library (as such)!
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C library is in the System framework
+           deplibs="$deplibs System.ltframework"
+           ;;
+         *-*-netbsd*)
+           # Don't link with libc until the a.out ld.so is fixed.
+           ;;
+         *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+           # Do not include libc due to us having libc/libc_r.
+           ;;
+         *-*-sco3.2v5* | *-*-sco5v6*)
+           # Causes problems with __ctype
+           ;;
+         *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+           # Compiler inserts libc in the correct place for threads to work
+           ;;
+         *)
+           # Add libc to deplibs on all other systems if necessary.
+           if test "$build_libtool_need_lc" = "yes"; then
+             deplibs="$deplibs -lc"
+           fi
+           ;;
+         esac
+       fi
+
+       # Transform deplibs into only deplibs that can be linked in shared.
+       name_save=$name
+       libname_save=$libname
+       release_save=$release
+       versuffix_save=$versuffix
+       major_save=$major
+       # I'm not sure if I'm treating the release correctly.  I think
+       # release should show up in the -l (ie -lgmp5) so we don't want to
+       # add it in twice.  Is that correct?
+       release=""
+       versuffix=""
+       major=""
+       newdeplibs=
+       droppeddeps=no
+       case $deplibs_check_method in
+       pass_all)
+         # Don't check for shared/static.  Everything works.
+         # This might be a little naive.  We might want to check
+         # whether the library exists or not.  But this is on
+         # osf3 & osf4 and I'm not really sure... Just
+         # implementing what was already the behavior.
+         newdeplibs=$deplibs
+         ;;
+       test_compile)
+         # This code stresses the "libraries are programs" paradigm to its
+         # limits. Maybe even breaks it.  We compile a program, linking it
+         # against the deplibs as a proxy for the library.  Then we can check
+         # whether they linked in statically or dynamically with ldd.
+         $opt_dry_run || $RM conftest.c
+         cat > conftest.c <<EOF
+         int main() { return 0; }
+EOF
+         $opt_dry_run || $RM conftest
+         if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+           ldd_output=`ldd conftest`
+           for i in $deplibs; do
+             case $i in
+             -l*)
+               func_stripname -l '' "$i"
+               name=$func_stripname_result
+               if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                 case " $predeps $postdeps " in
+                 *" $i "*)
+                   newdeplibs="$newdeplibs $i"
+                   i=""
+                   ;;
+                 esac
+               fi
+               if test -n "$i" ; then
+                 libname=`eval "\\$ECHO \"$libname_spec\""`
+                 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+                 set dummy $deplib_matches; shift
+                 deplib_match=$1
+                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                   newdeplibs="$newdeplibs $i"
+                 else
+                   droppeddeps=yes
+                   $ECHO
+                   $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+                   $ECHO "*** I have the capability to make that library automatically link in when"
+                   $ECHO "*** you link to this library.  But I can only do this if you have a"
+                   $ECHO "*** shared version of the library, which I believe you do not have"
+                   $ECHO "*** because a test_compile did reveal that the linker did not use it for"
+                   $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
+                 fi
+               fi
+               ;;
+             *)
+               newdeplibs="$newdeplibs $i"
+               ;;
+             esac
+           done
+         else
+           # Error occurred in the first compile.  Let's try to salvage
+           # the situation: Compile a separate program for each library.
+           for i in $deplibs; do
+             case $i in
+             -l*)
+               func_stripname -l '' "$i"
+               name=$func_stripname_result
+               $opt_dry_run || $RM conftest
+               if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+                 ldd_output=`ldd conftest`
+                 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+                   case " $predeps $postdeps " in
+                   *" $i "*)
+                     newdeplibs="$newdeplibs $i"
+                     i=""
+                     ;;
+                   esac
+                 fi
+                 if test -n "$i" ; then
+                   libname=`eval "\\$ECHO \"$libname_spec\""`
+                   deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+                   set dummy $deplib_matches; shift
+                   deplib_match=$1
+                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                     newdeplibs="$newdeplibs $i"
+                   else
+                     droppeddeps=yes
+                     $ECHO
+                     $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+                     $ECHO "*** I have the capability to make that library automatically link in when"
+                     $ECHO "*** you link to this library.  But I can only do this if you have a"
+                     $ECHO "*** shared version of the library, which you do not appear to have"
+                     $ECHO "*** because a test_compile did reveal that the linker did not use this one"
+                     $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
+                   fi
+                 fi
+               else
+                 droppeddeps=yes
+                 $ECHO
+                 $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
+                 $ECHO "*** make it link in!  You will probably need to install it or some"
+                 $ECHO "*** library that it depends on before this library will be fully"
+                 $ECHO "*** functional.  Installing it before continuing would be even better."
+               fi
+               ;;
+             *)
+               newdeplibs="$newdeplibs $i"
+               ;;
+             esac
+           done
+         fi
+         ;;
+       file_magic*)
+         set dummy $deplibs_check_method; shift
+         file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+         for a_deplib in $deplibs; do
+           case $a_deplib in
+           -l*)
+             func_stripname -l '' "$a_deplib"
+             name=$func_stripname_result
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval "\\$ECHO \"$libname_spec\""`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                     # Follow soft links.
+                     if ls -lLd "$potent_lib" 2>/dev/null |
+                        $GREP " -> " >/dev/null; then
+                       continue
+                     fi
+                     # The statement above tries to avoid entering an
+                     # endless loop below, in case of cyclic links.
+                     # We might still enter an endless loop, since a link
+                     # loop can be closed while we follow links,
+                     # but so what?
+                     potlib="$potent_lib"
+                     while test -h "$potlib" 2>/dev/null; do
+                       potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+                       case $potliblink in
+                       [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+                       *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+                       esac
+                     done
+                     if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+                        $SED -e 10q |
+                        $EGREP "$file_magic_regex" > /dev/null; then
+                       newdeplibs="$newdeplibs $a_deplib"
+                       a_deplib=""
+                       break 2
+                     fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               $ECHO
+               $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+               $ECHO "*** I have the capability to make that library automatically link in when"
+               $ECHO "*** you link to this library.  But I can only do this if you have a"
+               $ECHO "*** shared version of the library, which you do not appear to have"
+               $ECHO "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+               else
+                 $ECHO "*** with $libname and none of the candidates passed a file format test"
+                 $ECHO "*** using a file magic. Last file checked: $potlib"
+               fi
+             fi
+             ;;
+           *)
+             # Add a -L argument.
+             newdeplibs="$newdeplibs $a_deplib"
+             ;;
+           esac
+         done # Gone through all deplibs.
+         ;;
+       match_pattern*)
+         set dummy $deplibs_check_method; shift
+         match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+         for a_deplib in $deplibs; do
+           case $a_deplib in
+           -l*)
+             func_stripname -l '' "$a_deplib"
+             name=$func_stripname_result
+             if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+               case " $predeps $postdeps " in
+               *" $a_deplib "*)
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval "\\$ECHO \"$libname_spec\""`
+               for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                   potlib="$potent_lib" # see symlink-check above in file_magic test
+                   if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
+                      $EGREP "$match_pattern_regex" > /dev/null; then
+                     newdeplibs="$newdeplibs $a_deplib"
+                     a_deplib=""
+                     break 2
+                   fi
+                 done
+               done
+             fi
+             if test -n "$a_deplib" ; then
+               droppeddeps=yes
+               $ECHO
+               $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+               $ECHO "*** I have the capability to make that library automatically link in when"
+               $ECHO "*** you link to this library.  But I can only do this if you have a"
+               $ECHO "*** shared version of the library, which you do not appear to have"
+               $ECHO "*** because I did check the linker path looking for a file starting"
+               if test -z "$potlib" ; then
+                 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+               else
+                 $ECHO "*** with $libname and none of the candidates passed a file format test"
+                 $ECHO "*** using a regex pattern. Last file checked: $potlib"
+               fi
+             fi
+             ;;
+           *)
+             # Add a -L argument.
+             newdeplibs="$newdeplibs $a_deplib"
+             ;;
+           esac
+         done # Gone through all deplibs.
+         ;;
+       none | unknown | *)
+         newdeplibs=""
+         tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
+             -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
+         if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+           for i in $predeps $postdeps ; do
+             # can't use Xsed below, because $i might contain '/'
+             tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
+           done
+         fi
+         if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[      ]//g' |
+            $GREP . >/dev/null; then
+           $ECHO
+           if test "X$deplibs_check_method" = "Xnone"; then
+             $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
+           else
+             $ECHO "*** Warning: inter-library dependencies are not known to be supported."
+           fi
+           $ECHO "*** All declared inter-library dependencies are being dropped."
+           droppeddeps=yes
+         fi
+         ;;
+       esac
+       versuffix=$versuffix_save
+       major=$major_save
+       release=$release_save
+       libname=$libname_save
+       name=$name_save
+
+       case $host in
+       *-*-rhapsody* | *-*-darwin1.[012])
+         # On Rhapsody replace the C library with the System framework
+         newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+         ;;
+       esac
+
+       if test "$droppeddeps" = yes; then
+         if test "$module" = yes; then
+           $ECHO
+           $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
+           $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
+           $ECHO "*** a static module, that should work as long as the dlopening"
+           $ECHO "*** application is linked with the -dlopen flag."
+           if test -z "$global_symbol_pipe"; then
+             $ECHO
+             $ECHO "*** However, this would only work if libtool was able to extract symbol"
+             $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+             $ECHO "*** not find such a program.  So, this module is probably useless."
+             $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+           fi
+           if test "$build_old_libs" = no; then
+             oldlibs="$output_objdir/$libname.$libext"
+             build_libtool_libs=module
+             build_old_libs=yes
+           else
+             build_libtool_libs=no
+           fi
+         else
+           $ECHO "*** The inter-library dependencies that have been dropped here will be"
+           $ECHO "*** automatically added whenever a program is linked with this library"
+           $ECHO "*** or is declared to -dlopen it."
+
+           if test "$allow_undefined" = no; then
+             $ECHO
+             $ECHO "*** Since this library must not contain undefined symbols,"
+             $ECHO "*** because either the platform does not support them or"
+             $ECHO "*** it was explicitly requested with -no-undefined,"
+             $ECHO "*** libtool will only create a static version of it."
+             if test "$build_old_libs" = no; then
+               oldlibs="$output_objdir/$libname.$libext"
+               build_libtool_libs=module
+               build_old_libs=yes
+             else
+               build_libtool_libs=no
+             fi
+           fi
+         fi
+       fi
+       # Done checking deplibs!
+       deplibs=$newdeplibs
+      fi
+      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+      case $host in
+       *-*-darwin*)
+         newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+         new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+         deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+         ;;
+      esac
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $deplibs " in
+         *" -L$path/$objdir "*)
+           new_libs="$new_libs -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) new_libs="$new_libs $deplib" ;;
+         esac
+         ;;
+       *) new_libs="$new_libs $deplib" ;;
+       esac
+      done
+      deplibs="$new_libs"
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+       if test "$hardcode_into_libs" = yes; then
+         # Hardcode the library paths
+         hardcode_libdirs=
+         dep_rpath=
+         rpath="$finalize_rpath"
+         test "$mode" != relink && rpath="$compile_rpath$rpath"
+         for libdir in $rpath; do
+           if test -n "$hardcode_libdir_flag_spec"; then
+             if test -n "$hardcode_libdir_separator"; then
+               if test -z "$hardcode_libdirs"; then
+                 hardcode_libdirs="$libdir"
+               else
+                 # Just accumulate the unique libdirs.
+                 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+                 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+                   ;;
+                 *)
+                   hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+                   ;;
+                 esac
+               fi
+             else
+               eval flag=\"$hardcode_libdir_flag_spec\"
+               dep_rpath="$dep_rpath $flag"
+             fi
+           elif test -n "$runpath_var"; then
+             case "$perm_rpath " in
+             *" $libdir "*) ;;
+             *) perm_rpath="$perm_rpath $libdir" ;;
+             esac
+           fi
+         done
+         # Substitute the hardcoded libdirs into the rpath.
+         if test -n "$hardcode_libdir_separator" &&
+            test -n "$hardcode_libdirs"; then
+           libdir="$hardcode_libdirs"
+           if test -n "$hardcode_libdir_flag_spec_ld"; then
+             eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+           else
+             eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+           fi
+         fi
+         if test -n "$runpath_var" && test -n "$perm_rpath"; then
+           # We should set the runpath_var.
+           rpath=
+           for dir in $perm_rpath; do
+             rpath="$rpath$dir:"
+           done
+           eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+         fi
+         test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+       fi
+
+       shlibpath="$finalize_shlibpath"
+       test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+       if test -n "$shlibpath"; then
+         eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+       fi
+
+       # Get the real and link names of the library.
+       eval shared_ext=\"$shrext_cmds\"
+       eval library_names=\"$library_names_spec\"
+       set dummy $library_names
+       shift
+       realname="$1"
+       shift
+
+       if test -n "$soname_spec"; then
+         eval soname=\"$soname_spec\"
+       else
+         soname="$realname"
+       fi
+       if test -z "$dlname"; then
+         dlname=$soname
+       fi
+
+       lib="$output_objdir/$realname"
+       linknames=
+       for link
+       do
+         linknames="$linknames $link"
+       done
+
+       # Use standard objects if they are pic
+       test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+       test "X$libobjs" = "X " && libobjs=
+
+       delfiles=
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+         export_symbols="$output_objdir/$libname.uexp"
+         delfiles="$delfiles $export_symbols"
+       fi
+
+       orig_export_symbols=
+       case $host_os in
+       cygwin* | mingw* | cegcc*)
+         if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+           # exporting using user supplied symfile
+           if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+             # and it's NOT already a .def file. Must figure out
+             # which of the given symbols are data symbols and tag
+             # them as such. So, trigger use of export_symbols_cmds.
+             # export_symbols gets reassigned inside the "prepare
+             # the list of exported symbols" if statement, so the
+             # include_expsyms logic still works.
+             orig_export_symbols="$export_symbols"
+             export_symbols=
+             always_export_symbols=yes
+           fi
+         fi
+         ;;
+       esac
+
+       # Prepare the list of exported symbols
+       if test -z "$export_symbols"; then
+         if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+           func_verbose "generating symbol list for \`$libname.la'"
+           export_symbols="$output_objdir/$libname.exp"
+           $opt_dry_run || $RM $export_symbols
+           cmds=$export_symbols_cmds
+           save_ifs="$IFS"; IFS='~'
+           for cmd in $cmds; do
+             IFS="$save_ifs"
+             eval cmd=\"$cmd\"
+             func_len " $cmd"
+             len=$func_len_result
+             if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+               func_show_eval "$cmd" 'exit $?'
+               skipped_export=false
+             else
+               # The command line is too long to execute in one step.
+               func_verbose "using reloadable object file for export list..."
+               skipped_export=:
+               # Break out early, otherwise skipped_export may be
+               # set to false by a later but shorter cmd.
+               break
+             fi
+           done
+           IFS="$save_ifs"
+           if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+             func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+       fi
+
+       if test -n "$export_symbols" && test -n "$include_expsyms"; then
+         tmp_export_symbols="$export_symbols"
+         test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+         $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+       fi
+
+       if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+         # The given exports_symbols file has to be filtered, so filter it.
+         func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+         # FIXME: $output_objdir/$libname.filter potentially contains lots of
+         # 's' commands which not all seds can handle. GNU sed should be fine
+         # though. Also, the filter scales superlinearly with the number of
+         # global variables. join(1) would be nice here, but unfortunately
+         # isn't a blessed tool.
+         $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+         delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+         export_symbols=$output_objdir/$libname.def
+         $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+       fi
+
+       tmp_deplibs=
+       for test_deplib in $deplibs; do
+         case " $convenience " in
+         *" $test_deplib "*) ;;
+         *)
+           tmp_deplibs="$tmp_deplibs $test_deplib"
+           ;;
+         esac
+       done
+       deplibs="$tmp_deplibs"
+
+       if test -n "$convenience"; then
+         if test -n "$whole_archive_flag_spec" &&
+           test "$compiler_needs_object" = yes &&
+           test -z "$libobjs"; then
+           # extract the archives, so we have objects to list.
+           # TODO: could optimize this to just extract one archive.
+           whole_archive_flag_spec=
+         fi
+         if test -n "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+           test "X$libobjs" = "X " && libobjs=
+         else
+           gentop="$output_objdir/${outputname}x"
+           generated="$generated $gentop"
+
+           func_extract_archives $gentop $convenience
+           libobjs="$libobjs $func_extract_archives_result"
+           test "X$libobjs" = "X " && libobjs=
+         fi
+       fi
+
+       if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+         eval flag=\"$thread_safe_flag_spec\"
+         linker_flags="$linker_flags $flag"
+       fi
+
+       # Make a backup of the uninstalled library when relinking
+       if test "$mode" = relink; then
+         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+       fi
+
+       # Do each of the archive commands.
+       if test "$module" = yes && test -n "$module_cmds" ; then
+         if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+           eval test_cmds=\"$module_expsym_cmds\"
+           cmds=$module_expsym_cmds
+         else
+           eval test_cmds=\"$module_cmds\"
+           cmds=$module_cmds
+         fi
+       else
+         if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+           eval test_cmds=\"$archive_expsym_cmds\"
+           cmds=$archive_expsym_cmds
+         else
+           eval test_cmds=\"$archive_cmds\"
+           cmds=$archive_cmds
+         fi
+       fi
+
+       if test "X$skipped_export" != "X:" &&
+          func_len " $test_cmds" &&
+          len=$func_len_result &&
+          test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         :
+       else
+         # The command line is too long to link in one step, link piecewise
+         # or, if using GNU ld and skipped_export is not :, use a linker
+         # script.
+
+         # Save the value of $output and $libobjs because we want to
+         # use them later.  If we have whole_archive_flag_spec, we
+         # want to use save_libobjs as it was before
+         # whole_archive_flag_spec was expanded, because we can't
+         # assume the linker understands whole_archive_flag_spec.
+         # This may have to be revisited, in case too many
+         # convenience libraries get linked in and end up exceeding
+         # the spec.
+         if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+           save_libobjs=$libobjs
+         fi
+         save_output=$output
+         output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
+
+         # Clear the reloadable object creation command queue and
+         # initialize k to one.
+         test_cmds=
+         concat_cmds=
+         objlist=
+         last_robj=
+         k=1
+
+         if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+           output=${output_objdir}/${output_la}.lnkscript
+           func_verbose "creating GNU ld script: $output"
+           $ECHO 'INPUT (' > $output
+           for obj in $save_libobjs
+           do
+             $ECHO "$obj" >> $output
+           done
+           $ECHO ')' >> $output
+           delfiles="$delfiles $output"
+         elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+           output=${output_objdir}/${output_la}.lnk
+           func_verbose "creating linker input file list: $output"
+           : > $output
+           set x $save_libobjs
+           shift
+           firstobj=
+           if test "$compiler_needs_object" = yes; then
+             firstobj="$1 "
+             shift
+           fi
+           for obj
+           do
+             $ECHO "$obj" >> $output
+           done
+           delfiles="$delfiles $output"
+           output=$firstobj\"$file_list_spec$output\"
+         else
+           if test -n "$save_libobjs"; then
+             func_verbose "creating reloadable object files..."
+             output=$output_objdir/$output_la-${k}.$objext
+             eval test_cmds=\"$reload_cmds\"
+             func_len " $test_cmds"
+             len0=$func_len_result
+             len=$len0
+
+             # Loop over the list of objects to be linked.
+             for obj in $save_libobjs
+             do
+               func_len " $obj"
+               func_arith $len + $func_len_result
+               len=$func_arith_result
+               if test "X$objlist" = X ||
+                  test "$len" -lt "$max_cmd_len"; then
+                 func_append objlist " $obj"
+               else
+                 # The command $test_cmds is almost too long, add a
+                 # command to the queue.
+                 if test "$k" -eq 1 ; then
+                   # The first file doesn't have a previous command to add.
+                   eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+                 else
+                   # All subsequent reloadable object files will link in
+                   # the last one created.
+                   eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
+                 fi
+                 last_robj=$output_objdir/$output_la-${k}.$objext
+                 func_arith $k + 1
+                 k=$func_arith_result
+                 output=$output_objdir/$output_la-${k}.$objext
+                 objlist=$obj
+                 func_len " $last_robj"
+                 func_arith $len0 + $func_len_result
+                 len=$func_arith_result
+               fi
+             done
+             # Handle the remaining objects by creating one last
+             # reloadable object file.  All subsequent reloadable object
+             # files will link in the last one created.
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+             if test -n "$last_robj"; then
+               eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+             fi
+             delfiles="$delfiles $output"
+
+           else
+             output=
+           fi
+
+           if ${skipped_export-false}; then
+             func_verbose "generating symbol list for \`$libname.la'"
+             export_symbols="$output_objdir/$libname.exp"
+             $opt_dry_run || $RM $export_symbols
+             libobjs=$output
+             # Append the command to create the export file.
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+             if test -n "$last_robj"; then
+               eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+             fi
+           fi
+
+           test -n "$save_libobjs" &&
+             func_verbose "creating a temporary reloadable object file: $output"
+
+           # Loop through the commands generated above and execute them.
+           save_ifs="$IFS"; IFS='~'
+           for cmd in $concat_cmds; do
+             IFS="$save_ifs"
+             $opt_silent || {
+                 func_quote_for_expand "$cmd"
+                 eval "func_echo $func_quote_for_expand_result"
+             }
+             $opt_dry_run || eval "$cmd" || {
+               lt_exit=$?
+
+               # Restore the uninstalled library and exit
+               if test "$mode" = relink; then
+                 ( cd "$output_objdir" && \
+                   $RM "${realname}T" && \
+                   $MV "${realname}U" "$realname" )
+               fi
+
+               exit $lt_exit
+             }
+           done
+           IFS="$save_ifs"
+
+           if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+             func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+
+          if ${skipped_export-false}; then
+           if test -n "$export_symbols" && test -n "$include_expsyms"; then
+             tmp_export_symbols="$export_symbols"
+             test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+             $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+           fi
+
+           if test -n "$orig_export_symbols"; then
+             # The given exports_symbols file has to be filtered, so filter it.
+             func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+             # FIXME: $output_objdir/$libname.filter potentially contains lots of
+             # 's' commands which not all seds can handle. GNU sed should be fine
+             # though. Also, the filter scales superlinearly with the number of
+             # global variables. join(1) would be nice here, but unfortunately
+             # isn't a blessed tool.
+             $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+             delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+             export_symbols=$output_objdir/$libname.def
+             $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+           fi
+         fi
+
+         libobjs=$output
+         # Restore the value of output.
+         output=$save_output
+
+         if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+           eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+           test "X$libobjs" = "X " && libobjs=
+         fi
+         # Expand the library linking commands again to reset the
+         # value of $libobjs for piecewise linking.
+
+         # Do each of the archive commands.
+         if test "$module" = yes && test -n "$module_cmds" ; then
+           if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+             cmds=$module_expsym_cmds
+           else
+             cmds=$module_cmds
+           fi
+         else
+           if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+             cmds=$archive_expsym_cmds
+           else
+             cmds=$archive_cmds
+           fi
+         fi
+       fi
+
+       if test -n "$delfiles"; then
+         # Append the command to remove temporary files to $cmds.
+         eval cmds=\"\$cmds~\$RM $delfiles\"
+       fi
+
+       # Add any objects from preloaded convenience libraries
+       if test -n "$dlprefiles"; then
+         gentop="$output_objdir/${outputname}x"
+         generated="$generated $gentop"
+
+         func_extract_archives $gentop $dlprefiles
+         libobjs="$libobjs $func_extract_archives_result"
+         test "X$libobjs" = "X " && libobjs=
+       fi
+
+       save_ifs="$IFS"; IFS='~'
+       for cmd in $cmds; do
+         IFS="$save_ifs"
+         eval cmd=\"$cmd\"
+         $opt_silent || {
+           func_quote_for_expand "$cmd"
+           eval "func_echo $func_quote_for_expand_result"
+         }
+         $opt_dry_run || eval "$cmd" || {
+           lt_exit=$?
+
+           # Restore the uninstalled library and exit
+           if test "$mode" = relink; then
+             ( cd "$output_objdir" && \
+               $RM "${realname}T" && \
+               $MV "${realname}U" "$realname" )
+           fi
+
+           exit $lt_exit
+         }
+       done
+       IFS="$save_ifs"
+
+       # Restore the uninstalled library and exit
+       if test "$mode" = relink; then
+         $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+         if test -n "$convenience"; then
+           if test -z "$whole_archive_flag_spec"; then
+             func_show_eval '${RM}r "$gentop"'
+           fi
+         fi
+
+         exit $EXIT_SUCCESS
+       fi
+
+       # Create links to the real library.
+       for linkname in $linknames; do
+         if test "$realname" != "$linkname"; then
+           func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+         fi
+       done
+
+       # If -module or -export-dynamic was specified, set the dlname.
+       if test "$module" = yes || test "$export_dynamic" = yes; then
+         # On all known operating systems, these are identical.
+         dlname="$soname"
+       fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+       func_warning "\`-dlopen' is ignored for objects"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+       func_warning "\`-l' and \`-L' are ignored for objects" ;;
+      esac
+
+      test -n "$rpath" && \
+       func_warning "\`-rpath' is ignored for objects"
+
+      test -n "$xrpath" && \
+       func_warning "\`-R' is ignored for objects"
+
+      test -n "$vinfo" && \
+       func_warning "\`-version-info' is ignored for objects"
+
+      test -n "$release" && \
+       func_warning "\`-release' is ignored for objects"
+
+      case $output in
+      *.lo)
+       test -n "$objs$old_deplibs" && \
+         func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+       libobj=$output
+       func_lo2o "$libobj"
+       obj=$func_lo2o_result
+       ;;
+      *)
+       libobj=
+       obj="$output"
+       ;;
+      esac
+
+      # Delete the old objects.
+      $opt_dry_run || $RM $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+       if test -n "$whole_archive_flag_spec"; then
+         eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+         reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+       else
+         gentop="$output_objdir/${obj}x"
+         generated="$generated $gentop"
+
+         func_extract_archives $gentop $convenience
+         reload_conv_objs="$reload_objs $func_extract_archives_result"
+       fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      func_execute_cmds "$reload_cmds" 'exit $?'
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+       if test -n "$gentop"; then
+         func_show_eval '${RM}r "$gentop"'
+       fi
+
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+       if test -n "$gentop"; then
+         func_show_eval '${RM}r "$gentop"'
+       fi
+
+       # Create an invalid libtool object if no PIC, so that we don't
+       # accidentally link it into a program.
+       # $show "echo timestamp > $libobj"
+       # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+       exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+       # Only do commands if we really have different PIC objects.
+       reload_objs="$libobjs $reload_conv_objs"
+       output="$libobj"
+       func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
+
+      if test -n "$gentop"; then
+       func_show_eval '${RM}r "$gentop"'
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+       *cygwin*) func_stripname '' '.exe' "$output"
+                 output=$func_stripname_result.exe;;
+      esac
+      test -n "$vinfo" && \
+       func_warning "\`-version-info' is ignored for programs"
+
+      test -n "$release" && \
+       func_warning "\`-release' is ignored for programs"
+
+      test "$preload" = yes \
+        && test "$dlopen_support" = unknown \
+       && test "$dlopen_self" = unknown \
+       && test "$dlopen_self_static" = unknown && \
+         func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+       # On Rhapsody replace the C library is the System framework
+       compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+       finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+       ;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+       # Don't allow lazy linking, it breaks C++ global constructors
+       # But is supposedly fixed on 10.4 or later (yay!).
+       if test "$tagname" = CXX ; then
+         case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+           10.[0123])
+             compile_command="$compile_command ${wl}-bind_at_load"
+             finalize_command="$finalize_command ${wl}-bind_at_load"
+           ;;
+         esac
+       fi
+       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+       compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+       finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+       ;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+       case " $new_libs " in
+       *" -L$path/$objdir "*) ;;
+       *)
+         case " $compile_deplibs " in
+         *" -L$path/$objdir "*)
+           new_libs="$new_libs -L$path/$objdir" ;;
+         esac
+         ;;
+       esac
+      done
+      for deplib in $compile_deplibs; do
+       case $deplib in
+       -L*)
+         case " $new_libs " in
+         *" $deplib "*) ;;
+         *) new_libs="$new_libs $deplib" ;;
+         esac
+         ;;
+       *) new_libs="$new_libs $deplib" ;;
+       esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+       # If the user specified any rpath flags, then add them.
+       for libdir in $rpath $xrpath; do
+         # This is the magic to use -rpath.
+         case "$finalize_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_rpath="$finalize_rpath $libdir" ;;
+         esac
+       done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           rpath="$rpath $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$perm_rpath " in
+         *" $libdir "*) ;;
+         *) perm_rpath="$perm_rpath $libdir" ;;
+         esac
+       fi
+       case $host in
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+         testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+         case :$dllsearchpath: in
+         *":$libdir:"*) ;;
+         ::) dllsearchpath=$libdir;;
+         *) dllsearchpath="$dllsearchpath:$libdir";;
+         esac
+         case :$dllsearchpath: in
+         *":$testbindir:"*) ;;
+         ::) dllsearchpath=$testbindir;;
+         *) dllsearchpath="$dllsearchpath:$testbindir";;
+         esac
+         ;;
+       esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+       if test -n "$hardcode_libdir_flag_spec"; then
+         if test -n "$hardcode_libdir_separator"; then
+           if test -z "$hardcode_libdirs"; then
+             hardcode_libdirs="$libdir"
+           else
+             # Just accumulate the unique libdirs.
+             case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+               ;;
+             *)
+               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+               ;;
+             esac
+           fi
+         else
+           eval flag=\"$hardcode_libdir_flag_spec\"
+           rpath="$rpath $flag"
+         fi
+       elif test -n "$runpath_var"; then
+         case "$finalize_perm_rpath " in
+         *" $libdir "*) ;;
+         *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+         esac
+       fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+        test -n "$hardcode_libdirs"; then
+       libdir="$hardcode_libdirs"
+       eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+       # Transform all the library objects into standard objects.
+       compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+       finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+       func_execute_cmds "$prelink_cmds" 'exit $?'
+      fi
+
+      wrappers_required=yes
+      case $host in
+      *cygwin* | *mingw* )
+        if test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      *cegcc)
+        # Disable wrappers for cegcc, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
+      *)
+        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      esac
+      if test "$wrappers_required" = no; then
+       # Replace the output file specification.
+       compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       link_command="$compile_command$compile_rpath"
+
+       # We have no uninstalled library dependencies, so finalize right now.
+       exit_status=0
+       func_show_eval "$link_command" 'exit_status=$?'
+
+       # Delete the generated files.
+       if test -f "$output_objdir/${outputname}S.${objext}"; then
+         func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+       fi
+
+       exit $exit_status
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+       compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+       finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+       if test -n "$perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $perm_rpath; do
+           rpath="$rpath$dir:"
+         done
+         compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+       if test -n "$finalize_perm_rpath"; then
+         # We should set the runpath_var.
+         rpath=
+         for dir in $finalize_perm_rpath; do
+           rpath="$rpath$dir:"
+         done
+         finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+       fi
+      fi
+
+      if test "$no_install" = yes; then
+       # We don't need to create a wrapper script.
+       link_command="$compile_var$compile_command$compile_rpath"
+       # Replace the output file specification.
+       link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       # Delete the old output file.
+       $opt_dry_run || $RM $output
+       # Link the executable and exit
+       func_show_eval "$link_command" 'exit $?'
+       exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+       # Fast installation is not supported
+       link_command="$compile_var$compile_command$compile_rpath"
+       relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+       func_warning "this platform does not like uninstalled shared libraries"
+       func_warning "\`$output' will be relinked during installation"
+      else
+       if test "$fast_install" != no; then
+         link_command="$finalize_var$compile_command$finalize_rpath"
+         if test "$fast_install" = yes; then
+           relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+         else
+           # fast_install is set to needless
+           relink_command=
+         fi
+       else
+         link_command="$compile_var$compile_command$compile_rpath"
+         relink_command="$finalize_var$finalize_command$finalize_rpath"
+       fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      func_show_eval "$link_command" 'exit $?'
+
+      # Now create the wrapper script.
+      func_verbose "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+       # Preserve any variables that may affect compiler behavior
+       for var in $variables_saved_for_relink; do
+         if eval test -z \"\${$var+set}\"; then
+           relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+         elif eval var_value=\$$var; test -z "$var_value"; then
+           relink_command="$var=; export $var; $relink_command"
+         else
+           func_quote_for_eval "$var_value"
+           relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+         fi
+       done
+       relink_command="(cd `pwd`; $relink_command)"
+       relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $ECHO for shipping.
+      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
+       case $progpath in
+       [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+       *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+       esac
+       qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+       qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
+       # win32 will think the script is a binary if it has
+       # a .exe suffix, so we strip it off here.
+       case $output in
+         *.exe) func_stripname '' '.exe' "$output"
+                output=$func_stripname_result ;;
+       esac
+       # test for cygwin because mv fails w/o .exe extensions
+       case $host in
+         *cygwin*)
+           exeext=.exe
+           func_stripname '' '.exe' "$outputname"
+           outputname=$func_stripname_result ;;
+         *) exeext= ;;
+       esac
+       case $host in
+         *cygwin* | *mingw* )
+           func_dirname_and_basename "$output" "" "."
+           output_name=$func_basename_result
+           output_path=$func_dirname_result
+           cwrappersource="$output_path/$objdir/lt-$output_name.c"
+           cwrapper="$output_path/$output_name.exe"
+           $RM $cwrappersource $cwrapper
+           trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+           func_emit_cwrapperexe_src > $cwrappersource
+
+           # The wrapper executable is built using the $host compiler,
+           # because it contains $host paths and files. If cross-
+           # compiling, it, like the target executable, must be
+           # executed on the $host or under an emulation environment.
+           $opt_dry_run || {
+             $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+             $STRIP $cwrapper
+           }
+
+           # Now, create the wrapper script for func_source use:
+           func_ltwrapper_scriptname $cwrapper
+           $RM $func_ltwrapper_scriptname_result
+           trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+           $opt_dry_run || {
+             # note: this script will not be executed, so do not chmod.
+             if test "x$build" = "x$host" ; then
+               $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+             else
+               func_emit_wrapper no > $func_ltwrapper_scriptname_result
+             fi
+           }
+         ;;
+         * )
+           $RM $output
+           trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+           func_emit_wrapper no > $output
+           chmod +x $output
+         ;;
+       esac
+      }
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+       oldobjs="$libobjs_save $symfileobj"
+       addlibs="$convenience"
+       build_libtool_libs=no
+      else
+       if test "$build_libtool_libs" = module; then
+         oldobjs="$libobjs_save"
+         build_libtool_libs=no
+       else
+         oldobjs="$old_deplibs $non_pic_objects"
+         if test "$preload" = yes && test -f "$symfileobj"; then
+           oldobjs="$oldobjs $symfileobj"
+         fi
+       fi
+       addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+       gentop="$output_objdir/${outputname}x"
+       generated="$generated $gentop"
+
+       func_extract_archives $gentop $addlibs
+       oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+       cmds=$old_archive_from_new_cmds
+      else
+
+       # Add any objects from preloaded convenience libraries
+       if test -n "$dlprefiles"; then
+         gentop="$output_objdir/${outputname}x"
+         generated="$generated $gentop"
+
+         func_extract_archives $gentop $dlprefiles
+         oldobjs="$oldobjs $func_extract_archives_result"
+       fi
+
+       # POSIX demands no paths to be encoded in archives.  We have
+       # to avoid creating archives with duplicate basenames if we
+       # might have to extract them afterwards, e.g., when creating a
+       # static archive out of a convenience library, or when linking
+       # the entirety of a libtool archive into another (currently
+       # not supported by libtool).
+       if (for obj in $oldobjs
+           do
+             func_basename "$obj"
+             $ECHO "$func_basename_result"
+           done | sort | sort -uc >/dev/null 2>&1); then
+         :
+       else
+         $ECHO "copying selected object files to avoid basename conflicts..."
+         gentop="$output_objdir/${outputname}x"
+         generated="$generated $gentop"
+         func_mkdir_p "$gentop"
+         save_oldobjs=$oldobjs
+         oldobjs=
+         counter=1
+         for obj in $save_oldobjs
+         do
+           func_basename "$obj"
+           objbase="$func_basename_result"
+           case " $oldobjs " in
+           " ") oldobjs=$obj ;;
+           *[\ /]"$objbase "*)
+             while :; do
+               # Make sure we don't pick an alternate name that also
+               # overlaps.
+               newobj=lt$counter-$objbase
+               func_arith $counter + 1
+               counter=$func_arith_result
+               case " $oldobjs " in
+               *[\ /]"$newobj "*) ;;
+               *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+               esac
+             done
+             func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+             oldobjs="$oldobjs $gentop/$newobj"
+             ;;
+           *) oldobjs="$oldobjs $obj" ;;
+           esac
+         done
+       fi
+       eval cmds=\"$old_archive_cmds\"
+
+       func_len " $cmds"
+       len=$func_len_result
+       if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+         cmds=$old_archive_cmds
+       else
+         # the command line is too long to link in one step, link in parts
+         func_verbose "using piecewise archive linking..."
+         save_RANLIB=$RANLIB
+         RANLIB=:
+         objlist=
+         concat_cmds=
+         save_oldobjs=$oldobjs
+         oldobjs=
+         # Is there a better way of finding the last object in the list?
+         for obj in $save_oldobjs
+         do
+           last_oldobj=$obj
+         done
+         eval test_cmds=\"$old_archive_cmds\"
+         func_len " $test_cmds"
+         len0=$func_len_result
+         len=$len0
+         for obj in $save_oldobjs
+         do
+           func_len " $obj"
+           func_arith $len + $func_len_result
+           len=$func_arith_result
+           func_append objlist " $obj"
+           if test "$len" -lt "$max_cmd_len"; then
+             :
+           else
+             # the above command should be used before it gets too long
+             oldobjs=$objlist
+             if test "$obj" = "$last_oldobj" ; then
+               RANLIB=$save_RANLIB
+             fi
+             test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+             eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+             objlist=
+             len=$len0
+           fi
+         done
+         RANLIB=$save_RANLIB
+         oldobjs=$objlist
+         if test "X$oldobjs" = "X" ; then
+           eval cmds=\"\$concat_cmds\"
+         else
+           eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+         fi
+       fi
+      fi
+      func_execute_cmds "$cmds" 'exit $?'
+    done
+
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      func_verbose "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+       if eval test -z \"\${$var+set}\"; then
+         relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+       elif eval var_value=\$$var; test -z "$var_value"; then
+         relink_command="$var=; export $var; $relink_command"
+       else
+         func_quote_for_eval "$var_value"
+         relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+       fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+       relink_command=
+      fi
+
+      # Only create the output if not a dry run.
+      $opt_dry_run || {
+       for installed in no yes; do
+         if test "$installed" = yes; then
+           if test -z "$install_libdir"; then
+             break
+           fi
+           output="$output_objdir/$outputname"i
+           # Replace all uninstalled libtool libraries with the installed ones
+           newdependency_libs=
+           for deplib in $dependency_libs; do
+             case $deplib in
+             *.la)
+               func_basename "$deplib"
+               name="$func_basename_result"
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+               test -z "$libdir" && \
+                 func_fatal_error "\`$deplib' is not a valid libtool archive"
+               newdependency_libs="$newdependency_libs $libdir/$name"
+               ;;
+             *) newdependency_libs="$newdependency_libs $deplib" ;;
+             esac
+           done
+           dependency_libs="$newdependency_libs"
+           newdlfiles=
+
+           for lib in $dlfiles; do
+             case $lib in
+             *.la)
+               func_basename "$lib"
+               name="$func_basename_result"
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+               test -z "$libdir" && \
+                 func_fatal_error "\`$lib' is not a valid libtool archive"
+               newdlfiles="$newdlfiles $libdir/$name"
+               ;;
+             *) newdlfiles="$newdlfiles $lib" ;;
+             esac
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             case $lib in
+             *.la)
+               # Only pass preopened files to the pseudo-archive (for
+               # eventual linking with the app. that links it) if we
+               # didn't already link the preopened objects directly into
+               # the library:
+               func_basename "$lib"
+               name="$func_basename_result"
+               eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+               test -z "$libdir" && \
+                 func_fatal_error "\`$lib' is not a valid libtool archive"
+               newdlprefiles="$newdlprefiles $libdir/$name"
+               ;;
+             esac
+           done
+           dlprefiles="$newdlprefiles"
+         else
+           newdlfiles=
+           for lib in $dlfiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             newdlfiles="$newdlfiles $abs"
+           done
+           dlfiles="$newdlfiles"
+           newdlprefiles=
+           for lib in $dlprefiles; do
+             case $lib in
+               [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+               *) abs=`pwd`"/$lib" ;;
+             esac
+             newdlprefiles="$newdlprefiles $abs"
+           done
+           dlprefiles="$newdlprefiles"
+         fi
+         $RM $output
+         # place dlname in correct position for cygwin
+         tdlname=$dlname
+         case $host,$output,$installed,$module,$dlname in
+           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+         esac
+         $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+         if test "$installed" = no && test "$need_relink" = yes; then
+           $ECHO >> $output "\
+relink_command=\"$relink_command\""
+         fi
+       done
+      }
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+}
+
+{ test "$mode" = link || test "$mode" = relink; } &&
+    func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+    $opt_debug
+    RM="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) RM="$RM $arg"; rmforce=yes ;;
+      -*) RM="$RM $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    test -z "$RM" && \
+      func_fatal_help "you must specify an RM program"
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      func_dirname "$file" "" "."
+      dir="$func_dirname_result"
+      if test "X$dir" = X.; then
+       objdir="$origobjdir"
+      else
+       objdir="$dir/$origobjdir"
+      fi
+      func_basename "$file"
+      name="$func_basename_result"
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+       case " $rmdirs " in
+         *" $objdir "*) ;;
+         *) rmdirs="$rmdirs $objdir" ;;
+       esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if { test -L "$file"; } >/dev/null 2>&1 ||
+        { test -h "$file"; } >/dev/null 2>&1 ||
+        test -f "$file"; then
+       :
+      elif test -d "$file"; then
+       exit_status=1
+       continue
+      elif test "$rmforce" = yes; then
+       continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+       # Possibly a libtool archive, so verify it.
+       if func_lalib_p "$file"; then
+         func_source $dir/$name
+
+         # Delete the libtool libraries and symlinks.
+         for n in $library_names; do
+           rmfiles="$rmfiles $objdir/$n"
+         done
+         test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+         case "$mode" in
+         clean)
+           case "  $library_names " in
+           # "  " in the beginning catches empty $dlname
+           *" $dlname "*) ;;
+           *) rmfiles="$rmfiles $objdir/$dlname" ;;
+           esac
+           test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+           ;;
+         uninstall)
+           if test -n "$library_names"; then
+             # Do each command in the postuninstall commands.
+             func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+           fi
+
+           if test -n "$old_library"; then
+             # Do each command in the old_postuninstall commands.
+             func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+           fi
+           # FIXME: should reinstall the best remaining shared library.
+           ;;
+         esac
+       fi
+       ;;
+
+      *.lo)
+       # Possibly a libtool object, so verify it.
+       if func_lalib_p "$file"; then
+
+         # Read the .lo file
+         func_source $dir/$name
+
+         # Add PIC object to the list of files to remove.
+         if test -n "$pic_object" &&
+            test "$pic_object" != none; then
+           rmfiles="$rmfiles $dir/$pic_object"
+         fi
+
+         # Add non-PIC object to the list of files to remove.
+         if test -n "$non_pic_object" &&
+            test "$non_pic_object" != none; then
+           rmfiles="$rmfiles $dir/$non_pic_object"
+         fi
+       fi
+       ;;
+
+      *)
+       if test "$mode" = clean ; then
+         noexename=$name
+         case $file in
+         *.exe)
+           func_stripname '' '.exe' "$file"
+           file=$func_stripname_result
+           func_stripname '' '.exe' "$name"
+           noexename=$func_stripname_result
+           # $file with .exe has already been added to rmfiles,
+           # add $file without .exe
+           rmfiles="$rmfiles $file"
+           ;;
+         esac
+         # Do a test to see if this is a libtool program.
+         if func_ltwrapper_p "$file"; then
+           if func_ltwrapper_executable_p "$file"; then
+             func_ltwrapper_scriptname "$file"
+             relink_command=
+             func_source $func_ltwrapper_scriptname_result
+             rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
+           else
+             relink_command=
+             func_source $dir/$noexename
+           fi
+
+           # note $name still contains .exe if it was in $file originally
+           # as does the version of $file that was added into $rmfiles
+           rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+           if test "$fast_install" = yes && test -n "$relink_command"; then
+             rmfiles="$rmfiles $objdir/lt-$name"
+           fi
+           if test "X$noexename" != "X$name" ; then
+             rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+           fi
+         fi
+       fi
+       ;;
+      esac
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+       func_show_eval "rmdir $dir >/dev/null 2>&1"
+      fi
+    done
+
+    exit $exit_status
+}
+
+{ test "$mode" = uninstall || test "$mode" = clean; } &&
+    func_mode_uninstall ${1+"$@"}
+
+test -z "$mode" && {
+  help="$generic_help"
+  func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+  func_fatal_help "invalid operation mode \`$mode'"
+
+if test -n "$exec_cmd"; then
+  eval exec "$exec_cmd"
+  exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
diff --git a/wearable/m4/Makefile.am b/wearable/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/wearable/m4/as-compiler-flag.m4 b/wearable/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/wearable/m4/as-version.m4 b/wearable/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/wearable/missing b/wearable/missing
new file mode 100644 (file)
index 0000000..894e786
--- /dev/null
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+          sed 's/\.am$/.in/' |
+          while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo "#! /bin/sh"
+       echo "# Created by GNU Automake missing as a replacement of"
+       echo "#  $ $@"
+       echo "exit 0"
+       chmod +x $file
+       exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f y.tab.h ]; then
+       echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+        you modified a dependency of a manual page.  You may need the
+        \`Help2man' package in order for those modifications to take
+        effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo ".ab help2man is required to generate this page"
+       exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+       case "$firstarg" in
+       *o*)
+           firstarg=`echo "$firstarg" | sed s/o//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+       case "$firstarg" in
+       *h*)
+           firstarg=`echo "$firstarg" | sed s/h//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/wearable/pdpushsrc/Makefile.am b/wearable/pdpushsrc/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/wearable/pdpushsrc/src/Makefile.am b/wearable/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/wearable/pdpushsrc/src/gstpdpushsrc.c b/wearable/pdpushsrc/src/gstpdpushsrc.c
new file mode 100755 (executable)
index 0000000..210a1a7
--- /dev/null
@@ -0,0 +1,828 @@
+/*
+ * 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;
+
+  if(length < 1)
+    return GST_FLOW_ERROR;
+
+  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)) {
+    GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", length);
+    return GST_FLOW_ERROR;
+  }
+
+  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);
+    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."));
+    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/wearable/pdpushsrc/src/gstpdpushsrc.h b/wearable/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/wearable/toggle/Makefile.am b/wearable/toggle/Makefile.am
new file mode 100755 (executable)
index 0000000..308a09c
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src\r
diff --git a/wearable/toggle/src/Makefile.am b/wearable/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/wearable/toggle/src/gsttoggle.c b/wearable/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/wearable/toggle/src/gsttoggle.h b/wearable/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/wearable/uninstall.sh b/wearable/uninstall.sh
new file mode 100755 (executable)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/wearable/xvimagesrc/Makefile.am b/wearable/xvimagesrc/Makefile.am
new file mode 100644 (file)
index 0000000..af437a6
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = src
diff --git a/wearable/xvimagesrc/src/Makefile.am b/wearable/xvimagesrc/src/Makefile.am
new file mode 100644 (file)
index 0000000..8482d9d
--- /dev/null
@@ -0,0 +1,29 @@
+# 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) $(TBM_CFLAGS) $(DRI2_CFLAGS) $(X11_CFLAGS) $(XEXT_CFLAGS) $(XV_CFLAGS) $(XDAMAGE_CFLAGS) $(DRM_DEVEL_CFLAGS) $(DRM_CFLAGS)
+if IS_QC_SPECIFIC
+libgstxvimagesrc_la_CFLAGS += -DENABLE_QC_SPECIFIC
+endif
+libgstxvimagesrc_la_LIBADD = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(TBM_LIBS) $(DRI2_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(XV_LIBS) $(XDAMAGE_LIBS) $(DRM_LIBS) $(DRM_DEVEL_LIBS) $(DRM_SLP_MSM)
+libgstxvimagesrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+# headers we need but don't want installed
+noinst_HEADERS = gstxvimagesrc.h
diff --git a/wearable/xvimagesrc/src/gstxvimagesrc.c b/wearable/xvimagesrc/src/gstxvimagesrc.c
new file mode 100755 (executable)
index 0000000..26938f8
--- /dev/null
@@ -0,0 +1,1689 @@
+/*
+ * 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 <sys/time.h>
+#include <sys/times.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <X11/Xmd.h>
+#include <X11/Xlibint.h>
+#include <dri2.h>
+#include <drm.h>
+#ifndef ENABLE_QC_SPECIFIC
+#include <exynos_drm.h>
+#endif
+
+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, NV12 }, "                 \
+  "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,
+  PROP_SECURE_MODE
+};
+
+enum
+{
+  VIDEO_TYPE_VIDEO_WITH_UI,
+  VIDEO_TYPE_VIDEO_ONLY,
+};
+
+enum
+{
+  SIGNAL_VIDEO_WITH_UI = 0,
+  SIGNAL_VIDEO_ONLY,
+  SIGNAL_LAST
+};
+
+#ifndef ENABLE_QC_SPECIFIC
+#define GEM_NAME_MAX                10
+#else
+#define GEM_NAME_MAX                3
+#endif
+
+#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;
+  /* Y plane size in case of ST12 */
+  int y_size;
+  /* UV plane size in case of ST12 */
+  int uv_size;
+
+  /* Tizen buffer object of each image plane */
+  void *bo[SCMN_IMGB_MAX_PLANE];
+
+  /* JPEG data */
+  void *jpeg_data;
+  /* JPEG size */
+  int jpeg_size;
+
+  /* tzmem buffer */
+  int tz_enable;
+} SCMN_IMGB;
+#ifndef ENABLE_QC_SPECIFIC
+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;
+#else
+typedef struct
+{
+  void  *virtual_add[GEM_NAME_MAX];
+  int gem_name[GEM_NAME_MAX];
+  gint32 ion_fd[GEM_NAME_MAX];
+  void *Ybo[GEM_NAME_MAX];
+} MSM_GEM_MMAP;
+#endif
+typedef enum {
+ BUF_SHARE_METHOD_PADDR = 0,
+ BUF_SHARE_METHOD_FD
+} buf_share_method_t;
+
+typedef struct GstXvImageOutBuffer GstXvImageOutBuffer;
+
+struct GstXvImageOutBuffer {
+  GstBuffer buffer;
+  int fd_name;
+  int YBuf;
+  GstXVImageSrc * xvimagesrc;
+};
+
+
+
+#define DEFAULT_USER_AGENT           "GStreamer xvimagesrc "
+
+static guint gst_xv_image_src_signals[SIGNAL_LAST] = { 0 };
+
+//#define COUNT_FRAMES
+#ifdef COUNT_FRAMES
+gchar old_time[10] = {0, };
+#endif
+static gboolean error_caught = FALSE;
+
+#define HANDLE_OUTBUF_UNREF
+
+#ifdef HANDLE_OUTBUF_UNREF
+#define BUFFER_COND_WAIT_TIMEOUT            1000000
+#define GST_TYPE_GST_XV_IMAGE_OUT_BUFFER               (gst_xv_image_out_buffer_get_type())
+#define GST_IS_GST_XV_IMAGE_OUT_BUFFER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_GST_XV_IMAGE_OUT_BUFFER))
+static GstBufferClass *gst_xv_image_out_buffer_parent_class = NULL;
+static void gst_xv_image_out_buffer_class_init(gpointer g_class, gpointer class_data);
+static void gst_xv_image_out_buffer_finalize(GstXvImageOutBuffer *buffer);
+static GstXvImageOutBuffer *gst_xv_image_out_buffer_new(GstXVImageSrc *src);
+#endif
+static GstStateChangeReturn gst_xv_image_src_change_state (GstElement * element, GstStateChange transition);
+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 tbm_bufmgr bufmgr_get (Display *dpy, Pixmap pixmap);
+static int port_get (GstXVImageSrc * src, unsigned int id);
+static void pixmap_update (GstXVImageSrc * src,Display *dpy, tbm_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);
+#ifndef ENABLE_QC_SPECIFIC
+static gint32 drm_convert_gem_to_fd(int * gemname_cnt, int drm_fd, unsigned int name,  void * data, void **virtual_address);
+#endif
+static void gst_xv_get_image_sleep(void *asrc, long 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);
+
+#ifdef HANDLE_OUTBUF_UNREF
+static void gst_xv_image_out_buffer_class_init(gpointer g_class, gpointer class_data)
+{
+  GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS(g_class);
+  gst_xv_image_out_buffer_parent_class = g_type_class_peek_parent(g_class);
+  mini_object_class->finalize = (GstMiniObjectFinalizeFunction)gst_xv_image_out_buffer_finalize;
+}
+
+static GType gst_xv_image_out_buffer_get_type(void)
+{
+  static GType _gst_gst_xv_image_out_buffer_type;
+
+  if (G_UNLIKELY(_gst_gst_xv_image_out_buffer_type == 0)) {
+    static const GTypeInfo gst_xv_image_out_buffer_info = {
+      sizeof (GstBufferClass),
+      NULL,
+      NULL,
+      gst_xv_image_out_buffer_class_init,
+      NULL,
+      NULL,
+      sizeof (GstXvImageOutBuffer),
+      0,
+      NULL,
+      NULL
+    };
+    _gst_gst_xv_image_out_buffer_type = g_type_register_static(GST_TYPE_BUFFER,
+                                                        "GstOmxOutBuffer",
+                                                        &gst_xv_image_out_buffer_info, 0);
+  }
+  return _gst_gst_xv_image_out_buffer_type;
+}
+#ifdef DEBUG_BUFFER
+ int value[5] ={0};
+ static int value_count =0;
+#endif
+
+static GstStateChangeReturn
+gst_xv_image_src_change_state (GstElement * element, GstStateChange transition)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (element);
+
+  GstStateChangeReturn result = GST_STATE_CHANGE_FAILURE;
+  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:
+    src->pause_cond_var = FALSE;
+    g_cond_signal(src->pause_cond);
+    break;
+  case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
+    src->pause_cond_var = TRUE;
+    break;
+  case GST_STATE_CHANGE_PAUSED_TO_READY:
+    src->thread_return = TRUE;
+    g_cond_signal(src->pause_cond);
+    g_cond_signal(src->queue_cond);
+    break;
+  case GST_STATE_CHANGE_READY_TO_NULL:
+    break;
+  default :
+    break;
+  }
+  result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
+  return result;
+}
+
+
+static void gst_xv_image_out_buffer_finalize(GstXvImageOutBuffer *buffer)
+{
+  Atom atom_retbuf = 0;
+  g_mutex_lock (buffer->xvimagesrc->dpy_lock);
+  atom_retbuf = XInternAtom (buffer->xvimagesrc->dpy, "_USER_WM_PORT_ATTRIBUTE_RETURN_BUFFER", False);
+  XvSetPortAttribute (buffer->xvimagesrc->dpy, buffer->xvimagesrc->p, atom_retbuf, buffer->YBuf);  //data->YBuf is gemname, refer to drm_convert_gem_to_fd
+  g_mutex_unlock (buffer->xvimagesrc->dpy_lock);
+  g_cond_signal(buffer->xvimagesrc->buffer_cond);
+  GST_INFO(" xvimagesrc = %p, gem_name =%d, fd_name =%d", buffer->xvimagesrc, buffer->YBuf, buffer->fd_name);
+#ifdef DEBUG_BUFFER
+ int i = 0;
+ for(i=0 ; i<5; i++){
+   if (value[i] == buffer->YBuf) {
+     value[i]=0;
+     GST_ERROR("value[%d]=%d", i, value[i]);
+   }
+ }
+#endif
+  return;
+}
+
+
+static GstXvImageOutBuffer *gst_xv_image_out_buffer_new(GstXVImageSrc *src)
+{
+  GstXvImageOutBuffer *newbuf = NULL;
+  GST_LOG("gst_omx_out_buffer_new");
+
+  newbuf = (GstXvImageOutBuffer *)gst_mini_object_new(GST_TYPE_GST_XV_IMAGE_OUT_BUFFER);
+  if(!newbuf)
+  {
+    GST_ERROR("gst_omx_out_buffer_new out of memory");
+    return NULL;
+  }
+  GST_LOG("creating buffer : %p", newbuf);
+  newbuf->xvimagesrc = gst_object_ref(GST_OBJECT(src));
+  newbuf->fd_name = 0;
+  newbuf->YBuf =0;
+  return newbuf;
+}
+#endif
+
+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;
+  GstElementClass *gstelement_class;
+  gobject_class = G_OBJECT_CLASS (klass);
+  gstelement_class = (GstElementClass *) 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);
+  gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_xv_image_src_change_state);
+#ifdef ENABLE_QC_SPECIFIC
+  g_object_class_install_property (gobject_class, PROP_SECURE_MODE,
+     g_param_spec_boolean ("secure-mode",
+     "secure mode session",
+     "HDCP enabled",
+     0, G_PARAM_READWRITE));
+#endif
+  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('N','V','1','2'):       // V4L2_PIX_FMT_NV12 non-linear
+     GST_INFO("NV12");
+    *outsize = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
+    *outsize += (GST_ROUND_UP_4 (width) * height) / 2;
+    break;
+  case GST_MAKE_FOURCC('S','N','1','2'):       // V4L2_PIX_FMT_NV12 non-linear
+     GST_INFO("SN12");
+    *outsize = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
+    *outsize += (GST_ROUND_UP_4 (width) * height) / 2;
+    break;
+  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);
+    if(src->rate_numerator)
+    {
+      src->sleep_base_time = (long) (((int)(1000/src->rate_numerator))*1000);
+      src->sleep_limit_time = (long) (-1*src->sleep_base_time);
+    }
+  }
+  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->buffer_cond = g_cond_new ();
+  src->buffer_cond_lock = g_mutex_new ();
+  src->pause_cond = g_cond_new ();
+  src->pause_cond_lock = g_mutex_new ();
+  src->dpy_lock = g_mutex_new ();
+  src->pause_cond_var = FALSE;
+  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;
+  src->tz_enable = 0;
+  src->sleep_base_time = 0;
+  src->sleep_limit_time = 0;
+  drm_init(src);
+  gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
+}
+
+static void
+gst_xv_image_src_finalize (GObject * gobject)
+{
+  GstXVImageSrc *src = GST_XV_IMAGE_SRC (gobject);
+  GST_DEBUG_OBJECT (src, "finalize");
+  g_mutex_free (src->queue_lock);
+  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;
+  }
+}
+#ifndef ENABLE_QC_SPECIFIC
+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];
+  } else if (name == xv_gem_mmap->name[6]) {
+    *virtual_address = xv_gem_mmap->address[6];
+     fd = xv_gem_mmap->fd[6];
+  } else if (name == xv_gem_mmap->name[7]) {
+    *virtual_address = xv_gem_mmap->address[7];
+     fd = xv_gem_mmap->fd[7];
+  } else if ( name == xv_gem_mmap->name[8]) {
+    *virtual_address = xv_gem_mmap->address[8];
+     fd = xv_gem_mmap->fd[8];
+  } else if (name == xv_gem_mmap->name[9]) {
+    *virtual_address = xv_gem_mmap->address[9];
+     fd = xv_gem_mmap->fd[9];
+  }
+
+  GST_DEBUG("virtual_address = %p  fd = %d", *virtual_address, fd);
+  return fd;
+}
+#else
+static gint32 msm_convert_gem_to_fd(GstXVImageSrc *src, int *gemname_cnt, unsigned int gem_name, void *data)
+{
+  g_return_val_if_fail((data != NULL),0);
+  int count=0;
+  gint32 fd = 0;
+  tbm_bo_handle bo_handle;
+  count = *gemname_cnt;
+  GST_DEBUG("gamname_cnt = %d", count);
+  GST_DEBUG ("tbm_bo_import %d", gem_name);
+  MSM_GEM_MMAP *xv_gem_mmap = NULL;
+  xv_gem_mmap = (MSM_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 (gem_name == xv_gem_mmap->gem_name[i])
+       goto PASS;
+    }
+    xv_gem_mmap->Ybo[count] = tbm_bo_import(src->bufmgr, gem_name);
+    if (!xv_gem_mmap->Ybo[count]) {
+      GST_ERROR ("[Error] : cannot import bo (key:%d)", gem_name);
+      return 0;
+    }
+    bo_handle = tbm_bo_get_handle (xv_gem_mmap->Ybo[count], TBM_DEVICE_2D);
+    if(!bo_handle.s32)
+    {
+      GST_ERROR ("[Error] : cannot get Ion FD");
+      return 0;
+    }
+    xv_gem_mmap->ion_fd[count] = bo_handle.s32;
+    src->framesize = tbm_bo_size(xv_gem_mmap->Ybo[count]);
+#if 0 //Its no more required with Meta mode Encoder, Need to remove after meta mode verification
+    tbm_bo_handle temp_virtual;
+    temp_virtual = tbm_bo_get_handle (xv_gem_mmap->Ybo[count], TBM_DEVICE_CPU);
+    xv_gem_mmap->virtual_add[count] = temp_virtual.ptr;
+
+    if(!xv_gem_mmap->virtual_add[count])
+    {
+      GST_ERROR ("[Error] : cannot map virtual address");
+      return 0;
+    }
+#endif
+    /*set name*/
+    xv_gem_mmap->gem_name[count] = gem_name;
+  }
+
+  if (count < GEM_NAME_MAX) {
+    count ++;
+    *gemname_cnt = count;
+  }
+PASS:
+  if (gem_name == xv_gem_mmap->gem_name[0]) {
+    //*virtual_address = xv_gem_mmap->virtual_add[0];
+    fd = xv_gem_mmap->ion_fd[0];
+  } else if (gem_name == xv_gem_mmap->gem_name[1]) {
+    //*virtual_address = xv_gem_mmap->virtual_add[1];
+     fd = xv_gem_mmap->ion_fd[1];
+  } else if (gem_name == xv_gem_mmap->gem_name[2]) {
+    //*virtual_address = xv_gem_mmap->virtual_add[2];
+     fd = xv_gem_mmap->ion_fd[2];
+  }
+  GST_DEBUG("ion_fd = %d", fd);
+  return fd;
+}
+#endif
+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) {
+#ifdef ENABLE_QC_SPECIFIC
+    case PROP_SECURE_MODE:
+      src->is_secured_mode = g_value_get_boolean (value);
+      GST_DEBUG("is_secured_mode %d", src->is_secured_mode);
+    break;
+#endif
+    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) {
+#ifdef ENABLE_QC_SPECIFIC
+    case PROP_SECURE_MODE:
+      g_value_set_boolean (value, src->is_secured_mode);
+    break;
+#endif
+    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;
+  GstClock *clock;
+  if (!src || !buffer) {
+    GST_WARNING("Invalid pointer [handle:%p, buffer:%p]", src, buffer);
+    return FALSE;
+  }
+  clock = gst_element_get_clock (GST_ELEMENT (src));
+  if (clock) {
+    timestamp = gst_clock_get_time (clock);
+    timestamp -= gst_element_get_base_time (GST_ELEMENT (src));
+    gst_object_unref (clock);
+  } else {
+    /* not an error not to have a clock */
+    timestamp = GST_CLOCK_TIME_NONE;
+  }
+
+  //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, long duration)
+{
+    GST_INFO("end_time duration=%d", duration);
+    if (duration < 0) return;
+    GstXVImageSrc *src = (GstXVImageSrc *)asrc;
+    g_return_if_fail(src != NULL);
+    long sleep_time = 0;
+    sleep_time = src->sleep_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 <= src->sleep_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) {
+          GST_INFO("end_time : sleep_time = %d", sleep_time);
+          usleep(sleep_time);
+       }
+    }
+}
+static GstFlowReturn
+gst_xv_image_src_create (GstPushSrc * psrc, GstBuffer ** buffer)
+{
+  GST_INFO("gst_xv_image_src_create");
+  GstXVImageSrc *src;
+  GstXvImageOutBuffer *outbuf = NULL;
+  src = GST_XV_IMAGE_SRC (psrc);
+  g_mutex_lock (src->queue_lock);
+  if(g_queue_is_empty (src->queue)) {
+    GST_INFO("g_queue_is_empty");
+    g_mutex_unlock (src->queue_lock);
+    GST_INFO("g_cond_wait");
+    g_cond_wait(src->queue_cond, src->cond_lock);
+    if(src->pause_cond_var) return GST_FLOW_WRONG_STATE;
+    g_mutex_lock (src->queue_lock);
+    outbuf = (GstXvImageOutBuffer *)g_queue_pop_head(src->queue);
+    GST_INFO("g_queue_pop_head");
+    g_mutex_unlock (src->queue_lock);
+  }
+  else {
+    GstXvImageOutBuffer *tempbuf = NULL;
+    if((tempbuf = (GstXvImageOutBuffer*)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);
+    }
+    GST_INFO("g_queue_pop_head end");
+  }
+  if(outbuf == NULL) return GST_FLOW_ERROR;
+  GST_INFO("gem_name=%d, fd_name=%d, Time stamp of the buffer is %"GST_TIME_FORMAT, outbuf->YBuf, outbuf->fd_name, GST_TIME_ARGS(GST_BUFFER_TIMESTAMP(outbuf)));
+  *buffer = GST_BUFFER_CAST(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
+  GST_INFO("return ok");
+  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 int framecount=0;
+static void* gst_xv_image_src_update_thread (void * asrc)
+{
+  GstXVImageSrc *src = (GstXVImageSrc *)asrc;
+  Atom atom_data_type = 0;
+  Atom atom_secure = 0, atom_capture=0, atom_display=0;
+  Atom atom_fps = 0;
+  g_return_val_if_fail((src != NULL),NULL);
+  int i=0;
+#ifdef ENABLE_QC_SPECIFIC
+  Atom atom_rotate=0;
+  MSM_GEM_MMAP *xv_gem_mmap = NULL;
+  xv_gem_mmap = (MSM_GEM_MMAP *)malloc(sizeof(MSM_GEM_MMAP));
+  g_return_val_if_fail((xv_gem_mmap != NULL),NULL);
+
+  memset(xv_gem_mmap, 0, sizeof(MSM_GEM_MMAP));
+#else
+  struct drm_gem_close gem_close;
+  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));
+#endif
+  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, 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);
+    atom_capture = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_CAPTURE", False);
+    atom_display = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_DISPLAY", False);
+#ifdef ENABLE_QC_SPECIFIC
+    atom_rotate = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_ROTATE_OFF", False);
+#endif
+    /*get data type*/
+    atom_data_type = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_DATA_TYPE", False);
+    /* _USER_WM_PORT_ATTRIBUTE_STREAM_OFF is removed */
+    //src->atom_stream_off = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_STREAM_OFF", False);
+    XvSetPortAttribute (src->dpy, src->p, atom_format, src->format_id);
+    XvSetPortAttribute (src->dpy, src->p, atom_capture, 2);
+    XvSetPortAttribute (src->dpy, src->p, atom_display, 1);
+#ifdef ENABLE_QC_SPECIFIC
+    XvSetPortAttribute (src->dpy, src->p, atom_rotate, 0);
+#endif
+
+#ifdef ENABLE_QC_SPECIFIC
+    /* To be enabled for secure mode when msm is delivered */
+    if(src->is_secured_mode) {
+      atom_secure = XInternAtom (src->dpy, "_USER_WM_PORT_ATTRIBUTE_SECURE", False);
+      XvSetPortAttribute (src->dpy, src->p, atom_secure, 1);
+    }
+#endif
+    XvSelectPortNotify (src->dpy, src->p, 1);
+    XvGetPortAttribute (src->dpy, src->p, atom_data_type, &(src->new_data_type));
+  }
+
+  struct timeval start_time, end_time;
+  long duration;
+  long starttime, endtime;
+  GTimeVal timeout;
+  XEvent ev;
+  int eventcount = 0;
+  void *virtual_address = NULL;
+  int (*handler) (Display *, XErrorEvent *);
+  GstXvImageOutBuffer *outbuf = NULL;
+
+  while(!src->thread_return) {
+    if(src->pause_cond_var == TRUE) {
+      g_cond_wait(src->pause_cond,src->pause_cond_lock);
+    }
+
+    duration = 0;
+    starttime =0;
+    endtime = 0;
+    start_time.tv_sec = 0;
+    start_time.tv_usec = 0;
+    end_time.tv_sec     = 0;
+    end_time.tv_usec = 0;
+    gettimeofday(&start_time, NULL);
+
+    eventcount = 0;
+    virtual_address = NULL;
+    duration = 0;
+    outbuf = NULL;
+    g_mutex_lock (src->dpy_lock);
+    XSync(src->dpy, 0);
+    GST_INFO ("gst_xv_image_src_update_thread XSync@@ !!");
+    g_mutex_unlock (src->dpy_lock);
+    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 XvPutStill in !!");
+    g_mutex_lock (src->dpy_lock);
+    XvPutStill (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 XvPutStill !!");
+    XSync (src->dpy, 0);
+    g_mutex_unlock (src->dpy_lock);
+    if (error_caught) {
+      GST_ERROR("gst_xv_image_src_update_thread error_caught is TRUE, X is out of buffers");
+           error_caught = FALSE;
+           XSetErrorHandler(handler);
+      g_get_current_time(&timeout);
+      g_time_val_add(&timeout, BUFFER_COND_WAIT_TIMEOUT);
+      if(!g_cond_timed_wait(src->buffer_cond, src->buffer_cond_lock, &timeout)) {
+             GST_ERROR("skip wating");
+      } else {
+         GST_ERROR("Signal received");
+      }
+      continue;
+    }
+    /*reset error handler*/
+    error_caught = FALSE;
+    XSetErrorHandler(handler);
+
+    GST_INFO ("gst_xv_image_src_update_thread XSync !!");
+next_event:
+    g_mutex_lock (src->dpy_lock);
+    GST_INFO("XNextEvent in");
+    XNextEvent (src->dpy, &ev); /* wating for x event */
+    GST_INFO("XNextEvent out");
+    g_mutex_unlock (src->dpy_lock);
+    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");
+      g_mutex_lock (src->dpy_lock);
+      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 );
+      g_mutex_unlock (src->dpy_lock);
+      GST_INFO ("gst_xv_image_src_update_thread XDamageSubtract");
+    }
+    else if (ev.type == (src->evt_base + XvPortNotify)) {
+      XvPortNotifyEvent *notify_ev = (XvPortNotifyEvent*)&ev;
+#ifndef ENABLE_QC_SPECIFIC
+      if (notify_ev->attribute == atom_secure) {
+          GST_WARNING ("secure attr changed : %s \n", ((int)notify_ev->value)?"Secure":"Normal");
+          src->tz_enable = (int)notify_ev->value;
+          GST_ERROR("src->tz_enable = %d", src->tz_enable);
+      }
+      else 
+#endif
+      if (notify_ev->attribute == atom_data_type) {
+        /* got a port notify, data_type */
+        src->new_data_type = (int)notify_ev->value;
+        if (src->current_data_type != src->new_data_type) {
+          src->current_data_type = src->new_data_type;
+          GST_WARNING("current_data_type : %s \n", (src->current_data_type)?"Video":"UI+Video");
+          g_timeout_add(1, signal_emit_func, src);
+        }
+      }
+      goto next_event;
+    }
+
+    if(!src->virtual) continue;
+    if(src->format_id == FOURCC_RGB32) {
+      outbuf = (GstXvImageOutBuffer*)gst_buffer_new_and_alloc (src->framesize);
+      gst_buffer_set_caps (GST_BUFFER_CAST(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) || (src->format_id == FOURCC_NV12)) {
+      XV_DATA_PTR data = (XV_DATA_PTR)src->virtual;
+      int error = XV_VALIDATE_DATA (data);
+      outbuf = gst_xv_image_out_buffer_new(src);
+      if(!outbuf)
+      {
+        GST_ERROR("Out of memory");
+        continue;
+      }
+      gst_buffer_set_caps (GST_BUFFER_CAST(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)
+        {
+#ifdef ENABLE_QC_SPECIFIC
+          psimgb->fd[0] = msm_convert_gem_to_fd(src, &src->gemname_cnt, data->YBuf, xv_gem_mmap);
+          GST_DEBUG("YBuf gem=%d to fd[0]=%d", data->YBuf, psimgb->fd[0]);
+                         psimgb->buf_share_method = 1;//BUF_SHARE_METHOD_FD;
+#else
+          psimgb->fd[0] = drm_convert_gem_to_fd(&src->gemname_cnt, src->drm_fd, (void *)data->YBuf, xv_gem_mmap, &virtual_address);
+          if(!virtual_address) continue;
+          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);
+          if(!virtual_address) continue;
+          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[1] = src->width;
+          psimgb->h[1] = src->height >> 1;
+          psimgb->s[1] = GST_ROUND_UP_16(psimgb->w[1]);
+          psimgb->e[1] = GST_ROUND_UP_16(psimgb->h[1]);
+          psimgb->cs   = SCMN_CS_NV12;
+          psimgb->tz_enable = 0;
+#endif
+        }
+        psimgb->w[0] = src->width;
+        psimgb->h[0] = src->height;
+        psimgb->s[0] = GST_ROUND_UP_16(psimgb->w[0]);
+        psimgb->e[0] = GST_ROUND_UP_16(psimgb->h[0]);
+        outbuf->fd_name = psimgb->fd[0];
+        GST_BUFFER_MALLOCDATA(outbuf) = (unsigned char*)psimgb;
+        GST_BUFFER_DATA(outbuf) = src->virtual;
+        outbuf->YBuf = data->YBuf;
+           outbuf->fd_name = psimgb->fd[0];
+#ifdef DEBUG_BUFFER
+        for ( i=0; i<5 ; i++) {
+         if(value[value_count] == outbuf->YBuf ) {
+           GST_ERROR("ERROR: value[%d](%d)==YBUf(%d)", value_count, value[value_count], outbuf->YBuf);
+         }
+        }
+        value[value_count] = outbuf->YBuf ;
+           GST_ERROR("value[%d]=%d", value_count, value[value_count]);
+           if( value_count < 4){
+             value_count ++;
+           } else {
+             value_count = 0;
+           }
+#endif
+      }
+    }
+  if(!outbuf) continue;
+       GST_BUFFER_SIZE (outbuf) = src->framesize;
+    gst_xv_image_src_get_timeinfo(src, GST_BUFFER_CAST(outbuf));
+    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);
+    GST_INFO("g_queue_push_tail");
+    g_mutex_unlock (src->queue_lock);
+    g_cond_signal(src->queue_cond);
+    GST_INFO("g_cond_signal");
+
+    update_done:
+      if (src->virtual) tbm_bo_unmap(src->bo);
+      src->virtual = NULL;
+      GST_INFO("g_cond_signal");
+      if (src->bo) tbm_bo_unref(src->bo);
+      src->bo = NULL;
+      if (src->dri2_buffers) free(src->dri2_buffers);
+      src->dri2_buffers = NULL;
+      gettimeofday(&end_time, NULL);
+      starttime = start_time.tv_usec;
+      endtime =  end_time.tv_usec;
+      GST_INFO("star_time: %d, end_time:%d", starttime, endtime);
+      if (endtime > starttime) {
+        GST_INFO("end_time > start_time");
+        duration = endtime - starttime;
+        } else {
+        GST_INFO("end_time.tv_usec < start_time.tv_usec");
+        endtime=endtime+1000000;
+        GST_INFO("end_time =%d", endtime);
+        duration = endtime -starttime;
+      }
+      GST_INFO("end_time duration = %d", duration);
+      if (src->sleep_base_time > duration)
+        gst_xv_get_image_sleep (src, duration);
+      GST_INFO("gst_xv_image_src_update_thread cleanup !!");
+  }
+#ifndef ENABLE_QC_SPECIFIC
+  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;
+      }
+    }
+    if (xv_gem_mmap->handle[i]) {
+       gem_close.handle = xv_gem_mmap->handle[i];
+       if (ioctl(src->drm_fd, DRM_IOCTL_GEM_CLOSE, &gem_close)) {
+         GST_ERROR("Gem Close failed");
+       }
+    }
+    if (xv_gem_mmap->fd[i]) {
+      close(xv_gem_mmap->fd[i]);
+    }
+  }
+  if (xv_gem_mmap) {
+    free(xv_gem_mmap);
+    xv_gem_mmap = NULL;
+  }
+#else
+  for ( i=0 ; i < GEM_NAME_MAX ; i++) {
+    if (xv_gem_mmap->Ybo[i]) {
+      tbm_bo_unref(xv_gem_mmap->Ybo[i]);
+      xv_gem_mmap->Ybo[i] = NULL;
+    }
+  }
+  if (xv_gem_mmap) {
+    free(xv_gem_mmap);
+    xv_gem_mmap = NULL;
+  }
+#endif
+  GST_LOG_OBJECT (src, "The thread function cleanup");
+
+  XvStopVideo(src->dpy, src->p, src->pixmap);
+
+  if (src->bufmgr) {
+    tbm_bufmgr_deinit (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");
+
+  XvStopVideo(src->dpy, src->p, src->pixmap);
+
+  if (src->bufmgr) tbm_bufmgr_deinit (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 tbm_bufmgr bufmgr_get (Display *dpy, Pixmap pixmap)
+{
+  int screen;
+  int drm_fd;
+  tbm_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);
+  if(!deviceName) return NULL;
+
+  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 = tbm_bufmgr_init (drm_fd);
+  if (!bufmgr) {
+    GST_ERROR ("!!Error : fail to init buffer manager ");
+    close (drm_fd);
+    return NULL;
+  }
+  DRI2CreateDrawable (dpy, pixmap);
+  return bufmgr;
+}
+
+static int port_get (GstXVImageSrc * src, unsigned int id)
+{
+  unsigned int ver, rev, req_base, err_base;
+  unsigned int adaptors;
+  XvAdaptorInfo *ai = NULL;
+  XvAttribute *at = NULL;
+  XvImageFormatValues *fo = NULL;
+  int attributes, formats;
+  int i, j, p;
+
+  if (XvQueryExtension (src->dpy, &ver, &rev, &req_base, &src->evt_base, &err_base) != Success) return -1;
+  if (XvQueryAdaptors (src->dpy, DefaultRootWindow (src->dpy), &adaptors, &ai) != Success) return -1;
+  if (!ai) return -1;
+  for (i = 0; i < adaptors; i++) {
+    int support_format = False;
+    if (!(ai[i].type & XvInputMask) || !(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 (src->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 (src->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 (src->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, tbm_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;
+  tbm_bo_handle temp_virtual;
+  attachments[0] = DRI2BufferFrontLeft;
+  dri2_count = 1;
+  GST_DEBUG ("DRI2GetBuffers");
+  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;
+  }
+  GST_DEBUG ("tbm_bo_import");
+  src->bo = tbm_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 = TBM_OPTION_READ|TBM_OPTION_WRITE;
+  GST_DEBUG ("tbm_bo_map");
+  temp_virtual = tbm_bo_map (src->bo, TBM_DEVICE_CPU, opt);
+  src->virtual = temp_virtual.ptr;
+  if (!src->virtual) {
+    GST_ERROR ("[Error] : fail to map ");
+    goto update_done;
+  }
+  return;
+update_done:
+  if (src->virtual) tbm_bo_unmap(src->bo);
+  src->virtual = NULL;
+  if (src->bo) tbm_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()");
+  g_cond_signal(src->queue_cond);
+  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/wearable/xvimagesrc/src/gstxvimagesrc.h b/wearable/xvimagesrc/src/gstxvimagesrc.h
new file mode 100755 (executable)
index 0000000..8ea8990
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * 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 <tbm_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_NV12         FOURCC('N','V','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;
+  unsigned int evt_base;
+  tbm_bufmgr bufmgr;
+  void *virtual;
+  tbm_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;
+  GCond *buffer_cond;
+  gboolean pause_cond_var;
+  GCond *pause_cond;
+  GMutex *pause_cond_lock;
+  GMutex *buffer_cond_lock;
+  GMutex *dpy_lock;
+  gint drm_fd;
+  gboolean is_secured_mode;
+  int current_data_type;
+  int new_data_type;
+  double get_image_overtime;
+  int get_image_overtime_cnt;
+  int gemname_cnt;
+  int tz_enable;
+  long sleep_base_time;
+  long sleep_limit_time;
+
+};
+
+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/wearable/xvimagesrc/src/xv_types.h b/wearable/xvimagesrc/src/xv_types.h
new file mode 100644 (file)
index 0000000..99fda51
--- /dev/null
@@ -0,0 +1,89 @@
+/**************************************************************************
+
+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_TYPE_H__
+#define __XV_TYPE_H__
+
+#define XV_DATA_HEADER 0xDEADCD01
+#define XV_DATA_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_DATA, * XV_DATA_PTR;
+
+static void
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_INIT_DATA (XV_DATA_PTR data)
+{
+    data->_header = XV_DATA_HEADER;
+    data->_version = XV_DATA_VERSION;
+}
+
+static int
+#ifdef __GNUC__
+__attribute__ ((unused))
+#endif
+XV_VALIDATE_DATA (XV_DATA_PTR data)
+{
+    if (data->_header != XV_DATA_HEADER)
+        return XV_HEADER_ERROR;
+    if (data->_version != XV_DATA_VERSION)
+        return XV_VERSION_MISMATCH;
+    return XV_OK;
+}
+
+#endif
+