diff --git a/LICENSE b/LICENSE index 8d2aa962f4..46a2c712e9 100644 --- a/LICENSE +++ b/LICENSE @@ -1595,15 +1595,6 @@ Files: libs/silk/* Copyright: 2006-2011, Skype Limited. License: BSD-2-clause -Files: libs/libdingaling/* -Copyright: 2005-2014, Anthony Minessale II - 2001-2003 Allan Saddi -License: MPL-1.1 - -Files: libs/libdingaling/src/sha1.[ch] -Copyright: 2001-2003 Allan Saddi -License: BSD-2-clause - Files: libs/libcodec2/* Copyright: 1990-2010 David Rowe 1990-2010 David Rowe 2009 diff --git a/Makefile.am b/Makefile.am index 815eafd188..f869072ff7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -685,7 +685,7 @@ yesdepends: rm .nodepends iksemel-dep: - make -C src/mod/endpoints/mod_dingaling deps + make -C src/mod/formats/mod_ssml deps core: $(switch_builddir)/modules.conf src/include/switch_version.h $(CORE_LIBS) $(MAKE) $(AM_MAKEFLAGS) libfreeswitch.la @@ -765,7 +765,7 @@ iks-reconf: cd libs/iksemel && $(MAKE) clean cd libs/iksemel && autoreconf -fi cd libs/iksemel && sh ./configure.gnu $(MY_DEFAULT_ARGS) - $(MAKE) mod_dingaling-clean + $(MAKE) mod_ssml-clean cluecon: @clear diff --git a/bootstrap.sh b/bootstrap.sh index 46e09f3537..a68a0624ac 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -10,7 +10,7 @@ BGJOB=false VERBOSE=false BASEDIR=`pwd`; LIBDIR=${BASEDIR}/libs; -SUBDIRS="apr libzrtp iksemel libdingaling srtp unimrcp fs"; +SUBDIRS="apr libzrtp iksemel srtp unimrcp fs"; while getopts 'jhd:v' o; do case "$o" in diff --git a/build/modules.conf.in b/build/modules.conf.in index feb902994b..ab50bd53dc 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -87,7 +87,6 @@ dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_xml #directories/mod_ldap #endpoints/mod_alsa -#endpoints/mod_dingaling #endpoints/mod_gsmopen #endpoints/mod_h323 #endpoints/mod_khomp diff --git a/build/modules.conf.most b/build/modules.conf.most index a981c273db..86063db582 100644 --- a/build/modules.conf.most +++ b/build/modules.conf.most @@ -84,7 +84,6 @@ dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml directories/mod_ldap #endpoints/mod_alsa -endpoints/mod_dingaling #endpoints/mod_gsmopen #endpoints/mod_h323 #endpoints/mod_khomp diff --git a/conf/curl/autoload_configs/dingaling.conf.xml b/conf/curl/autoload_configs/dingaling.conf.xml deleted file mode 100644 index e68c8b4b44..0000000000 --- a/conf/curl/autoload_configs/dingaling.conf.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/configure.ac b/configure.ac index 6d8d140a60..24e838731a 100644 --- a/configure.ac +++ b/configure.ac @@ -1088,7 +1088,7 @@ if test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then fi # Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready -# Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_dingaling mod_opal mod_h323 mod_khomp +# Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_opal mod_h323 mod_khomp # mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed # #saved_CFLAGS="$CFLAGS" @@ -2173,7 +2173,6 @@ AC_CONFIG_FILES([Makefile src/mod/dialplans/mod_dialplan_xml/Makefile src/mod/directories/mod_ldap/Makefile src/mod/endpoints/mod_alsa/Makefile - src/mod/endpoints/mod_dingaling/Makefile src/mod/endpoints/mod_gsmopen/Makefile src/mod/endpoints/mod_h323/Makefile src/mod/endpoints/mod_khomp/Makefile @@ -2332,7 +2331,6 @@ if test "$use_system_apr" != "yes"; then AC_CONFIG_SUBDIRS([libs/apr]) fi AC_CONFIG_SUBDIRS([libs/iksemel]) -#AC_CONFIG_SUBDIRS([libs/libdingaling]) #AC_CONFIG_SUBDIRS([libs/unimrcp]) if test "x${enable_zrtp}" = "xyes"; then AC_CONFIG_SUBDIRS([libs/libzrtp]) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index fd5ff75cf0..ba94c9d1ce 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -657,7 +657,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-dialplan-asterisk (= \${binary:Version}), freeswitch-mod-dialplan-directory (= \${binary:Version}), freeswitch-mod-dialplan-xml (= \${binary:Version}), - freeswitch-mod-dingaling (= \${binary:Version}), freeswitch-mod-loopback (= \${binary:Version}), freeswitch-mod-portaudio (= \${binary:Version}), freeswitch-mod-rtc (= \${binary:Version}), @@ -896,7 +895,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-dialplan-asterisk-dbg (= \${binary:Version}), freeswitch-mod-dialplan-directory-dbg (= \${binary:Version}), freeswitch-mod-dialplan-xml-dbg (= \${binary:Version}), - freeswitch-mod-dingaling-dbg (= \${binary:Version}), freeswitch-mod-loopback-dbg (= \${binary:Version}), freeswitch-mod-portaudio-dbg (= \${binary:Version}), freeswitch-mod-rtc-dbg (= \${binary:Version}), diff --git a/debian/control-modules b/debian/control-modules index a3b53790a4..f438d0277d 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -431,10 +431,6 @@ Description: mod_alsa Adds mod_alsa. Build-Depends: libasound2-dev -Module: endpoints/mod_dingaling -Description: mod_dingaling - Adds mod_dingaling. - Module: endpoints/mod_gsmopen Description: mod_gsmopen Adds mod_gsmopen. diff --git a/debian/copyright b/debian/copyright index 6745df1f35..af7a6fe152 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1595,15 +1595,6 @@ Files: libs/silk/* Copyright: 2006-2011, Skype Limited. License: BSD-2-clause -Files: libs/libdingaling/* -Copyright: 2005-2014, Anthony Minessale II - 2001-2003 Allan Saddi -License: MPL-1.1 - -Files: libs/libdingaling/src/sha1.[ch] -Copyright: 2001-2003 Allan Saddi -License: BSD-2-clause - Files: libs/libcodec2/* Copyright: 1990-2010 David Rowe 1990-2010 David Rowe 2009 diff --git a/freeswitch.spec b/freeswitch.spec index 19a7dd5516..7bdb8eaec6 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -841,15 +841,6 @@ PostgreSQL native support for FreeSWITCH. # FreeSWITCH Endpoint Modules ###################################################################################################################### -%package endpoint-dingaling -Summary: Generic XMPP support for FreeSWITCH open source telephony platform -Group: System/Libraries -Requires: %{name} = %{version}-%{release} - -%description endpoint-dingaling -XMPP support for FreeSWITCH open source telephony platform. Allows FreeSWITCH -to be used as a client for GoogleTalk or other XMPP Servers. - #%package endpoint-gsmopen #Summary: Generic GSM endpoint support for FreeSWITCH open source telephony platform #Group: System/Libraries @@ -1485,7 +1476,7 @@ DIRECTORIES_MODULES="" # Endpoints # ###################################################################################################################### -ENDPOINTS_MODULES="endpoints/mod_dingaling \ +ENDPOINTS_MODULES=" \ endpoints/mod_loopback endpoints/mod_portaudio endpoints/mod_rtmp \ endpoints/mod_skinny endpoints/mod_verto endpoints/mod_rtc endpoints/mod_sofia" @@ -1920,7 +1911,6 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/curl.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/db.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/dialplan_directory.conf.xml -%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/dingaling.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/directory.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/distributor.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/easyroute.conf.xml @@ -2258,9 +2248,6 @@ fi # ###################################################################################################################### -%files endpoint-dingaling -%{MODINSTDIR}/mod_dingaling.so* - #%files endpoint-gsmopen #%{MODINSTDIR}/mod_gsmopen.so* diff --git a/libs/.gitignore b/libs/.gitignore index 7fbd445cf3..cb4112eb88 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -199,11 +199,6 @@ opal /libcodec2/unittest/vqtrainjnd /libcodec2/unittest/vqtrainph /libcodec2/unittest/vqtrainsp -/libdingaling/build/compile -/libdingaling/Makefile -/libdingaling/Makefile.in -/libdingaling/src/config.h -/libdingaling/src/stamp-h1 /libg722_1/config-h.in /libg722_1/doc/Makefile /libg722_1/doc/Makefile.in @@ -702,12 +697,6 @@ opal # build products we should remove !/iksemel/ltmain.sh -!/libdingaling/config.guess -!/libdingaling/config.sub -!/libdingaling/depcomp -!/libdingaling/install-sh -!/libdingaling/ltmain.sh -!/libdingaling/missing !/libg722_1/config/depcomp !/libg722_1/config/missing !/tiff-*/config/depcomp @@ -730,7 +719,6 @@ unimrcp/build/compile portaudio.*.log apr/configure iksemel/configure -libdingaling/configure libyuv/Makefile libyuv/convert srtp/configure diff --git a/libs/libdingaling/.update b/libs/libdingaling/.update deleted file mode 100644 index 84faa7df3c..0000000000 --- a/libs/libdingaling/.update +++ /dev/null @@ -1 +0,0 @@ -Fri Mar 9 17:53:09 CST 2007 diff --git a/libs/libdingaling/AUTHORS b/libs/libdingaling/AUTHORS deleted file mode 100644 index 3d05d943aa..0000000000 --- a/libs/libdingaling/AUTHORS +++ /dev/null @@ -1,18 +0,0 @@ -The Initial Developer of the Original Code is -Anthony Minessale II -Portions created by the Initial Developer are Copyright (C) -the Initial Developer. All Rights Reserved. - -The PRIMARY AUTHORS are (and/or have been): - - Anthony Minessale II - Primary developer of all core components - and many of the included modules. Much of freeswitch is based on his work. - - Michael Jerris - Windows porter and responsible for the - windows\msvc build system. - - -And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- -people who have submitted patches, reported bugs, and generally made Freeswitch -that much better: - diff --git a/libs/libdingaling/COPYING b/libs/libdingaling/COPYING deleted file mode 100644 index 1bf2b1279d..0000000000 --- a/libs/libdingaling/COPYING +++ /dev/null @@ -1,471 +0,0 @@ - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - - diff --git a/libs/libdingaling/ChangeLog b/libs/libdingaling/ChangeLog deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libs/libdingaling/INSTALL b/libs/libdingaling/INSTALL deleted file mode 100644 index 095b1eb406..0000000000 --- a/libs/libdingaling/INSTALL +++ /dev/null @@ -1,231 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 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' will install the package's files in -`/usr/local/bin', `/usr/local/man', 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 -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. -Documentation and other data files will 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 `--target=TYPE' option 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 - -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). - -`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/libs/libdingaling/Makefile.am b/libs/libdingaling/Makefile.am deleted file mode 100644 index 37bf42cb31..0000000000 --- a/libs/libdingaling/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -EXTRA_DIST = -SUBDIRS = -AUTOMAKE_OPTIONS = foreign -NAME=dingaling -PREFIX=$(prefix) -TOUCH_TARGET=@if test -f "$@" ; then touch "$@" ; fi ; - -AM_CFLAGS = $(new_AM_CFLAGS) -I./src -I$(prefix)/include -AM_CPPFLAGS = $(AM_CFLAGS) -AM_LDFLAGS = $(new_AM_LDFLAGS) - -AM_CFLAGS += `../apr/apr-1-config --cflags --cppflags --includes || $(prefix)/bin/apr-1-config --cflags --cppflags --includes` -AM_CFLAGS += `../apr-util/apu-1-config --includes || $(prefix)/bin/apu-1-config --includes` -AM_CFLAGS += -I../iksemel/include - -lib_LTLIBRARIES = libdingaling.la -libdingaling_la_SOURCES = src/libdingaling.c src/sha1.c -libdingaling_la_CFLAGS = $(AM_CFLAGS) -libdingaling_la_LDFLAGS = $(AM_LDFLAGS) -libdingaling_la_LIBADD = ../iksemel/src/libiksemel.la ../apr/libapr-1.la ../apr-util/libaprutil-1.la -library_includedir = $(prefix)/include -library_include_HEADERS = src/libdingaling.h - -$(libdingaling_la_SOURCES): $(libdingaling_la_LIBADD) - -../apr/libapr-1.la: ../apr ../apr/.update - cd ../apr && $(MAKE) - $(TOUCH_TARGET) - -../apr-util/libaprutil-1.la: ../apr-util ../apr-util/.update - cd ../apr-util && $(MAKE) - $(TOUCH_TARGET) - -../iksemel/src/libiksemel.la: ../iksemel ../iksemel/.update - cd ../iksemel && $(MAKE) - $(TOUCH_TARGET) - -dox: - cd docs && doxygen $(PWD)/docs/Doxygen.conf - -doxclean: - rm -fr docs/html/ docs/man/ docs/perlmod/ docs/xml/ diff --git a/libs/libdingaling/NEWS b/libs/libdingaling/NEWS deleted file mode 100644 index eef3e09d2b..0000000000 --- a/libs/libdingaling/NEWS +++ /dev/null @@ -1 +0,0 @@ -Developed on UNIX where the motto is "no news is good news!". diff --git a/libs/libdingaling/README b/libs/libdingaling/README deleted file mode 100644 index 95e0a39bcf..0000000000 --- a/libs/libdingaling/README +++ /dev/null @@ -1,8 +0,0 @@ -Install is common: - -./configure --with-prefix= -make -make install - - - diff --git a/libs/libdingaling/acsite.m4 b/libs/libdingaling/acsite.m4 deleted file mode 100644 index 80f8cf4138..0000000000 --- a/libs/libdingaling/acsite.m4 +++ /dev/null @@ -1,6 +0,0 @@ -m4_include([build/config/ax_compiler_vendor.m4]) -m4_include([build/config/ax_cflags_warn_all_ansi.m4]) -m4_include([build/config/ax_cc_maxopt.m4]) -m4_include([build/config/ax_check_compiler_flags.m4]) -m4_include([build/config/ac_gcc_archflag.m4]) -m4_include([build/config/ac_gcc_x86_cpuid.m4]) diff --git a/libs/libdingaling/build/config/ac_cflags_gcc_option.m4 b/libs/libdingaling/build/config/ac_cflags_gcc_option.m4 deleted file mode 100644 index e651a5e6c5..0000000000 --- a/libs/libdingaling/build/config/ac_cflags_gcc_option.m4 +++ /dev/null @@ -1,142 +0,0 @@ -AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl ------------------------------------------------------------------------- - -AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl -AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) - m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl -AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) - m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, -[AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])]) - -AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, -[AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])]) - diff --git a/libs/libdingaling/build/config/ac_cflags_sun_option.m4 b/libs/libdingaling/build/config/ac_cflags_sun_option.m4 deleted file mode 100644 index a09e6fb695..0000000000 --- a/libs/libdingaling/build/config/ac_cflags_sun_option.m4 +++ /dev/null @@ -1,140 +0,0 @@ -AC_DEFUN([AX_CFLAGS_SUN_OPTION_OLD], [dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$2])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "+xstrconst % -xc99=all m4_ifval($2,$2,-option)" dnl Solaris C - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_OLD], [dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$2])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "+xstrconst % -xc99=all m4_ifval($2,$2,-option)" dnl Solaris C - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl ----------------------------------------------------------------------- - -AC_DEFUN([AX_CFLAGS_SUN_OPTION_NEW], [dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$1])dnl -AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "+xstrconst % -xc99=all m4_ifval($1,$1,-option)" dnl Solaris C - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) - m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_NEW], [dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$1])dnl -AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "+xstrconst % -xc99=all m4_ifval($1,$1,-option)" dnl Solaris C - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) - m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -AC_DEFUN([AX_CFLAGS_SUN_OPTION],[ifelse(m4_regexp([$2],[-]),-1, -[AX_CFLAGS_SUN_OPTION_NEW($@)],[AX_CFLAGS_SUN_OPTION_OLD($@)])]) - -AC_DEFUN([AX_CXXFLAGS_SUN_OPTION],[ifelse(m4_regexp([$2],[-]),-1, -[AX_CXXFLAGS_SUN_OPTION_NEW($@)],[AX_CXXFLAGS_SUN_OPTION_OLD($@)])]) - diff --git a/libs/libdingaling/build/config/ac_gcc_archflag.m4 b/libs/libdingaling/build/config/ac_gcc_archflag.m4 deleted file mode 100644 index b38a564902..0000000000 --- a/libs/libdingaling/build/config/ac_gcc_archflag.m4 +++ /dev/null @@ -1,148 +0,0 @@ -AC_DEFUN([AX_GCC_ARCHFLAG], -[AC_REQUIRE([AC_PROG_CC]) - -AC_ARG_WITH(gcc-arch, [AC_HELP_STRING([--with-gcc-arch=], [use architecture for gcc -march/-mtune, instead of guessing])], - ax_gcc_arch=$withval, ax_gcc_arch=yes) - -AC_MSG_CHECKING([for gcc architecture flag]) -AC_MSG_RESULT([]) -AC_CACHE_VAL(ax_cv_gcc_archflag, -[ -ax_cv_gcc_archflag="unknown" - -if test "$GCC" = yes; then - -if test "x$ax_gcc_arch" = xyes; then -ax_gcc_arch="" -if test "$cross_compiling" = no; then -case $host_cpu in - i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones - AX_GCC_X86_CPUID(0) - AX_GCC_X86_CPUID(1) - case $ax_cv_gcc_x86_cpuid_0 in - *:756e6547:*:*) # Intel - case $ax_cv_gcc_x86_cpuid_1 in - *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; - *5??:*:*:*) ax_gcc_arch=pentium ;; - *6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; - *6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6??:*:*:*) ax_gcc_arch=pentiumpro ;; - *f3[[347]]:*:*:*|*f4[1347]:*:*:*) - case $host_cpu in - x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; - *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; - esac ;; - *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; - esac ;; - *:68747541:*:*) # AMD - case $ax_cv_gcc_x86_cpuid_1 in - *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;; - *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;; - *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;; - *60?:*:*:*) ax_gcc_arch=k7 ;; - *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;; - *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;; - *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;; - *6[[68a]]?:*:*:*) - AX_GCC_X86_CPUID(0x80000006) # L2 cache size - case $ax_cv_gcc_x86_cpuid_0x80000006 in - *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256 - ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; - *) ax_gcc_arch="athlon-4 athlon k7" ;; - esac ;; - *f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; - *f5?:*:*:*) ax_gcc_arch="opteron k8" ;; - *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; - *f??:*:*:*) ax_gcc_arch="k8" ;; - esac ;; - *:746e6543:*:*) # IDT - case $ax_cv_gcc_x86_cpuid_1 in - *54?:*:*:*) ax_gcc_arch=winchip-c6 ;; - *58?:*:*:*) ax_gcc_arch=winchip2 ;; - *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;; - *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;; - esac ;; - esac - if test x"$ax_gcc_arch" = x; then # fallback - case $host_cpu in - i586*) ax_gcc_arch=pentium ;; - i686*) ax_gcc_arch=pentiumpro ;; - esac - fi - ;; - - sparc*) - AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/]) - cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null` - cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters` - case $cputype in - *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;; - *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;; - *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;; - *supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;; - *hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;; - *cypress*) ax_gcc_arch=cypress ;; - esac ;; - - alphaev5) ax_gcc_arch=ev5 ;; - alphaev56) ax_gcc_arch=ev56 ;; - alphapca56) ax_gcc_arch="pca56 ev56" ;; - alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;; - alphaev6) ax_gcc_arch=ev6 ;; - alphaev67) ax_gcc_arch=ev67 ;; - alphaev68) ax_gcc_arch="ev68 ev67" ;; - alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;; - alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;; - alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;; - - powerpc*) - cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null` - cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'` - case $cputype in - *750*) ax_gcc_arch="750 G3" ;; - *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;; - *74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;; - *74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;; - *970*) ax_gcc_arch="970 G5 power4";; - *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";; - *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";; - 603ev|8240) ax_gcc_arch="$cputype 603e 603";; - *) ax_gcc_arch=$cputype ;; - esac - ax_gcc_arch="$ax_gcc_arch powerpc" - ;; -esac -fi # not cross-compiling -fi # guess arch - -if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then -for arch in $ax_gcc_arch; do - if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code - flags="-mtune=$arch" - # -mcpu=$arch and m$arch generate nonportable code on every arch except - # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr. - case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac - else - flags="-march=$arch -mcpu=$arch -m$arch" - fi - for flag in $flags; do - AX_CHECK_COMPILER_FLAGS($flag, [ax_cv_gcc_archflag=$flag; break]) - done - test "x$ax_cv_gcc_archflag" = xunknown || break -done -fi - -fi # $GCC=yes -]) -AC_MSG_CHECKING([for gcc architecture flag]) -AC_MSG_RESULT($ax_cv_gcc_archflag) -if test "x$ax_cv_gcc_archflag" = xunknown; then - m4_default([$3],:) -else - m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"]) -fi -]) - diff --git a/libs/libdingaling/build/config/ac_gcc_x86_cpuid.m4 b/libs/libdingaling/build/config/ac_gcc_x86_cpuid.m4 deleted file mode 100644 index 3cf22d0dde..0000000000 --- a/libs/libdingaling/build/config/ac_gcc_x86_cpuid.m4 +++ /dev/null @@ -1,21 +0,0 @@ -AC_DEFUN([AX_GCC_X86_CPUID], -[AC_REQUIRE([AC_PROG_CC]) -AC_LANG_PUSH([C]) -AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1, - [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [ - int op = $1, eax, ebx, ecx, edx; - FILE *f; - __asm__("cpuid" - : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) - : "a" (op)); - f = fopen("conftest_cpuid", "w"); if (!f) return 1; - fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); - fclose(f); - return 0; -])], - [ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid], - [ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid], - [ax_cv_gcc_x86_cpuid_$1=unknown])]) -AC_LANG_POP([C]) -]) - diff --git a/libs/libdingaling/build/config/ac_prog_gzip.m4 b/libs/libdingaling/build/config/ac_prog_gzip.m4 deleted file mode 100644 index f37a4cc9ce..0000000000 --- a/libs/libdingaling/build/config/ac_prog_gzip.m4 +++ /dev/null @@ -1,9 +0,0 @@ -AC_DEFUN([AC_PROG_GZIP],[ -AC_CHECK_PROGS(gzip,[gzip],no) -export gzip; -if test $gzip = "no" ; -then - AC_MSG_ERROR([Unable to find the gzip application]); -fi -AC_SUBST(gzip) -]) diff --git a/libs/libdingaling/build/config/ac_prog_wget.m4 b/libs/libdingaling/build/config/ac_prog_wget.m4 deleted file mode 100644 index 56b6b8334f..0000000000 --- a/libs/libdingaling/build/config/ac_prog_wget.m4 +++ /dev/null @@ -1,9 +0,0 @@ -AC_DEFUN([AC_PROG_WGET],[ -AC_CHECK_PROGS(wget,[wget],no) -export wget; -if test $wget = "no" ; -then - AC_MSG_ERROR([Unable to find the wget application]); -fi -AC_SUBST(wget) -]) diff --git a/libs/libdingaling/build/config/ax_cc_maxopt.m4 b/libs/libdingaling/build/config/ax_cc_maxopt.m4 deleted file mode 100644 index 6205ee84c8..0000000000 --- a/libs/libdingaling/build/config/ax_cc_maxopt.m4 +++ /dev/null @@ -1,120 +0,0 @@ -AC_DEFUN([AX_CC_MAXOPT], -[ -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AX_COMPILER_VENDOR]) - -AC_ARG_ENABLE(portable-binary, [AC_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])], - acx_maxopt_portable=$withval, acx_maxopt_portable=no) - -# Try to determine "good" native compiler flags if none specified via CFLAGS -if test "$ac_test_CFLAGS" != "set"; then - CFLAGS="" - case $ax_cv_c_compiler_vendor in - dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" - if test "x$acx_maxopt_portable" = xno; then - CFLAGS="$CFLAGS -arch host" - fi;; - - sun) CFLAGS="-native -fast -xO5 -dalign -xc99=all" - if test "x$acx_maxopt_portable" = xyes; then - CFLAGS="$CFLAGS -xarch=generic" - fi;; - - hp) CFLAGS="+Oall +Optrs_ansi +DSnative" - if test "x$acx_maxopt_portable" = xyes; then - CFLAGS="$CFLAGS +DAportable" - fi;; - - ibm) if test "x$acx_maxopt_portable" = xno; then - xlc_opt="-qarch=auto -qtune=auto" - else - xlc_opt="-qtune=auto" - fi - AX_CHECK_COMPILER_FLAGS($xlc_opt, - CFLAGS="-O3 -qansialias -w $xlc_opt", - [CFLAGS="-O3 -qansialias -w" - echo "******************************************************" - echo "* You seem to have the IBM C compiler. It is *" - echo "* recommended for best performance that you use: *" - echo "* *" - echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *" - echo "* ^^^ ^^^ *" - echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *" - echo "* CPU you have. (Set the CFLAGS environment var. *" - echo "* and re-run configure.) For more info, man cc. *" - echo "******************************************************"]) - ;; - - intel) CFLAGS="-O3 -ansi_alias" - if test "x$acx_maxopt_portable" = xno; then - icc_archflag=unknown - icc_flags="" - case $host_cpu in - i686*|x86_64*) - # icc accepts gcc assembly syntax, so these should work: - AX_GCC_X86_CPUID(0) - AX_GCC_X86_CPUID(1) - case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG - *:756e6547:*:*) # Intel - case $ax_cv_gcc_x86_cpuid_1 in - *6a?:*[[234]]:*:*|*6[[789b]]?:*:*:*) icc_flags="-xK";; - *f3[[347]]:*:*:*|*f4[1347]:*:*:*) icc_flags="-xP -xN -xW -xK";; - *f??:*:*:*) icc_flags="-xN -xW -xK";; - esac ;; - esac ;; - esac - if test "x$icc_flags" != x; then - for flag in $icc_flags; do - AX_CHECK_COMPILER_FLAGS($flag, [icc_archflag=$flag; break]) - done - fi - AC_MSG_CHECKING([for icc architecture flag]) - AC_MSG_RESULT($icc_archflag) - if test "x$icc_archflag" != xunknown; then - CFLAGS="$CFLAGS $icc_archflag" - fi - fi - ;; - - gnu) - # default optimization flags for gcc on all systems - CFLAGS="-O3 -fomit-frame-pointer" - - # -malign-double for x86 systems - AX_CHECK_COMPILER_FLAGS(-malign-double, CFLAGS="$CFLAGS -malign-double") - - # -fstrict-aliasing for gcc-2.95+ - AX_CHECK_COMPILER_FLAGS(-fstrict-aliasing, - CFLAGS="$CFLAGS -fstrict-aliasing") - - # note that we enable "unsafe" fp optimization with other compilers, too - AX_CHECK_COMPILER_FLAGS(-ffast-math, CFLAGS="$CFLAGS -ffast-math") - - AX_GCC_ARCHFLAG($acx_maxopt_portable) - ;; - esac - - if test -z "$CFLAGS"; then - echo "" - echo "********************************************************" - echo "* WARNING: Don't know the best CFLAGS for this system *" - echo "* Use ./configure CFLAGS=... to specify your own flags *" - echo "* (otherwise, a default of CFLAGS=-O3 will be used) *" - echo "********************************************************" - echo "" - CFLAGS="-O3" - fi - - AX_CHECK_COMPILER_FLAGS($CFLAGS, [], [ - echo "" - echo "********************************************************" - echo "* WARNING: The guessed CFLAGS don't seem to work with *" - echo "* your compiler. *" - echo "* Use ./configure CFLAGS=... to specify your own flags *" - echo "********************************************************" - echo "" - CFLAGS="" - ]) - -fi -]) diff --git a/libs/libdingaling/build/config/ax_cflags_warn_all_ansi.m4 b/libs/libdingaling/build/config/ax_cflags_warn_all_ansi.m4 deleted file mode 100644 index 5b35464457..0000000000 --- a/libs/libdingaling/build/config/ax_cflags_warn_all_ansi.m4 +++ /dev/null @@ -1,94 +0,0 @@ -AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all_ansi])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -# IRIX C compiler: -# -use_readonly_const is the default for IRIX C, -# puts them into .rodata, but they are copied later. -# need to be "-G0 -rdatashared" for strictmode but -# I am not sure what effect that has really. - guidod -for ac_arg dnl -in "-pedantic % -Wall -std=c99 -pedantic" dnl GCC - "-xstrconst % -v -xc99=all" dnl Solaris C - "-std1 % -verbose -w0 -warnprotos -std1" dnl Digital Unix - " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX - " % -ansi -ansiE -fullwarn" dnl IRIX - "+ESlit % +w1 -Aa" dnl HP-UX C - "-Xc % -pvctl[,]fullmsg -Xc" dnl NEC SX-5 (Super-UX 10) - "-h conform % -h msglevel 2 -h conform" dnl Cray C (Unicos) - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_WARN_ALL_ANSI],[dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all_ansi])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -# IRIX C compiler: -# -use_readonly_const is the default for IRIX C, -# puts them into .rodata, but they are copied later. -# need to be "-G0 -rdatashared" for strictmode but -# I am not sure what effect that has really. - guidod -for ac_arg dnl -in "-pedantic % -Wall -ansi -pedantic" dnl GCC - "-xstrconst % -v -Xc" dnl Solaris C - "-std1 % -verbose -w0 -warnprotos -std1" dnl Digital Unix - " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX - " % -ansi -ansiE -fullwarn" dnl IRIX - "+ESlit % +w1 -Aa" dnl HP-UX C - "-Xc % -pvctl[,]fullmsg -Xc" dnl NEC SX-5 (Super-UX 10) - "-h conform % -h msglevel 2 -h conform" dnl Cray C (Unicos) - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - diff --git a/libs/libdingaling/build/config/ax_check_compiler_flags.m4 b/libs/libdingaling/build/config/ax_check_compiler_flags.m4 deleted file mode 100644 index 73377b7c59..0000000000 --- a/libs/libdingaling/build/config/ax_check_compiler_flags.m4 +++ /dev/null @@ -1,26 +0,0 @@ -AC_DEFUN([AX_CHECK_COMPILER_FLAGS], -[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX -AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1]) -dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: -AS_LITERAL_IF([$1], - [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1), [ - ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])], - [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS]) -eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1) -AC_MSG_RESULT($ax_check_compiler_flags) -if test "x$ax_check_compiler_flags" = xyes; then - m4_default([$2], :) -else - m4_default([$3], :) -fi -])dnl AX_CHECK_COMPILER_FLAG diff --git a/libs/libdingaling/build/config/ax_compiler_vendor.m4 b/libs/libdingaling/build/config/ax_compiler_vendor.m4 deleted file mode 100644 index a24a58da0f..0000000000 --- a/libs/libdingaling/build/config/ax_compiler_vendor.m4 +++ /dev/null @@ -1,15 +0,0 @@ -AC_DEFUN([AX_COMPILER_VENDOR], -[ -AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, - [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown - # note: don't check for gcc first since some other compilers define __GNUC__ - for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do - vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ -#if !($vencpp) - thisisanerror; -#endif -])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break]) - done - ]) -]) diff --git a/libs/libdingaling/compile b/libs/libdingaling/compile deleted file mode 100755 index 1b1d232169..0000000000 --- a/libs/libdingaling/compile +++ /dev/null @@ -1,142 +0,0 @@ -#! /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 . -# -# 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 or send patches to -# . - -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 . -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/libs/libdingaling/config.guess b/libs/libdingaling/config.guess deleted file mode 100644 index 1f5c50c0d1..0000000000 --- a/libs/libdingaling/config.guess +++ /dev/null @@ -1,1420 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. - -timestamp='2014-03-23' - -# 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 3 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, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner. -# -# 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 -# -# Please send patches with a ChangeLog entry to config-patches@gnu.org. - - -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 ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2014 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 - -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - ;; -esac - -# 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 tuples: *-*-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 ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_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 /* 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 - - 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 - #include - - 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 - 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:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - *:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - 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-${LIBC}`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/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - 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="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${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-${LIBC} - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi - else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - 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-${LIBC}"; exit; } - ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - 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-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - 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' /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 - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # 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 ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-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 - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - 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 - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi - 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 ;; - x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; -esac - -cat >&2 < 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/libs/libdingaling/config.sub b/libs/libdingaling/config.sub deleted file mode 100644 index bba4efb805..0000000000 --- a/libs/libdingaling/config.sub +++ /dev/null @@ -1,1799 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. - -timestamp='2014-09-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 3 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, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches with a ChangeLog entry to config-patches@gnu.org. -# -# 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 ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2014 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-musl* | 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/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - 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*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -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 \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | 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 \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | 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 | v850e1 | v850e2 | v850es | v850e2v3 \ - | 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 | m68hcs12x | nvptx | picochip) - 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 - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - 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-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | 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-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | 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-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | 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*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | 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*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 - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-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 - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - 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 | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - 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 - ;; - tile*) - basic_machine=$basic_machine-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* | -plan9* \ - | -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* \ - | -bitrig* | -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* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -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* | -tirtos*) - # 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 - ;; - -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 - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - 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 - ;; - 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/libs/libdingaling/configure.ac b/libs/libdingaling/configure.ac deleted file mode 100755 index 0d7e832fa1..0000000000 --- a/libs/libdingaling/configure.ac +++ /dev/null @@ -1,149 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - - -AC_INIT(libdingaling, 0.1) -AC_CONFIG_AUX_DIR(build) -AM_INIT_AUTOMAKE -AC_CONFIG_SRCDIR([src]) -AC_CONFIG_HEADERS([src/config.h]) - -CFLAGS="$CFLAGS $CONFIGURE_CFLAGS" -CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS" -LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS" - -#Set default language -AC_LANG_C -# Checks for programs. -AC_PROG_CC -AC_PROG_MAKE_SET -AC_PROG_LIBTOOL -AC_PROG_INSTALL - -#Check for compiler vendor -AX_COMPILER_VENDOR - -# Optimize -AC_ARG_ENABLE(optimization, -[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"]) - -if test "${enable_optimizer}" = "yes" ; then - AC_DEFINE([OPTIMZER],[],[Enable Optimization.]) - AX_CC_MAXOPT -fi - -# Enable debugging -AC_ARG_ENABLE(debug, -[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enable_debug"],[enable_debug="yes"]) - -if test "${enable_debug}" = "yes"; then - AC_DEFINE([DEBUG],[],[Enable extra debugging.]) - AX_CFLAGS_WARN_ALL_ANSI -fi - -AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"]) - - -case "$host" in - *-solaris2*) - if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-KPIC -DPIC" - new_AM_LDFLAGS="-R${prefix}/lib" - FUNC_DEF=__func__ - IN_LINE="" - elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-fPIC" - new_AM_LDFLAGS="" - IN_LINE=inline - fi - ;; - *-darwin*) - if test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then - SOLINK="-dynamic -bundle -force-flat-namespace" - new_AM_CFLAGS="-DMACOSX" - new_AM_LDFLAGS="" - fi - IN_LINE=inline - ;; - x86_64-*-linux-gnu) - if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-KPIC -DPIC" - new_AM_LDFLAGS="-R${prefix}/lib" - FUNC_DEF=__func__ - elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then - SOLINK="-shared -Xlinker -x" - new_AM_CFLAGS="-fPIC" - new_AM_LDFLAGS="" - fi - IN_LINE=inline - ;; - i*6-*-linux-gnu) - if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-KPIC -DPIC" - new_AM_LDFLAGS="-R${prefix}/lib" - FUNC_DEF=__func__ - elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then - SOLINK="-shared -Xlinker -x" - new_AM_CFLAGS="-fpic" - new_AM_LDFLAGS="" - fi - IN_LINE=inline - ;; - *) - if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-KPIC -DPIC" - new_AM_LDFLAGS="-R${prefix}/lib" - FUNC_DEF=__func__ - elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then - SOLINK="-shared -Xlinker -x" - new_AM_CFLAGS="-fPIC" - new_AM_LDFLAGS="" - fi - IN_LINE=inline -esac - -# Enable 64 bit build -AC_ARG_ENABLE(64, -[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"]) - -if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - if test "${enable_64}" = "yes"; then - new_AM_CFLAGS="$new_AM_CFLAGS -m64" - fi -fi - -AC_SUBST(new_AM_CFLAGS) -AC_SUBST(new_AM_LDFLAGS) -AC_SUBST(SOLINK) -AC_DEFINE_UNQUOTED([__inline__],[$IN_LINE],[sunpro is bad at inline]) - -# Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -#AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM - -# Checks for library functions. -AC_PROG_GCC_TRADITIONAL -AC_TYPE_SIGNAL -AC_FUNC_STRFTIME -#AC_CHECK_FUNCS([gethostname gettimeofday localtime_r memmove memset socket strcasecmp strchr strdup strncasecmp strstr]) - -AC_C_BIGENDIAN(AC_DEFINE([__BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([__BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian])) -AC_DEFINE([__LITTLE_ENDIAN],1234,[for the places where it is not defined]) -AC_DEFINE([__BIG_ENDIAN],4321,[for the places where it is not defined]) - -AC_CONFIG_FILES([Makefile]) - -AC_OUTPUT diff --git a/libs/libdingaling/configure.gnu b/libs/libdingaling/configure.gnu deleted file mode 100644 index 53c204581f..0000000000 --- a/libs/libdingaling/configure.gnu +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -srcpath=$(dirname $0 2>/dev/null ) || srcpath="." -$srcpath/configure "$@" --disable-shared - diff --git a/libs/libdingaling/depcomp b/libs/libdingaling/depcomp deleted file mode 100644 index 04701da536..0000000000 --- a/libs/libdingaling/depcomp +++ /dev/null @@ -1,530 +0,0 @@ -#! /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 . - -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 . -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/libs/libdingaling/doc b/libs/libdingaling/doc deleted file mode 100644 index ab09daa627..0000000000 --- a/libs/libdingaling/doc +++ /dev/null @@ -1 +0,0 @@ -http://iksemel.jabberstudio.org/iksemel.html diff --git a/libs/libdingaling/docs/Doxygen.conf b/libs/libdingaling/docs/Doxygen.conf deleted file mode 100644 index 8b5886ff4f..0000000000 --- a/libs/libdingaling/docs/Doxygen.conf +++ /dev/null @@ -1,264 +0,0 @@ -# Doxyfile 1.4.6 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = LibDingaLing -PROJECT_NUMBER = -OUTPUT_DIRECTORY = . -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = YES -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 8 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -IGNORE_PREFIX = ldl_ - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = YES -HIDE_UNDOC_CLASSES = YES -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = NO -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO -FILE_VERSION_FILTER = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.py -RECURSIVE = NO -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = YES -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -USE_HTAGS = YES -VERBATIM_HEADERS = NO -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 1 -IGNORE_PREFIX = ldl_ -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = libDingaLing.chm -HHC_LOCATION = -GENERATE_CHI = YES -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = YES -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = YES -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = YES -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = YES -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = NO -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = *.h -PREDEFINED = SWITCH_DECLARE(x)=x \ - APR_DECLARE(x)=x \ - DoxyDefine(x)=x - -EXPAND_AS_DEFINED = NO -SKIP_FUNCTION_MACROS = NO -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = YES -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = jpg -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 1000 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/libs/libdingaling/docs/docs.vcproj b/libs/libdingaling/docs/docs.vcproj deleted file mode 100644 index be9173ec07..0000000000 --- a/libs/libdingaling/docs/docs.vcproj +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libdingaling/install-sh b/libs/libdingaling/install-sh deleted file mode 100644 index 4d4a9519ea..0000000000 --- a/libs/libdingaling/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/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/libs/libdingaling/libdingaling.2008.vcproj b/libs/libdingaling/libdingaling.2008.vcproj deleted file mode 100644 index bf22a7e5e6..0000000000 --- a/libs/libdingaling/libdingaling.2008.vcproj +++ /dev/null @@ -1,621 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libdingaling/libdingaling.2010.vcxproj.filters b/libs/libdingaling/libdingaling.2010.vcxproj.filters deleted file mode 100644 index 18ef8e8b1a..0000000000 --- a/libs/libdingaling/libdingaling.2010.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/libs/libdingaling/libdingaling.2017.vcxproj b/libs/libdingaling/libdingaling.2017.vcxproj deleted file mode 100644 index 899855def1..0000000000 --- a/libs/libdingaling/libdingaling.2017.vcxproj +++ /dev/null @@ -1,303 +0,0 @@ - - - - - Debug DLL - Win32 - - - Debug DLL - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release DLL - Win32 - - - Release DLL - x64 - - - Release - Win32 - - - Release - x64 - - - - libdingaling - {1906D736-08BD-4EE1-924F-B536249B9A54} - libdingaling - Win32Proj - - - - DynamicLibrary - Unicode - true - $(DefaultPlatformToolset) - - - DynamicLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - DynamicLibrary - Unicode - true - $(DefaultPlatformToolset) - - - DynamicLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)Debug\ - $(Configuration)\ - $(SolutionDir)Release\ - $(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - - Disabled - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Level4 - 4718;4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings) - - - - - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - Level4 - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - - - Disabled - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - EditAndContinue - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) - ..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug;%(AdditionalLibraryDirectories) - .\src\dingaling.def - true - false - false - false - - - - - - - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level4 - ProgramDatabase - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) - ..\apr\Release;..\apr-util\Release;..\iksemel\Release;%(AdditionalLibraryDirectories) - .\src\dingaling.def - false - - - - - - - X64 - - - Disabled - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Level4 - 4718;4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings) - - - - - X64 - - - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - Level4 - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - - - X64 - - - Disabled - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - ProgramDatabase - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) - ..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug;%(AdditionalLibraryDirectories) - .\src\dingaling.def - true - false - false - false - - - MachineX64 - - - - - X64 - - - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level4 - ProgramDatabase - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) - ..\apr\Release;..\apr-util\Release;..\iksemel\Release;%(AdditionalLibraryDirectories) - .\src\dingaling.def - false - - - MachineX64 - - - - - - - - - - - - - - - - {f057da7f-79e5-4b00-845c-ef446ef055e3} - false - - - {e727e8f6-935d-46fe-8b0e-37834748a0e3} - false - - - - - - \ No newline at end of file diff --git a/libs/libdingaling/libdingaling.vcproj b/libs/libdingaling/libdingaling.vcproj deleted file mode 100644 index 3cb660b406..0000000000 --- a/libs/libdingaling/libdingaling.vcproj +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libdingaling/ltmain.sh b/libs/libdingaling/ltmain.sh deleted file mode 100755 index 9e71d27d86..0000000000 --- a/libs/libdingaling/ltmain.sh +++ /dev/null @@ -1,6530 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -basename="s,^.*/,,g" - -# 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: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5.20 -TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)" - -# 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 - -# 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 <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# 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 () -{ - 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 -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - 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_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 () -{ - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - 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. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - 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 - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit $EXIT_FAILURE -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" - $run 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 - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE - fi -} - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - my_status="" - - $show "${rm}r $my_gentop" - $run ${rm}r "$my_gentop" - $show "$mkdir $my_gentop" - $run $mkdir "$my_gentop" - my_status=$? - if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then - exit $my_status - fi - - 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 - my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" - - $show "${rm}r $my_xdir" - $run ${rm}r "$my_xdir" - $show "$mkdir $my_xdir" - $run $mkdir "$my_xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$my_xdir"; then - exit $status - fi - case $host in - *-darwin*) - $show "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - if test -z "$run"; then - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` - darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` - if test -n "$darwin_arches"; then - darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - $show "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - 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 have a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` - 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}r unfat-$$ - cd "$darwin_orig_dir" - else - cd "$darwin_orig_dir" - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - fi # $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" -} -# End of Shell function definitions -##################################### - -# Darwin sucks -eval std_shrext=\"$shrext_cmds\" - -# Parse our command line options once, thoroughly. -while test "$#" -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2005 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $? - ;; - - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" - done - exit $? - ;; - - --debug) - $echo "$progname: enabling shell trace mode" - set -x - preserve_args="$preserve_args $arg" - ;; - - --dry-run | -n) - run=: - ;; - - --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 $? - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --quiet | --silent) - show=: - preserve_args="$preserve_args $arg" - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE -fi - -# 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= - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 - case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # 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= - - 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) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi - arg_mode=target - continue - ;; - - -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,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # 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. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, and some SunOS ksh mistreat backslash-escaping - # in scan sets (worked around with variable expansion), - # and furthermore cannot handle '|' '&' '(' ')' in scan sets - # at all, so we specify them separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qlibobj="\"$qlibobj\"" ;; - esac - test "X$libobj" != "X$qlibobj" \ - && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # 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 - - $run $rm $removelist - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2*) - 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" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - 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 $run ln "$progpath" "$lockfile" 2>/dev/null; do - $show "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." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - $echo "$srcfile" > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qsrcfile="\"$qsrcfile\"" ;; - esac - - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </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." - - $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 - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </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." - - $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 - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_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 - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$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" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$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 (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - 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. - libobjs="$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 - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit $EXIT_FAILURE - fi - arg=$save_arg - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - 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 - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - darwin_framework) - compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - prev= - 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 - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -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 - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework|-arch) - prev=darwin_framework - compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - 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*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit $EXIT_FAILURE - fi - 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*) - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-mingw* | *-*-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 -framework System" - 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 - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - -model) - compile_command="$compile_command $arg" - compiler_flags="$compiler_flags $arg" - finalize_command="$finalize_command $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # -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* pass through architecture-specific compiler args for GCC - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*) - - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - 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*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # 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 - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - 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. - libobjs="$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 - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_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. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - 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\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - exit $status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplications in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - 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 test "X$duplicate_deps" = "Xyes" ; 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 test "X$duplicate_compiler_generated_deps" = "Xyes" ; 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 link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE - ;; - 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 - 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% $dependency_libs" ;; - esac - 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) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; 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 (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - 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 - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - 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 - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - 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 - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # 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) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - if eval $echo \"$deplib\" 2>/dev/null \ - | $SED 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 used here." - else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - 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 - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # 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 - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - 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 - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - 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 test "X$duplicate_deps" = "Xyes" ; 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 - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit $EXIT_FAILURE - 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 - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - 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 - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # 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 - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - 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 - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - 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" - # 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*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - 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 test "X$duplicate_deps" = "Xyes" ; 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 -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 - *" $dir "*) ;; - *" $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 - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - # This is a shared library - - # Warn about portability, can't link against -module's on - # some systems (darwin) - if 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 - realname="$2" - shift; 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*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - 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* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against - # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; 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 - 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; 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 - $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE - 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; 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*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - 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 test "X$duplicate_deps" = "Xyes" ; 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 - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="$absdir" - fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, - # but need to link against shared - 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 "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac - fi - path="" - ;; - *) - path="-L$path" - ;; - esac - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac - ;; - *) continue ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - 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" - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # 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*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit $EXIT_FAILURE - else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - 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 - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # 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="$2" - number_minor="$3" - number_revision="$4" - # - # 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) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - 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]) ;; - *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - 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]) ;; - *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - 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]) ;; - *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - 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 - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix | nonstopux) - major=`expr $current - $age + 1` - - 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 - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=.`expr $current - $age` - 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 - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE - ;; - 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 - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - 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) - ;; - $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 - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi - 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 "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -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*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-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. - test "X$arg" = "X-lc" && continue - ;; - *) - # 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. - $rm conftest.c - cat > conftest.c </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} 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 - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - 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 \"$potent_lib\" 2>/dev/null \ - | ${SED} 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 - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - 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" | ${SED} -e "1s,^X,," -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 is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - 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 - - # 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 - realname="$2" - shift; 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" - 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` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "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"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$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"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" - 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 - $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:" && - len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # 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= - delfiles= - last_robj= - k=1 - output=$output_objdir/$output_la-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$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\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$output_la-${k}.$objext - objlist=$obj - len=1 - 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 ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadable object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" - done - - $echo "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" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - 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\" - 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 - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(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 - $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 - $show "${rm}r $gentop" - $run ${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 - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run 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 "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case $output in - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $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 - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - 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" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${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" - # $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" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; - esac - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - 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 / -framework System /'` - finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - - 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*) - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - 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 - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case $dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$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 arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # 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 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/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -" - - case $host in - *cygwin* | *mingw* ) - $echo >> "$output_objdir/$dlsyms" "\ -/* DATA imports from DLLs on WIN32 can't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs */ -struct { -" - ;; - * ) - $echo >> "$output_objdir/$dlsyms" "\ -const struct { -" - ;; - esac - - - $echo >> "$output_objdir/$dlsyms" "\ - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = -{\ -" - - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - 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*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE - ;; - 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 - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; 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. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - 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. - $run $rm $output - # Link the executable and exit - $show "$link_command" - $run 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" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - 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. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "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}\" || 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 - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; 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 our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${outputname}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_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 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - return 127; -} - -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 -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -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); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# 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' - -# 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 variable: - 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 >> $output "\ - - # 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 - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - 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 >> $output "\ - - # 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 $EXIT_FAILURE - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - 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 >> $output "\ - # 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 >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - 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*) - $echo >> $output "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE - 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 $EXIT_FAILURE - fi -fi\ -" - chmod +x $output - fi - 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" - 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" - 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 - # 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 - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - fi - - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - counter=`expr $counter + 1` - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$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 - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_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 - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$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= - 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 - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - eval cmd=\"$cmd\" - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "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}\" || 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 - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; 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. - if test -z "$run"; then - 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) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlprefiles="$newdlprefiles $libdir/$name" - 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) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# 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' - -# Libraries that this one depends upon. -dependency_libs='$dependency_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 - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit $EXIT_SUCCESS - ;; - - # libtool install mode - install) - modename="$modename: install" - - # 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. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # 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. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - 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. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # 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 - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "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. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run 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 - if test "$linkname" != "$realname"; then - $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" - $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - cmds=$postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run 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 - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run 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 - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - 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 - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` - ;; - *) - wrapper=$file - ;; - esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # Note that it is not necessary on cygwin/mingw to append a dot to - # foo even if both foo 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. - # - # If there is no directory component, then add one. - case $wrapper in - */* | *\\*) . ${wrapper} ;; - *) . ./${wrapper} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit $EXIT_FAILURE - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # Note that it is not necessary on cygwin/mingw to append a dot to - # foo even if both foo 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. - # - # If there is no directory component, then add one. - case $wrapper in - */* | *\\*) . ${wrapper} ;; - *) . ./${wrapper} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - save_umask=`umask` - umask 0077 - if $mkdir "$tmpdir"; then - umask $save_umask - else - umask $save_umask - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - 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) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$old_striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - 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. - cmds=$finish_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS - - $echo "----------------------------------------------------------------------" - $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" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit $EXIT_SUCCESS - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit $EXIT_FAILURE - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - 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 (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # 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 - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - 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 - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - 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 (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $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" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - - if test "$mode" = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - fi - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $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) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $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 (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename - - # 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 - $show "$rm $rmfiles" - $run $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 - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit $EXIT_FAILURE -fi - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [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 - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -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 \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit $EXIT_SUCCESS - ;; - -clean) - $echo \ -"Usage: $modename [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: $modename [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 - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always 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: $modename [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: $modename [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: $modename [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 rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [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 - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -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: $modename [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." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit $? - -# 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: diff --git a/libs/libdingaling/missing b/libs/libdingaling/missing deleted file mode 100644 index 894e786e16..0000000000 --- a/libs/libdingaling/missing +++ /dev/null @@ -1,360 +0,0 @@ -#! /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 , 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 ." - 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/libs/libdingaling/mkinstalldirs b/libs/libdingaling/mkinstalldirs deleted file mode 100644 index 259dbfcd35..0000000000 --- a/libs/libdingaling/mkinstalldirs +++ /dev/null @@ -1,158 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy - -scriptversion=2005-06-29.22 - -# Original author: Noah Friedman -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -errstatus=0 -dirmode= - -usage="\ -Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... - -Create each directory DIR (with mode MODE, if specified), including all -leading file name components. - -Report bugs to ." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" - exit $? - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --version) - echo "$0 $scriptversion" - exit $? - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and -# mkdir -p a/c at the same time, both will detect that a is missing, -# one will create a, then the other will try to create a and die with -# a "File exists" error. This is a problem when calling mkinstalldirs -# from a parallel make. We use --version in the probe to restrict -# ourselves to GNU mkdir, which is thread-safe. -case $dirmode in - '') - if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - test -d ./-p && rmdir ./-p - test -d ./--version && rmdir ./--version - fi - ;; - *) - if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && - test ! -d ./--version; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - else - # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./--version "./$dirmode"; - do - test -d $d && rmdir $d - done - fi - ;; -esac - -for file -do - case $file in - /*) pathcomp=/ ;; - *) pathcomp= ;; - esac - oIFS=$IFS - IFS=/ - set fnord $file - shift - IFS=$oIFS - - for d - do - test "x$d" = x && continue - - pathcomp=$pathcomp$d - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr= - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp=$pathcomp/ - done -done - -exit $errstatus - -# 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/libs/libdingaling/src/dingaling.def b/libs/libdingaling/src/dingaling.def deleted file mode 100644 index 16102267e1..0000000000 --- a/libs/libdingaling/src/dingaling.def +++ /dev/null @@ -1,30 +0,0 @@ -EXPORTS -ldl_session_get_caller -ldl_session_get_ip -ldl_session_set_private -ldl_session_get_private -ldl_session_terminate -ldl_handle_get_private -ldl_session_candidates -ldl_session_describe -ldl_session_get_state -ldl_session_get_candidates -ldl_session_get_payloads -ldl_global_init -ldl_global_destroy -ldl_global_set_log_stream -ldl_handle_init -ldl_handle_run -ldl_handle_destroy -ldl_handle_set_log_stream -ldl_session_create -ldl_handle_probe -ldl_handle_ready -ldl_session_get_id -ldl_session_set_ip -ldl_global_set_logger -ldl_handle_send_msg -ldl_session_get_value -ldl_session_set_value -ldl_session_accept_candidate -ldl_session_send_msg \ No newline at end of file diff --git a/libs/libdingaling/src/ldl_compat.h b/libs/libdingaling/src/ldl_compat.h deleted file mode 100644 index c14e0d2145..0000000000 --- a/libs/libdingaling/src/ldl_compat.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * libDingaLing XMPP Jingle Library - * Copyright (C) 2005-2014, Anthony Minessale II - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is libDingaLing XMPP Jingle Library - * - * The Initial Developer of the Original Code is - * Anthony Minessale II - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II - * - * ldl_compat.h -- Platform Compatability Header File - * - */ -/*! \file ldl_compat.h - \brief Platform Compatability Header File -*/ -#ifndef LDL_COMPAT_H -#define LDL_COMPAT_H -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __STUPIDFORMATBUG__ -} -#endif - - -#ifdef _MSC_VER -#if !defined(_STDINT) && !defined(uint32_t) -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -typedef __int8 int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned long in_addr_t; -#endif -#if _MSC_VER < 1900 -#define snprintf _snprintf -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c deleted file mode 100644 index ee08f041c0..0000000000 --- a/libs/libdingaling/src/libdingaling.c +++ /dev/null @@ -1,3301 +0,0 @@ -/* - * libDingaLing XMPP Jingle Library - * Copyright (C) 2005-2014, Anthony Minessale II - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is libDingaLing XMPP Jingle Library - * - * The Initial Developer of the Original Code is - * Anthony Minessale II - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II - * - * libdingaling.c -- Main Library Code - * - * QMOD: XMPP Video Signaling + Presentation (video-v1 & camera-v1) - * - */ - - -#ifndef _MSC_VER -#include -#include -#include -#include -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include -#include - -#include "ldl_compat.h" -#include "libdingaling.h" -#include "sha1.h" - -#ifdef _MSC_VER -#include -#pragma warning(disable:4127 4706) -#endif - -#define microsleep(x) apr_sleep(x * 1000) -#define LDL_CAPS_VER "1.0.0.1" - -static int opt_timeout = 30; - -static void sha1_hash(char *out, unsigned char *in, unsigned int len); -static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t olen); -static void ldl_random_string(char *buf, uint16_t len, char *set); - -static struct { - unsigned int flags; - FILE *log_stream; - int debug; - apr_pool_t *memory_pool; - unsigned int id; - ldl_logger_t logger; - apr_hash_t *avatar_hash; - apr_thread_mutex_t *flag_mutex; -} globals; - -struct packet_node { - char id[80]; - iks *xml; - unsigned int retries; - apr_time_t next; -}; - -struct ldl_buffer { - char *buf; - unsigned int len; - int hit; -}; - -typedef enum { - CS_NEW, - CS_START, - CS_CONNECTED -} ldl_handle_state_t; - -struct ldl_handle { - iksparser *parser; - iksid *acc; - iksfilter *filter; - char *login; - char *password; - char *server; - char *status_msg; - char *priority; - uint16_t port; - int features; - int counter; - int job_done; - unsigned int flags; - apr_queue_t *queue; - apr_queue_t *retry_queue; - apr_hash_t *sessions; - apr_hash_t *retry_hash; - apr_hash_t *probe_hash; - apr_hash_t *sub_hash; - apr_thread_mutex_t *lock; - apr_thread_mutex_t *flag_mutex; - ldl_loop_callback_t loop_callback; - ldl_session_callback_t session_callback; - ldl_response_callback_t response_callback; - apr_pool_t *pool; - void *private_info; - FILE *log_stream; - ldl_handle_state_t state; - int fail_count; -}; - -struct ldl_session { - ldl_state_t state; - ldl_handle_t *handle; - char *id; - char *initiator; - char *them; - char *ip; - char *login; - ldl_payload_t payloads[LDL_MAX_PAYLOADS]; - unsigned int payload_len; - /*! \brief Transport candidates, organized per type */ - ldl_candidate_t candidates[LDL_TPORT_MAX][LDL_MAX_CANDIDATES]; - /*! \brief Length of the candidate list, per transport type */ - unsigned int candidate_len[LDL_TPORT_MAX]; - apr_pool_t *pool; - apr_hash_t *variables; - apr_time_t created; - void *private_data; - ldl_user_flag_t flags; -}; - -static int on_disco_default(void *user_data, ikspak *pak); -static int on_vcard(void *user_data, ikspak *pak); -typedef int (*iks_filter_callback_t)(void *user_data, ikspak *pak); - -struct ldl_feature { - const char *name; - iks_filter_callback_t callback; -}; -typedef struct ldl_feature ldl_feature_t; - -#define FEATURE_DISCO "http://jabber.org/protocol/disco" -#define FEATURE_DISCO_INFO "http://jabber.org/protocol/disco#info" -#define FEATURE_VERSION "jabber:iq:version" -#define FEATURE_VCARD "vcard-temp" -#define FEATURE_VOICE "http://www.google.com/xmpp/protocol/voice/v1" -#define FEATURE_VIDEO "http://www.google.com/xmpp/protocol/video/v1" -#define FEATURE_CAMERA "http://www.google.com/xmpp/protocol/camera/v1" -#define FEATURE_LAST "jabber:iq:last" - -static ldl_feature_t FEATURES[] = { - { FEATURE_DISCO, on_disco_default }, - { FEATURE_DISCO_INFO, on_disco_default }, - { FEATURE_VERSION, on_disco_default }, - { FEATURE_VCARD, on_vcard}, - { FEATURE_VOICE, on_disco_default }, - { FEATURE_VIDEO, on_disco_default }, - { FEATURE_CAMERA, on_disco_default }, - { FEATURE_LAST, on_disco_default }, - { NULL, NULL} -}; - - -struct ldl_avatar { - char *path; - char *base64; - char hash[256]; -}; - -typedef struct ldl_avatar ldl_avatar_t; - - -static void lowercase(char *str) -{ - size_t x = 0; - - if (str) { - for (x = 0; x < strlen(str); x++) { - str[x] = (char)tolower((int)str[x]); - } - } -} - -static char *cut_path(char *in) -{ - char *p, *ret = in; - char delims[] = "/\\"; - char *i; - - for (i = delims; *i; i++) { - p = in; - while ((p = strchr(p, *i)) != 0) { - ret = ++p; - } - } - return ret; -} - -static void default_logger(char *file, const char *func, int line, int level, char *fmt, ...) -{ - char *fp; - char data[1024]; - - va_list ap; - - fp = cut_path(file); - - va_start(ap, fmt); - - vsnprintf(data, sizeof(data), fmt, ap); - - fprintf(globals.log_stream, "%s:%d %s() %s", fp, line, func, data); - - va_end(ap); - -} - -static unsigned int next_id(void) -{ - return globals.id++; -} - -static char *iks_name_nons(iks *x) -{ - char *r = iks_name(x); - char *p; - - if (r && (p = strchr(r, ':'))) { - r = p + 1; - } - - return r; -} - - -char *ldl_session_get_value(ldl_session_t *session, char *key) -{ - return apr_hash_get(session->variables, key, APR_HASH_KEY_STRING); -} - -void ldl_session_set_value(ldl_session_t *session, const char *key, const char *val) -{ - apr_hash_set(session->variables, apr_pstrdup(session->pool, key), APR_HASH_KEY_STRING, apr_pstrdup(session->pool, val)); -} - -char *ldl_session_get_id(ldl_session_t *session) -{ - return session->id; -} - -void ldl_session_send_msg(ldl_session_t *session, char *subject, char *body) -{ - ldl_handle_send_msg(session->handle, session->login, session->them, subject, body); -} - -ldl_status ldl_session_destroy(ldl_session_t **session_p) -{ - ldl_session_t *session = *session_p; - - if (session) { - apr_pool_t *pool = session->pool; - apr_hash_t *hash = session->handle->sessions; - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Destroyed Session %s\n", session->id); - } - - if (session->id) { - apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); - } - - if (session->them) { - apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); - } - - apr_pool_destroy(pool); - pool = NULL; - *session_p = NULL; - return LDL_STATUS_SUCCESS; - } - - return LDL_STATUS_FALSE; -} - - -ldl_status ldl_session_create(ldl_session_t **session_p, ldl_handle_t *handle, char *id, char *them, char *me, ldl_user_flag_t flags) -{ - ldl_session_t *session = NULL; - - if (!(session = apr_palloc(handle->pool, sizeof(ldl_session_t)))) { - globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); - *session_p = NULL; - return LDL_STATUS_MEMERR; - } - memset(session, 0, sizeof(ldl_session_t)); - apr_pool_create(&session->pool, globals.memory_pool); - session->id = apr_pstrdup(session->pool, id); - session->them = apr_pstrdup(session->pool, them); - - if (flags & LDL_FLAG_OUTBOUND) { - session->initiator = apr_pstrdup(session->pool, me); - } - - if (ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - session->login = apr_pstrdup(session->pool, me); - } else { - session->login = apr_pstrdup(session->pool, handle->login); - } - - apr_hash_set(handle->sessions, session->id, APR_HASH_KEY_STRING, session); - apr_hash_set(handle->sessions, session->them, APR_HASH_KEY_STRING, session); - session->handle = handle; - session->created = apr_time_now(); - session->state = LDL_STATE_NEW; - session->variables = apr_hash_make(session->pool); - session->flags = flags; - *session_p = session; - - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Created Session %s\n", id); - } - - return LDL_STATUS_SUCCESS; -} - -static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, char *to, iks *xml, char *xtype) -{ - ldl_session_t *session = NULL; - ldl_signal_t dl_signal = LDL_SIGNAL_NONE; - char *initiator = iks_find_attrib(xml, "initiator"); - char *msg = NULL; - - if (!(session = apr_hash_get(handle->sessions, id, APR_HASH_KEY_STRING))) { - ldl_session_create(&session, handle, id, from, to, LDL_FLAG_NONE); - if (!session) { - return LDL_STATUS_MEMERR; - } - } - - if (!session) { - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Non-Existent Session %s!\n", id); - } - return LDL_STATUS_MEMERR; - } - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Message for Session %s\n", id); - } - - while(xml) { - char *type = NULL; - iks *tag; - - if (iks_type(xml) != IKS_CDATA) { - type = xtype ? xtype : iks_find_attrib(xml, "type"); - } - - if (type) { - - if (!strcasecmp(type, "redirect")) { - apr_hash_t *hash = session->handle->sessions; - char *p = to; - if ((p = strchr(to, ':'))) { - p++; - } else { - p = to; - } - - - apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); - apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); - session->them = apr_pstrdup(session->pool, p); - apr_hash_set(handle->sessions, session->them, APR_HASH_KEY_STRING, session); - apr_hash_set(handle->sessions, session->id, APR_HASH_KEY_STRING, session); - - dl_signal = LDL_SIGNAL_REDIRECT; - } else if (!strcasecmp(type, "initiate") || !strcasecmp(type, "accept")) { - - dl_signal = LDL_SIGNAL_INITIATE; - - if (!strcasecmp(type, "accept")) { - msg = "accept"; - } - if (!session->initiator && initiator) { - session->initiator = apr_pstrdup(session->pool, initiator); - } - tag = iks_child (xml); - - while(tag) { - if (!strcasecmp(iks_name_nons(tag), "description")) { - iks * itag = iks_child (tag); - while(itag) { - if (!strcasecmp(iks_name_nons(itag), "payload-type") && session->payload_len < LDL_MAX_PAYLOADS) { - char *name = iks_find_attrib(itag, "name"); - char *id = iks_find_attrib(itag, "id"); - char *rate = iks_find_attrib(itag, "clockrate"); - char *ptime = iks_find_attrib(itag, "ptime"); - if (name && id) { - session->payloads[session->payload_len].name = apr_pstrdup(session->pool, name); - session->payloads[session->payload_len].id = atoi(id); - if (ptime) { - session->payloads[session->payload_len].ptime = atoi(ptime); - } else { - session->payloads[session->payload_len].ptime = 20; - } - if (rate) { - session->payloads[session->payload_len].rate = atoi(rate); - } else { - if (!strncasecmp(iks_name(itag), "vid", 3)) { - session->payloads[session->payload_len].rate = 90000; - } else { - session->payloads[session->payload_len].rate = 8000; - } - } - session->payload_len++; - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Add Payload [%s] id='%s'\n", name, id); - } - } - } - itag = iks_next_tag(itag); - } - } - tag = iks_next_tag(tag); - } - } else if (!strcasecmp(type, "transport-accept")) { - dl_signal = LDL_SIGNAL_TRANSPORT_ACCEPT; - } else if (!strcasecmp(type, "reject")) { - dl_signal = LDL_SIGNAL_REJECT; - } else if (!strcasecmp(type, "transport-info") || !strcasecmp(type, "candidates")) { - char *tid = iks_find_attrib(xml, "id"); - dl_signal = LDL_SIGNAL_CANDIDATES; - tag = iks_child (xml); - id = type; - if (tag && !strcasecmp(iks_name_nons(tag), "transport")) { - tag = iks_child(tag); - } - - for (;tag;tag = iks_next_tag(tag)) { - if (!strcasecmp(iks_name_nons(tag), "info_element")) { - char *name = iks_find_attrib(tag, "name"); - char *value = iks_find_attrib(tag, "value"); - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Info Element [%s]=[%s]\n", name, value); - } - ldl_session_set_value(session, name, value); - - } else if (!strcasecmp(iks_name_nons(tag), "candidate") /*&& session->candidate_len < LDL_MAX_CANDIDATES*/) { - char *key; - double pref = 0.0; - int index = -1; - ldl_transport_type_t tport; - unsigned int *candidate_len = NULL; - ldl_candidate_t (*candidates)[LDL_MAX_CANDIDATES] = NULL; - - if (!(key = iks_find_attrib(tag, "preference"))) { - globals.logger(DL_LOG_WARNING, "Field preference was not set\n"); - continue; - } else { - unsigned int x; - - pref = strtod(key, NULL); - - /* Check what kind of candidate this is */ - if ((key = iks_find_attrib(tag, "name")) && ((tport = ldl_transport_type_parse(key)) != LDL_TPORT_MAX)) { - candidates = &(session->candidates[tport]); - candidate_len = &(session->candidate_len[tport]); - } else { - globals.logger(DL_LOG_WARNING, "No such transport type: %s\n", key); - continue; - } - - if (*candidate_len >= LDL_MAX_CANDIDATES) { - globals.logger(DL_LOG_WARNING, "Too many %s candidates\n", key); - continue; - } - - for (x = 0; x < *candidate_len; x++) { - if ((*candidates)[x].pref == pref) { - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Duplicate Pref! Updating...\n"); - } - index = x; - break; - } - } - } - - if (index < 0) { - index = (*candidate_len)++; - } - - (*candidates)[index].pref = pref; - - if (tid) { - (*candidates)[index].tid = apr_pstrdup(session->pool, tid); - } - - if ((key = iks_find_attrib(tag, "name"))) { - (*candidates)[index].name = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "type"))) { - (*candidates)[index].type = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "protocol"))) { - (*candidates)[index].protocol = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "username"))) { - (*candidates)[index].username = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "password"))) { - (*candidates)[index].password = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "address"))) { - (*candidates)[index].address = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "port"))) { - (*candidates)[index].port = (uint16_t)atoi(key); - } - - if (!(*candidates)[index].type) { - (*candidates)[index].type = apr_pstrdup(session->pool, "stun"); - } - - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, - "New Candidate %d\n" - "name=%s\n" - "type=%s\n" - "protocol=%s\n" - "username=%s\n" - "password=%s\n" - "address=%s\n" - "port=%d\n" - "pref=%0.2f\n", - *candidate_len, - (*candidates)[index].name, - (*candidates)[index].type, - (*candidates)[index].protocol, - (*candidates)[index].username, - (*candidates)[index].password, - (*candidates)[index].address, - (*candidates)[index].port, - (*candidates)[index].pref - ); - } - } - } - } else if (!strcasecmp(type, "terminate")) { - dl_signal = LDL_SIGNAL_TERMINATE; - } else if (!strcasecmp(type, "error")) { - dl_signal = LDL_SIGNAL_ERROR; - } - } - - xml = iks_child(xml); - } - - if (handle->session_callback && dl_signal) { - handle->session_callback(handle, session, dl_signal, to, from, id, msg); - } - - return LDL_STATUS_SUCCESS; -} - - -static ldl_status parse_jingle_code(ldl_handle_t *handle, iks *xml, char *to, char *from, char *type) -{ - ldl_session_t *session = NULL; - ldl_signal_t dl_signal = LDL_SIGNAL_NONE; - char *initiator = iks_find_attrib(xml, "initiator"); - char *msg = NULL; - char *id = iks_find_attrib(xml, "sid"); - char *action = iks_find_attrib(xml, "action"); - iks *tag; - - - if (!strcasecmp(type, "error")) { - action = type; - } - - - if (!(id && action && from)) { - globals.logger(DL_LOG_CRIT, "missing required params\n"); - return LDL_STATUS_FALSE; - } - - if (!(session = apr_hash_get(handle->sessions, id, APR_HASH_KEY_STRING))) { - ldl_session_create(&session, handle, id, from, to, LDL_FLAG_NONE); - if (!session) { - return LDL_STATUS_MEMERR; - } - } - - if (!session) { - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Non-Existent Session %s!\n", id); - } - return LDL_STATUS_MEMERR; - } - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Message for Session %s\n", id); - } - - - if (action) { - - if (!strcasecmp(action, "redirect")) { - apr_hash_t *hash = session->handle->sessions; - char *p = to; - if ((p = strchr(to, ':'))) { - p++; - } else { - p = to; - } - - - apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); - apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); - session->them = apr_pstrdup(session->pool, p); - apr_hash_set(handle->sessions, session->them, APR_HASH_KEY_STRING, session); - apr_hash_set(handle->sessions, session->id, APR_HASH_KEY_STRING, session); - - dl_signal = LDL_SIGNAL_REDIRECT; - } else if (!strcasecmp(action, "session-initiate") || !strcasecmp(action, "session-accept")) { - - dl_signal = LDL_SIGNAL_INITIATE; - - if (!strcasecmp(action, "session-accept")) { - msg = "accept"; - } - - if (!session->initiator && initiator) { - session->initiator = apr_pstrdup(session->pool, initiator); - } - tag = iks_child (xml); - - while(tag) { - - if (!strcasecmp(iks_name_nons(tag), "content")) { - iks *dtag = iks_child (tag); - char key[512]; - - if (!strcasecmp(iks_name_nons(dtag), "description")) { - iks *itag = iks_child (dtag); - char *name = iks_find_attrib(tag, "name"); - char *media = iks_find_attrib(dtag, "media"); - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Found description of type '%s' media type '%s'\n", name, media); - - } - - while(itag) { - if (!strcasecmp(iks_name_nons(itag), "rtcp-mux")) { - snprintf(key, sizeof(key), "%s:rtcp-mux", media); - ldl_session_set_value(session, key, "true"); - } - - if (!strcasecmp(iks_name_nons(itag), "encryption")) { - iks *etag = iks_child (itag); - - while(etag) { - char *suite = iks_find_attrib(etag, "crypto-suite"); - char *params = iks_find_attrib(etag, "key-params"); - char *tag = iks_find_attrib(etag, "tag"); - char val[512]; - - if (suite && params && tag) { - snprintf(key, sizeof(key), "%s:crypto:%s", media, tag); - snprintf(val, sizeof(val), "%s %s %s", tag, suite, params); - - ldl_session_set_value(session, key, val); - } - - etag = iks_next_tag(etag); - } - } - - - if (!strcasecmp(iks_name_nons(itag), "payload-type") && session->payload_len < LDL_MAX_PAYLOADS) { - char *name = iks_find_attrib(itag, "name"); - char *id = iks_find_attrib(itag, "id"); - char *rate = iks_find_attrib(itag, "clockrate"); - - if (name && id) { - session->payloads[session->payload_len].name = apr_pstrdup(session->pool, name); - session->payloads[session->payload_len].id = atoi(id); - if (rate) { - session->payloads[session->payload_len].rate = atoi(rate); - } else { - if (!strcasecmp(media, "video")) { - session->payloads[session->payload_len].rate = 90000; - } else { - session->payloads[session->payload_len].rate = 8000; - } - } - session->payload_len++; - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Add Payload [%s] id='%s'\n", name, id); - } - } - } - itag = iks_next_tag(itag); - } - - } - } - - tag = iks_next_tag(tag); - } - } else if (!strcasecmp(action, "transport-accept")) { - dl_signal = LDL_SIGNAL_TRANSPORT_ACCEPT; - } else if (!strcasecmp(action, "reject")) { - dl_signal = LDL_SIGNAL_REJECT; - } else if (!strcasecmp(action, "transport-info")) { - - tag = iks_child (xml); - - while(tag) { - - if (!strcasecmp(iks_name_nons(tag), "content")) { - iks *ttag = iks_child (tag); - - dl_signal = LDL_SIGNAL_CANDIDATES; - - id = action; - - if (ttag && !strcasecmp(iks_name_nons(ttag), "transport")) { - ttag = iks_child(ttag); - } - - for (;ttag;ttag = iks_next_tag(ttag)) { - if (!strcasecmp(iks_name_nons(ttag), "info_element")) { - char *name = iks_find_attrib(ttag, "name"); - char *value = iks_find_attrib(ttag, "value"); - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Info Element [%s]=[%s]\n", name, value); - } - ldl_session_set_value(session, name, value); - - } else if (!strcasecmp(iks_name_nons(ttag), "candidate")) { - char *key; - double pref = 0.0; - int index = -1; - ldl_transport_type_t tport; - unsigned int *candidate_len = NULL; - ldl_candidate_t (*candidates)[LDL_MAX_CANDIDATES] = NULL; - - if ((key = iks_find_attrib(ttag, "preference"))) { - unsigned int x; - - pref = strtod(key, NULL); - - /* Check what kind of candidate this is */ - if ((key = iks_find_attrib(ttag, "name")) && ((tport = ldl_transport_type_parse(key)) != LDL_TPORT_MAX)) { - candidates = &(session->candidates[tport]); - candidate_len = &(session->candidate_len[tport]); - } else { - globals.logger(DL_LOG_WARNING, "No such transport type: %s\n", key); - continue; - } - - if (*candidate_len >= LDL_MAX_CANDIDATES) { - globals.logger(DL_LOG_WARNING, "Too many %s candidates\n", key); - continue; - } - - for (x = 0; x < *candidate_len; x++) { - if ((*candidates)[x].pref == pref) { - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Duplicate Pref!\n"); - } - index = x; - break; - } - } - } else { - globals.logger(DL_LOG_WARNING, "No preference specified"); - continue; - } - - if (index < 0) { - index = (*candidate_len)++; - } - - (*candidates)[index].pref = pref; - - if ((key = iks_find_attrib(ttag, "name"))) { - (*candidates)[index].name = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(ttag, "type"))) { - (*candidates)[index].type = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(ttag, "protocol"))) { - (*candidates)[index].protocol = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(ttag, "username"))) { - (*candidates)[index].username = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(ttag, "password"))) { - (*candidates)[index].password = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(ttag, "address"))) { - (*candidates)[index].address = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(ttag, "port"))) { - (*candidates)[index].port = (uint16_t)atoi(key); - } - - if (!(*candidates)[index].type) { - (*candidates)[index].type = apr_pstrdup(session->pool, "stun"); - } - - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, - "New Candidate %d\n" - "name=%s\n" - "type=%s\n" - "protocol=%s\n" - "username=%s\n" - "password=%s\n" - "address=%s\n" - "port=%d\n" - "pref=%0.2f\n", - *candidate_len, - (*candidates)[index].name, - (*candidates)[index].type, - (*candidates)[index].protocol, - (*candidates)[index].username, - (*candidates)[index].password, - (*candidates)[index].address, - (*candidates)[index].port, - (*candidates)[index].pref - ); - } - } - } - } - - tag = iks_next_tag(tag); - } - } else if (!strcasecmp(action, "session-terminate")) { - dl_signal = LDL_SIGNAL_TERMINATE; - } else if (!strcasecmp(action, "error")) { - dl_signal = LDL_SIGNAL_ERROR; - } - } - - - - if (handle->session_callback && dl_signal) { - handle->session_callback(handle, session, dl_signal, to, from, id, msg); - } - - return LDL_STATUS_SUCCESS; -} - - - -const char *marker = "TRUE"; - - -static int on_vcard(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_VCARD, to, from, pak->id, NULL); - } - - return IKS_FILTER_EAT; -} - - -static int on_disco_default(void *user_data, ikspak *pak) -{ - char *node = NULL; - char *ns = NULL; - ldl_handle_t *handle = user_data; - iks *iq = NULL, *query, *tag; - uint8_t send = 0; - int x; - - if (pak && pak->query) { - ns = iks_find_attrib(pak->query, "xmlns"); - node = iks_find_attrib(pak->query, "node"); - } - - if (pak && pak->subtype == IKS_TYPE_RESULT) { - globals.logger(DL_LOG_CRIT, "FixME!!! node=[%s]\n", node?node:""); - } else if (pak && pak->subtype == IKS_TYPE_GET) { - if (ns && (iq = iks_new("iq"))) { - int all = 0; - - iks_insert_attrib(iq, "from", handle->login); - if (pak->from) { - iks_insert_attrib(iq, "to", pak->from->full); - } - iks_insert_attrib(iq, "id", pak->id); - iks_insert_attrib(iq, "type", "result"); - - if (!(query = iks_insert (iq, "query"))) { - goto fail; - } - iks_insert_attrib(query, "xmlns", ns); - - if (!strcasecmp(ns, FEATURE_LAST)) { - iks_insert_attrib(query, "seconds", "1"); - } - - if (!(tag = iks_insert (query, "identity"))) { - goto fail; - } - - iks_insert_attrib(tag, "category", "gateway"); - //iks_insert_attrib(tag, "type", "voice"); - iks_insert_attrib(tag, "name", "LibDingaLing"); - - if (!strcasecmp(ns, FEATURE_DISCO_INFO)) { - if (!node) { - all++; - } else { - char *p; - - if ((p = strstr(node, "caps#"))) { - char *what = p + 5; - - if (!strcasecmp(what, "voice-v1")) { - if (!(tag = iks_insert (query, "feature"))) { - goto fail; - } - iks_insert_attrib(tag, "var", FEATURE_VOICE); - goto done; - } - - } - } - } - - for (x = 0; FEATURES[x].name; x++) { - if (all || !ns || !strcasecmp(ns, FEATURES[x].name)) { - if (!(tag = iks_insert (query, "feature"))) { - goto fail; - } - iks_insert_attrib(tag, "var", FEATURES[x].name); - } - } - - done: - - apr_queue_push(handle->queue, iq); - iq = NULL; - send = 1; - } - fail: - - if (iq) { - iks_delete(iq); - } - - if (!send) { - globals.logger(DL_LOG_CRIT, "Memory Error!\n"); - } - } - - return IKS_FILTER_EAT; -} - -static int on_presence(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - char *type = iks_find_attrib(pak->x, "type"); - char *show = iks_find_cdata(pak->x, "show"); - char *status = iks_find_cdata(pak->x, "status"); - char id[1024]; - char *resource; - struct ldl_buffer *buffer; - ldl_signal_t dl_signal = LDL_SIGNAL_PRESENCE_IN; - int done = 0; - - - if (type && *type) { - if (!strcasecmp(type, "unavailable")) { - dl_signal = LDL_SIGNAL_PRESENCE_OUT; - } else if (!strcasecmp(type, "probe")) { - dl_signal = LDL_SIGNAL_PRESENCE_PROBE; - } - if (!status) { - status = type; - } - } else { - if (!status) { - status = "Available"; - } - } - - - apr_cpystrn(id, from, sizeof(id)); - lowercase(id); - - if ((resource = strchr(id, '/'))) { - *resource++ = '\0'; - } - - - if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) { - iks *msg; - apr_hash_set(handle->sub_hash, apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker); - if ((msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling...."))) { - apr_queue_push(handle->queue, msg); - msg = NULL; - } - } - - if (resource && (strstr(resource, "talk") || strstr(resource, "telepathy")) && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) { - apr_cpystrn(buffer->buf, from, buffer->len); - buffer->hit = 1; - done = 1; - } - - if (!done) { - iks *xml = iks_find(pak->x, "c"); - if (!xml) { - xml = iks_find(pak->x, "caps:c"); - } - - if (xml) { - char *ext = iks_find_attrib(xml, "ext");; - if (ext && strstr(ext, "voice-v1") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) { - apr_cpystrn(buffer->buf, from, buffer->len); - buffer->hit = 1; - } - } - } - - - if (handle->session_callback) { - handle->session_callback(handle, NULL, dl_signal, to, id, status ? status : "n/a", show ? show : "n/a"); - } - - return IKS_FILTER_EAT; -} - -static char *ldl_handle_strdup(ldl_handle_t *handle, char *str) -{ - char *dup; - apr_size_t len; - - len = strlen(str) + 1; - dup = apr_palloc(handle->pool, len); - assert(dup != NULL); - strncpy(dup, str, len); - return dup; -} - -static void ldl_strip_resource(char *in) -{ - char *p; - - if ((p = strchr(in, '/'))) { - *p = '\0'; - } -} - -static ldl_avatar_t *ldl_get_avatar(ldl_handle_t *handle, char *path, char *from) -{ - ldl_avatar_t *ap; - uint8_t image[8192]; - unsigned char base64[9216] = ""; - int fd = -1; - size_t bytes; - char *key; - //char hash[128] = ""; - - if (from && (ap = (ldl_avatar_t *) apr_hash_get(globals.avatar_hash, from, APR_HASH_KEY_STRING))) { - return ap; - } - - if (path && from) { - if ((ap = (ldl_avatar_t *) apr_hash_get(globals.avatar_hash, path, APR_HASH_KEY_STRING))) { - key = ldl_handle_strdup(handle, from); - ldl_strip_resource(key); - apr_hash_set(globals.avatar_hash, key, APR_HASH_KEY_STRING, ap); - return ap; - } - } - - if (!(path && from)) { - return NULL; - } - - if ((fd = open(path, O_RDONLY, 0)) < 0) { - globals.logger(DL_LOG_ERR, "File %s does not exist!\n", path); - return NULL; - } - - bytes = read(fd, image, sizeof(image)); - close(fd); - - ap = malloc(sizeof(*ap)); - assert(ap != NULL); - memset(ap, 0, sizeof(*ap)); - sha1_hash(ap->hash, (unsigned char *) image, (unsigned int)bytes); - ap->path = strdup(path); - - key = ldl_handle_strdup(handle, from); - ldl_strip_resource(key); - - b64encode((unsigned char *)image, bytes, base64, sizeof(base64)); - ap->base64 = strdup((const char *)base64); - apr_hash_set(globals.avatar_hash, ap->path, APR_HASH_KEY_STRING, ap); - apr_hash_set(globals.avatar_hash, key, APR_HASH_KEY_STRING, ap); - return ap; -} - - -static void do_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message, char *avatar) -{ - iks *pres; - char buf[512]; - iks *tag; - - if (from && !strchr(from, '/')) { - snprintf(buf, sizeof(buf), "%s/talk", from); - from = buf; - } - - if (ldl_test_flag(handle, LDL_FLAG_COMPONENT) && from && to && ldl_jid_domcmp(from, to)) { - globals.logger(DL_LOG_ERR, "Refusal to send presence from and to the same domain in component mode [%s][%s]\n", from, to); - return; - } - - if ((pres = iks_new("presence"))) { - iks_insert_attrib(pres, "xmlns", "jabber:client"); - if (from) { - iks_insert_attrib(pres, "from", from); - } - if (to) { - iks_insert_attrib(pres, "to", to); - } - if (type) { - iks_insert_attrib(pres, "type", type); - } - - if (rpid) { - if ((tag = iks_insert (pres, "show"))) { - iks_insert_cdata(tag, rpid, 0); - } - } - - if (message) { - if ((tag = iks_insert (pres, "status"))) { - iks_insert_cdata(tag, message, 0); - } - } - - if (message || rpid) { - ldl_avatar_t *ap; - - if (avatar) { - if ((ap = ldl_get_avatar(handle, avatar, from))) { - if ((tag = iks_insert(pres, "x"))) { - iks *hash; - iks_insert_attrib(tag, "xmlns", "vcard-temp:x:update"); - if ((hash = iks_insert(tag, "photo"))) { - iks_insert_cdata(hash, ap->hash, 0); - } - } - } - } - - if ((tag = iks_insert(pres, "c"))) { - iks_insert_attrib(tag, "node", "http://www.freeswitch.org/xmpp/client/caps"); - iks_insert_attrib(tag, "ver", LDL_CAPS_VER); - iks_insert_attrib(tag, "ext", "sidebar voice-v1 video-v1 camera-v1"); - iks_insert_attrib(tag, "client", "libdingaling"); - iks_insert_attrib(tag, "xmlns", "http://jabber.org/protocol/caps"); - } - } - - apr_queue_push(handle->queue, pres); - pres = NULL; - } -} - -static void do_roster(ldl_handle_t *handle) -{ - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_ROSTER, NULL, handle->login, NULL, NULL); - } -} - -static int on_unsubscribe(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_UNSUBSCRIBE, to, from, NULL, NULL); - } - - return IKS_FILTER_EAT; -} - -static int on_subscribe(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - iks *msg = NULL; - char *id = strdup(from); - char *r; - - if (!id) { - return -1; - } - if ((r = strchr(from, '/'))) { - *r++ = '\0'; - } - - if ((msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling...."))) { - if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - iks_insert_attrib(msg, "from", to); - } - - apr_queue_push(handle->queue, msg); - msg = NULL; - } - - if ((msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, "Ding A Ling...."))) { - - if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - iks_insert_attrib(msg, "from", to); - } - - apr_queue_push(handle->queue, msg); - msg = NULL; - } - - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_SUBSCRIBE, to, from, NULL, NULL); - } - - if (id) free(id); - - return IKS_FILTER_EAT; -} - -static void cancel_retry(ldl_handle_t *handle, char *id) -{ - struct packet_node *packet_node; - - apr_thread_mutex_lock(handle->lock); - if ((packet_node = apr_hash_get(handle->retry_hash, id, APR_HASH_KEY_STRING))) { - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Cancel packet %s\n", packet_node->id); - } - packet_node->retries = 0; - } - apr_thread_mutex_unlock(handle->lock); -} - -static iks* working_find(iks *tag, const char *name) -{ - while(tag) { - if (!strcasecmp(iks_name(tag), name)) { - return tag; - } - tag = iks_next_tag(tag); - } - - return NULL; -} - -static iks* working_find_nons(iks *tag, const char *name) -{ - while(tag) { - char *a = iks_name(tag); - char *b = (char *)name; - char *p; - - if ((p = strchr(a, ':'))) { - a = p+1; - } - - if ((p = strchr(b, ':'))) { - b = p+1; - } - - if (!strcasecmp(a,b)) { - return tag; - } - tag = iks_next_tag(tag); - } - - return NULL; -} - -static int on_commands(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - char *iqid = iks_find_attrib(pak->x, "id"); - char *type = iks_find_attrib(pak->x, "type"); - uint8_t is_result = strcasecmp(type, "result") ? 0 : 1; - uint8_t is_error = strcasecmp(type, "error") ? 0 : 1; - iks *xml, *xsession, *xerror = NULL, *xredir = NULL; - iks *xjingle; - - - xml = iks_child (pak->x); - - if (is_error) { - if ((xerror = working_find(xml, "error"))) { - char *code = iks_find_attrib(xerror, "code"); - if (code && !strcmp(code, "302") && - ((xredir = iks_find(xerror, "ses:redirect")) || (xredir = iks_find(xerror, "redirect")))) { - is_result = 0; - is_error = 0; - cancel_retry(handle, iqid); - } - } - } - - - if (is_result) { - iks *tag = iks_child (pak->x); - while(tag) { - if (!strcasecmp(iks_name_nons(tag), "bind")) { - char *jid = iks_find_cdata(tag, "jid"); - char *resource = strchr(jid, '/'); - if (resource) { - resource++; - handle->acc->resource = apr_pstrdup(handle->pool, resource); - } - handle->login = apr_pstrdup(handle->pool, jid); -#if 0 - if ((iq = iks_new("iq"))) { - iks_insert_attrib(iq, "type", "get"); - iks_insert_attrib(iq, "id", "roster"); - x = iks_insert(iq, "query"); - iks_insert_attrib(x, "xmlns", "jabber:iq:roster"); - iks_insert_attrib(x, "xmlns:gr", "google:roster"); - iks_insert_attrib(x, "gr:ext", "2"); - iks_insert_attrib(x, "gr:include", "all"); - apr_queue_push(handle->queue, iq); - iq = NULL; - break; - } -#endif - } - tag = iks_next_tag(tag); - } - } - - - - if ((is_result || is_error) && iqid && from) { - - cancel_retry(handle, iqid); - - if (is_result) { - if (handle->response_callback) { - handle->response_callback(handle, iqid); - } - return IKS_FILTER_EAT; - } else if (is_error) { - return IKS_FILTER_EAT; - - } - } - - - - if ((handle->flags & LDL_FLAG_JINGLE) && (xjingle = working_find_nons(xml, "jin:jingle"))) { - if (parse_jingle_code(handle, xjingle, to, from, type) == LDL_STATUS_SUCCESS) { - iks *reply; - if ((reply = iks_make_iq(IKS_TYPE_RESULT, NULL))) { - iks_insert_attrib(reply, "to", from); - iks_insert_attrib(reply, "from", to); - iks_insert_attrib(reply, "id", iqid); - apr_queue_push(handle->queue, reply); - reply = NULL; - } - } - - } else if ((xsession = working_find_nons(xml, "ses:session"))) { - char *id; - - id = iks_find_attrib(xsession, "id"); - - if (xredir) { - to = iks_cdata(iks_child(xredir)); - type = "redirect"; - } - - if (strcasecmp(type, "error") && strcasecmp(type, "redirect")) { - type = NULL; - } - - if (parse_session_code(handle, id, from, to, xsession, type) == LDL_STATUS_SUCCESS) { - iks *reply; - if ((reply = iks_make_iq(IKS_TYPE_RESULT, NULL))) { - iks_insert_attrib(reply, "to", from); - iks_insert_attrib(reply, "from", to); - iks_insert_attrib(reply, "id", iqid); - apr_queue_push(handle->queue, reply); - reply = NULL; - } - } - } - - return IKS_FILTER_EAT; -} - - -static int on_result(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - iks *msg, *ctag, *tag; - - if ((msg = iks_make_pres (IKS_SHOW_AVAILABLE, handle->status_msg))) { - ctag = iks_insert(msg, "c"); - iks_insert_attrib(ctag, "node", "http://www.freeswitch.org/xmpp/client/caps"); - iks_insert_attrib(ctag, "ver", "1.0.0.1"); - iks_insert_attrib(ctag, "ext", "sidebar voice-v1 video-v1"); - iks_insert_attrib(ctag, "client", "libdingaling"); - iks_insert_attrib(ctag, "xmlns", "http://jabber.org/protocol/caps"); - - if (handle->priority && strlen(handle->priority)) { - tag = iks_insert (msg, "priority"); - iks_insert_cdata(tag, handle->priority, 0); - } - - apr_queue_push(handle->queue, msg); - msg = NULL; - } - return IKS_FILTER_EAT; -} - -static const char c64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -#define B64BUFFLEN 1024 - -static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t olen) -{ - int y=0,bytes=0; - size_t x=0; - unsigned int b=0,l=0; - - for(x=0;x= 6) { - out[bytes++] = c64[(b>>(l-=6))%64]; - if(++y!=72) { - continue; - } - //out[bytes++] = '\n'; - y=0; - } - } - - if (l > 0) { - out[bytes++] = c64[((b%16)<<(6-l))%64]; - } - if (l != 0) while (l < 6) { - out[bytes++] = '=', l += 2; - } - - return 0; -} - -static void sha1_hash(char *out, unsigned char *in, unsigned int len) -{ - SHA1Context sha; - char *p; - int x; - unsigned char digest[SHA1_HASH_SIZE] = ""; - - SHA1Init(&sha); - - SHA1Update(&sha, in, len); - - SHA1Final(&sha, digest); - - p = out; - for (x = 0; x < SHA1_HASH_SIZE; x++) { - p += sprintf(p, "%2.2x", digest[x]); - } -} - - -static int on_stream_component(ldl_handle_t *handle, int type, iks *node) -{ - ikspak *pak = NULL; - - if (node) { - pak = iks_packet(node); - } - - switch (type) { - case IKS_NODE_START: - if (pak && handle->state == CS_NEW) { - char secret[256] = ""; - char hash[256] = ""; - char handshake[512] = ""; - - snprintf(secret, sizeof(secret), "%s%s", pak->id, handle->password); - sha1_hash(hash, (unsigned char *) secret, (unsigned int)strlen(secret)); - snprintf(handshake, sizeof(handshake), "%s", hash); - iks_send_raw(handle->parser, handshake); - handle->state = CS_START; - if (iks_recv(handle->parser, 1) == 2) { - handle->state = CS_CONNECTED; - if (!ldl_test_flag(handle, LDL_FLAG_AUTHORIZED)) { - do_roster(handle); - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_LOGIN_SUCCESS, "user", "core", "Login Success", handle->login); - } - globals.logger(DL_LOG_DEBUG, "XMPP authenticated\n"); - ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED); - ldl_set_flag_locked(handle, LDL_FLAG_CONNECTED); - handle->fail_count = 0; - } - } else { - globals.logger(DL_LOG_ERR, "LOGIN ERROR!\n"); - handle->state = CS_NEW; - } - break; - } - break; - - case IKS_NODE_NORMAL: - break; - - case IKS_NODE_ERROR: - globals.logger(DL_LOG_ERR, "NODE ERROR!\n"); - return IKS_HOOK; - - case IKS_NODE_STOP: - globals.logger(DL_LOG_ERR, "DISCONNECTED!\n"); - return IKS_HOOK; - } - - iks_filter_packet(handle->filter, pak); - - if (handle->job_done == 1) { - return IKS_HOOK; - } - - if (node) { - iks_delete(node); - } - - return IKS_OK; -} - -static int on_stream(ldl_handle_t *handle, int type, iks *node) -{ - handle->counter = opt_timeout; - - - switch (type) { - case IKS_NODE_START: - if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser)) { - if (iks_has_tls()) { - iks_start_tls(handle->parser); - } else { - globals.logger(DL_LOG_WARNING, "TLS NOT SUPPORTED IN THIS BUILD!\n"); - } - } - break; - case IKS_NODE_NORMAL: - if (node && strcmp("stream:features", iks_name(node)) == 0) { - handle->features = iks_stream_features(node); - if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser)) - break; - if (ldl_test_flag(handle, LDL_FLAG_CONNECTED)) { - iks *t; - if (handle->features & IKS_STREAM_BIND) { - if ((t = iks_make_resource_bind(handle->acc))) { - apr_queue_push(handle->queue, t); - t = NULL; - } - } - if (handle->features & IKS_STREAM_SESSION) { - if ((t = iks_make_session())) { - iks_insert_attrib(t, "id", "auth"); - apr_queue_push(handle->queue, t); - t = NULL; - } - } - } else { - if (handle->features & IKS_STREAM_SASL_MD5) { - iks_start_sasl(handle->parser, IKS_SASL_DIGEST_MD5, handle->acc->user, handle->password); - } else if (handle->features & IKS_STREAM_SASL_PLAIN) { - iks *x = NULL; - - if ((x = iks_new("auth"))) { - char s[512] = ""; - char base64[1024] = ""; - uint32_t slen; - - iks_insert_attrib(x, "xmlns", IKS_NS_XMPP_SASL); - iks_insert_attrib(x, "mechanism", "PLAIN"); - iks_insert_attrib(x, "encoding", "UTF-8"); - snprintf(s, sizeof(s), "%c%s%c%s", 0, handle->acc->user, 0, handle->password); - slen = (uint32_t)(strlen(handle->acc->user) + strlen(handle->password) + 2); - b64encode((unsigned char *)s, slen, (unsigned char *) base64, sizeof(base64)); - iks_insert_cdata(x, base64, 0); - apr_queue_push(handle->queue, x); - x = NULL; - } else { - globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); - break; - } - - } - } - } else if (node && strcmp("failure", iks_name_nons(node)) == 0) { - globals.logger(DL_LOG_CRIT, "sasl authentication failed\n"); - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_LOGIN_FAILURE, "user", "core", "Login Failure", handle->login); - } - } else if (node && strcmp("success", iks_name_nons(node)) == 0) { - globals.logger(DL_LOG_NOTICE, "XMPP server connected\n"); - iks_send_header(handle->parser, handle->acc->server); - ldl_set_flag_locked(handle, LDL_FLAG_CONNECTED); - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_CONNECTED, "user", "core", "Server Connected", handle->login); - } - } else { - ikspak *pak; - if (!ldl_test_flag(handle, LDL_FLAG_AUTHORIZED)) { - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_LOGIN_SUCCESS, "user", "core", "Login Success", handle->login); - } - globals.logger(DL_LOG_NOTICE, "XMPP authenticated\n"); - ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED); - } - if (node) { - pak = iks_packet(node); - iks_filter_packet(handle->filter, pak); - } - if (handle->job_done == 1) { - return IKS_HOOK; - } - } - break; -#if 0 - case IKS_NODE_STOP: - globals.logger(DL_LOG_DEBUG, "server disconnected\n"); - break; - - case IKS_NODE_ERROR: - globals.logger(DL_LOG_DEBUG, "stream error\n"); - break; -#endif - - } - - if (node) { - iks_delete(node); - } - return IKS_OK; -} - -static int on_msg(void *user_data, ikspak *pak) -{ - char *cmd = iks_find_cdata(pak->x, "body"); - char *to = iks_find_attrib(pak->x, "to"); - char *from = iks_find_attrib(pak->x, "from"); - char *subject = iks_find_attrib(pak->x, "subject"); - ldl_handle_t *handle = user_data; - ldl_session_t *session = NULL; - - if (from) { - session = apr_hash_get(handle->sessions, from, APR_HASH_KEY_STRING); - } - - if (handle->session_callback) { - handle->session_callback(handle, session, LDL_SIGNAL_MSG, to, from, subject ? subject : "N/A", cmd); - } - - return 0; -} - -static int on_error(void *user_data, ikspak * pak) -{ - globals.logger(DL_LOG_ERR, "authorization failed\n"); - return IKS_FILTER_EAT; -} - -static void on_log(ldl_handle_t *handle, const char *data, size_t size, int is_incoming) -{ - - if (globals.debug) { - if (is_incoming) { - globals.logger(DL_LOG_INFO, "+xml:%s%s:%s", iks_is_secure(handle->parser) ? "Sec" : "", is_incoming ? "RECV" : "SEND", data); - } else { - globals.logger(DL_LOG_NOTICE, "+xml:%s%s:%s", iks_is_secure(handle->parser) ? "Sec" : "", is_incoming ? "RECV" : "SEND", data); - } - } -} - -static void j_setup_filter(ldl_handle_t *handle) -{ - int x = 0; - - if (handle->filter) { - iks_filter_delete(handle->filter); - } - handle->filter = iks_filter_new(); - - iks_filter_add_rule(handle->filter, on_msg, handle, IKS_RULE_TYPE, IKS_PAK_MESSAGE, IKS_RULE_SUBTYPE, IKS_TYPE_CHAT, IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_result, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, IKS_RULE_ID, "auth", IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_presence, handle, - IKS_RULE_TYPE, IKS_PAK_PRESENCE, - //IKS_RULE_SUBTYPE, IKS_TYPE_SET, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_commands, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_SET, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_commands, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_commands, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_ERROR, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_subscribe, handle, - IKS_RULE_TYPE, IKS_PAK_S10N, - IKS_RULE_SUBTYPE, IKS_TYPE_SUBSCRIBE, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_unsubscribe, handle, - IKS_RULE_TYPE, IKS_PAK_S10N, - IKS_RULE_SUBTYPE, IKS_TYPE_UNSUBSCRIBE, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_error, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_ERROR, IKS_RULE_ID, "auth", IKS_RULE_DONE); - - for (x = 0; FEATURES[x].name; x++) { - iks_filter_add_rule(handle->filter, FEATURES[x].callback, handle, - IKS_RULE_NS, FEATURES[x].name, IKS_RULE_DONE); - } -} - -static ldl_queue_t ldl_flush_queue(ldl_handle_t *handle, int done) -{ - iks *msg; - void *pop = NULL; - unsigned int len = 0, x = 0; - - ldl_queue_t sent_data = LDL_QUEUE_NONE; - - apr_thread_mutex_lock(handle->lock); - - while(apr_queue_trypop(handle->queue, &pop) == APR_SUCCESS) { - if (pop) { - msg = (iks *) pop; - if (!done) { - if (iks_send(handle->parser, msg) != IKS_OK) { - globals.logger(DL_LOG_DEBUG, "Failed sending data!\n"); - }; - }; - iks_delete(msg); - pop = NULL; - sent_data = LDL_QUEUE_SENT; - } else { - break; - } - } - - len = apr_queue_size(handle->retry_queue); - if (globals.debug && len) { - globals.logger(DL_LOG_CRIT, "Processing %u packets in retry queue\n", len); - } - - pop = NULL; - - while(x < len && apr_queue_trypop(handle->retry_queue, &pop) == APR_SUCCESS) { - if (!pop) { - break; - } else { - struct packet_node *packet_node = (struct packet_node *) pop; - apr_time_t now = apr_time_now(); - x++; - - if (packet_node->next <= now) { - if (packet_node->retries > 0) { - packet_node->retries--; - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Sending packet %s (%d left)\n", packet_node->id, packet_node->retries); - } - if (iks_send(handle->parser, packet_node->xml) != IKS_OK) { - globals.logger(DL_LOG_DEBUG, "Failed trying re-sending data!\n"); - }; - packet_node->next = now + 5000000; - sent_data = LDL_QUEUE_SENT; - } - } - if (packet_node->retries == 0 || done) { - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Discarding packet %s\n", packet_node->id); - } - apr_hash_set(handle->retry_hash, packet_node->id, APR_HASH_KEY_STRING, NULL); - iks_delete(packet_node->xml); - free(packet_node); - } else { - apr_queue_push(handle->retry_queue, packet_node); - packet_node = NULL; - } - pop = NULL; - } - } - apr_thread_mutex_unlock(handle->lock); - return sent_data; -} - - -static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass) -{ - int count_ka = LDL_KEEPALIVE_TIMEOUT; - time_t tstart, tnow; - - while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) { - int e; - char tmp[512], *sl; - int fd; - - handle->parser = iks_stream_new(ldl_test_flag(handle, LDL_FLAG_COMPONENT) ? IKS_NS_COMPONENT : IKS_NS_CLIENT, - handle, - (iksStreamHook *) (ldl_test_flag(handle, LDL_FLAG_COMPONENT) ? on_stream_component : on_stream)); - - - iks_set_log_hook(handle->parser, (iksLogHook *) on_log); - - - strncpy(tmp, jabber_id, sizeof(tmp)-1); - sl = strchr(tmp, '/'); - - if (!sl && !ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - /* user gave no resource name, use the default */ - snprintf(tmp + strlen(tmp), sizeof(tmp) - strlen(tmp), "/%s", "talk"); - } else if (sl && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - *sl = '\0'; - } - - handle->acc = iks_id_new(iks_parser_stack(handle->parser), tmp); - - handle->password = pass; - - j_setup_filter(handle); - - globals.logger(DL_LOG_DEBUG, "xmpp connecting\n"); - - e = iks_connect_via(handle->parser, - handle->server ? handle->server : handle->acc->server, - handle->port ? handle->port : IKS_JABBER_PORT, - handle->acc->server); - - switch (e) { - case IKS_OK: - break; - case IKS_NET_NODNS: - globals.logger(DL_LOG_CRIT, "hostname lookup failed\n"); - microsleep(1000); - goto fail; - case IKS_NET_NOCONN: - globals.logger(DL_LOG_CRIT, "connection failed\n"); - microsleep(1000); - goto fail; - default: - globals.logger(DL_LOG_CRIT, "io error 1 %d\n", e); - microsleep(1000); - goto fail; - } - - handle->counter = opt_timeout; - if ((tstart = time(NULL)) == -1) { - globals.logger(DL_LOG_DEBUG, "error determining connection time"); - } - - while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) { - e = iks_recv(handle->parser, 1); - - if (handle->loop_callback) { - if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS) { - ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); - break; - } - } - - if (handle->job_done) { - break; - } - - if (IKS_HOOK == e) { - break; - } - - if (IKS_OK != e || ldl_test_flag(handle, LDL_FLAG_BREAK)) { - globals.logger(DL_LOG_DEBUG, "io error 2 %d retry in %d second(s)", e, ++handle->fail_count); - if ((tnow = time(NULL)) == -1) { - globals.logger(DL_LOG_DEBUG, "error deterniming io error time"); - } - if (difftime(tnow, tstart) > 30) { - /* this is a new error situation: reset counter */ - globals.logger(DL_LOG_DEBUG, "resetting fail count"); - handle->fail_count = 1; - } - microsleep(1000 * handle->fail_count); - goto fail; - } - - if (ldl_test_flag(handle, LDL_FLAG_RUNNING)) { - if (ldl_flush_queue(handle, 0) == LDL_QUEUE_SENT) { - count_ka = LDL_KEEPALIVE_TIMEOUT; - } - } - - if (!ldl_test_flag(handle, LDL_FLAG_CONNECTED)) { - handle->counter--; - - if (IKS_NET_TLSFAIL == e) { - globals.logger(DL_LOG_CRIT, "tls handshake failed\n"); - microsleep(500); - break; - } - - if (handle->counter == 0) { - globals.logger(DL_LOG_CRIT, "network timeout\n"); - microsleep(500); - break; - } - } - - if (count_ka-- <= 0) { - if( iks_send_raw(handle->parser, " ") == IKS_OK) { - globals.logger(DL_LOG_DEBUG, "Sent keep alive signal"); - count_ka = LDL_KEEPALIVE_TIMEOUT; - } else { - globals.logger(DL_LOG_DEBUG, "Failed sending keep alive signal"); - microsleep(500); - break; - } - } - - } - - fail: - - ldl_clear_flag_locked(handle, LDL_FLAG_CONNECTED); - ldl_clear_flag_locked(handle, LDL_FLAG_AUTHORIZED); - ldl_clear_flag_locked(handle, LDL_FLAG_BREAK); - handle->state = CS_NEW; - - if ((fd = iks_fd(handle->parser)) > -1) { - shutdown(fd, 0x02); - } - - iks_disconnect(handle->parser); - iks_parser_delete(handle->parser); - } - ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); - - ldl_flush_queue(handle, 1); - - ldl_set_flag_locked(handle, LDL_FLAG_STOPPED); - -} - -static void add_elements(ldl_session_t *session, iks *tag) -{ - apr_hash_index_t *hi; - return; - for (hi = apr_hash_first(session->pool, session->variables); hi; hi = apr_hash_next(hi)) { - void *val = NULL; - const void *key = NULL; - - apr_hash_this(hi, &key, NULL, &val); - if (val) { - iks *var = iks_insert(tag, "info_element"); - iks_insert_attrib(var, "xmlns", "http://www.freeswitch.org/jie"); - iks_insert_attrib(var, "name", (char *) key); - iks_insert_attrib(var, "value", (char *) val); - } - } -} - - -static iks *ldl_set_jingle_tag(ldl_session_t *session, iks *iq, char *action) -{ - iks *jin = iks_insert (iq, "jin:jingle"); - iks_insert_attrib(jin, "xmlns:jin", "urn:xmpp:jingle:1"); - iks_insert_attrib(jin, "action", action); - iks_insert_attrib(jin, "sid", session->id); - //iks_insert_attrib(jin, "initiator", session->initiator ? session->initiator : session->them); - - return jin; -} - -static ldl_status new_jingle_iq(ldl_session_t *session, iks **iqp, iks **jinp, unsigned int *id, char *action) -{ - iks *iq , *jin; - unsigned int myid; - char idbuf[80]; - - myid = next_id(); - snprintf(idbuf, sizeof(idbuf), "%u", myid); - iq = iks_new("iq"); - iks_insert_attrib(iq, "xmlns", "jabber:client"); - iks_insert_attrib(iq, "from", session->login); - iks_insert_attrib(iq, "to", session->them); - iks_insert_attrib(iq, "type", "set"); - iks_insert_attrib(iq, "id", idbuf); - - jin = ldl_set_jingle_tag(session, iq, action); - - *jinp = jin; - *iqp = iq; - *id = myid; - return LDL_STATUS_SUCCESS; -} - - -static ldl_status new_session_iq(ldl_session_t *session, iks **iqp, iks **sessp, unsigned int *id, char *type) -{ - iks *iq, *sess; - unsigned int myid; - char idbuf[80]; - - myid = next_id(); - snprintf(idbuf, sizeof(idbuf), "%u", myid); - iq = iks_new("iq"); - iks_insert_attrib(iq, "xmlns", "jabber:client"); - iks_insert_attrib(iq, "from", session->login); - iks_insert_attrib(iq, "to", session->them); - iks_insert_attrib(iq, "type", "set"); - iks_insert_attrib(iq, "id", idbuf); - sess = iks_insert (iq, "ses:session"); - iks_insert_attrib(sess, "xmlns:ses", "http://www.google.com/session"); - - iks_insert_attrib(sess, "type", type); - iks_insert_attrib(sess, "id", session->id); - iks_insert_attrib(sess, "initiator", session->initiator ? session->initiator : session->them); - - *sessp = sess; - *iqp = iq; - *id = myid; - return LDL_STATUS_SUCCESS; -} - -static void schedule_packet(ldl_handle_t *handle, unsigned int id, iks *xml, unsigned int retries) -{ - struct packet_node *packet_node; - - apr_thread_mutex_lock(handle->lock); - if ((packet_node = malloc(sizeof(*packet_node)))) { - memset(packet_node, 0, sizeof(*packet_node)); - snprintf(packet_node->id, sizeof(packet_node->id), "%u", id); - packet_node->xml = xml; - packet_node->retries = retries; - packet_node->next = apr_time_now(); - apr_hash_set(handle->retry_hash, packet_node->id, APR_HASH_KEY_STRING, packet_node); - apr_queue_push(handle->retry_queue, packet_node); - packet_node = NULL; - } - apr_thread_mutex_unlock(handle->lock); - -} - -char *ldl_session_get_caller(ldl_session_t *session) -{ - return session->them; -} - -char *ldl_session_get_callee(ldl_session_t *session) -{ - return session->login; -} - -void ldl_session_set_ip(ldl_session_t *session, char *ip) -{ - session->ip = apr_pstrdup(session->pool, ip); -} - -char *ldl_session_get_ip(ldl_session_t *session) -{ - return session->ip; -} - -void ldl_session_set_private(ldl_session_t *session, void *private_data) -{ - session->private_data = private_data; -} - -void *ldl_session_get_private(ldl_session_t *session) -{ - return session->private_data; -} - -void ldl_session_accept_candidate(ldl_session_t *session, ldl_candidate_t *candidate) -{ - iks *iq, *sess, *tp; - unsigned int myid; - char idbuf[80]; - myid = next_id(); - snprintf(idbuf, sizeof(idbuf), "%u", myid); - - if ((iq = iks_new("iq"))) { - if (!iks_insert_attrib(iq, "type", "set")) goto fail; - if (!iks_insert_attrib(iq, "id", idbuf)) goto fail; - if (!iks_insert_attrib(iq, "from", session->login)) goto fail; - if (!iks_insert_attrib(iq, "to", session->them)) goto fail; - if (!(sess = iks_insert (iq, "ses:session"))) goto fail; - if (!iks_insert_attrib(sess, "xmlns:ses", "http://www.google.com/session")) goto fail; - if (!iks_insert_attrib(sess, "type", "transport-accept")) goto fail; - if (!iks_insert_attrib(sess, "id", candidate->tid)) goto fail; - if (!iks_insert_attrib(sess, "xmlns", "http://www.google.com/session")) goto fail; - if (!iks_insert_attrib(sess, "initiator", session->initiator ? session->initiator : session->them)) goto fail; - if (!(tp = iks_insert (sess, "transport"))) goto fail; - if (!iks_insert_attrib(tp, "xmlns", "http://www.google.com/transport/p2p")) goto fail; - apr_queue_push(session->handle->queue, iq); - iq = NULL; - } - - fail: - if (iq) { - iks_delete(iq); - } - -} - -void *ldl_handle_get_private(ldl_handle_t *handle) -{ - return handle->private_info; -} - -char *ldl_handle_get_login(ldl_handle_t *handle) -{ - return handle->login; -} - -void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message, char *avatar) -{ - do_presence(handle, from, to, type, rpid, message, avatar); -} - -static void ldl_random_string(char *buf, uint16_t len, char *set) -{ - char chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - int max; - uint16_t x; - - if (!set) { - set = chars; - } - - max = (int) strlen(set); - - srand((unsigned int) time(NULL)); - - for (x = 0; x < len; x++) { - int j = (int) (max * 1.0 * rand() / (RAND_MAX + 1.0)); - buf[x] = set[j]; - } -} - -#define TLEN 8192 -void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, char *vcard) -{ - iks *vxml = NULL, *iq = NULL; - int e = 0; - ldl_avatar_t *ap = NULL; - char *text = NULL; - - ap = ldl_get_avatar(handle, NULL, from); - - if (!vcard) { - char *ext; - - if (!ap) { - return; - } - - if ((ext = strrchr(ap->path, '.'))) { - ext++; - } else { - ext = "png"; - } - text = malloc(TLEN); - snprintf(text, TLEN, - "image/%s%s", - ext, - ap->base64 - ); - vcard = text; - } else { - if (ap && (strstr(vcard, "photo") || strstr(vcard, "PHOTO"))) { - ldl_random_string(ap->hash, sizeof(ap->hash) -1, NULL); - } - } - - - if (!(vxml = iks_tree(vcard, 0, &e))) { - globals.logger(DL_LOG_ERR, "Parse returned error [%d]\n", e); - goto fail; - } - - if (!(iq = iks_new("iq"))) { - globals.logger(DL_LOG_ERR, "Memory Error\n"); - goto fail; - } - - if (!iks_insert_attrib(iq, "to", to)) goto fail; - if (!iks_insert_attrib(iq, "xmlns", "jabber:client")) goto fail; - if (!iks_insert_attrib(iq,"from", from)) goto fail; - if (!iks_insert_attrib(iq, "type", "result")) goto fail; - if (!iks_insert_attrib(iq, "id", id)) goto fail; - if (!iks_insert_node(iq, vxml)) goto fail; - - apr_queue_push(handle->queue, iq); - - iq = NULL; - vxml = NULL; - - fail: - - if (iq) { - iks_delete(iq); - } - - if (vxml) { - iks_delete(vxml); - } - - if (text) { - free(text); - } - -} - -void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char *subject, const char *body) -{ - iks *msg; - char *t, *e; - char *bdup = NULL; - int on = 0; - int len = 0; - char *my_body = strdup(body); - char *my_body_base = my_body; - - assert(handle != NULL); - assert(body != NULL); - - if (strchr(my_body, '<')) { - len = (int) strlen(my_body); - if (!(bdup = malloc(len))) { - if (my_body_base) { - free(my_body_base); - } - return; - } - - memset(bdup, 0, len); - - e = bdup; - for(t = my_body; *t; t++) { - if (*t == '<') { - on = 1; - } else if (*t == '>') { - t++; - on = 0; - } - - if (!on) { - *e++ = *t; - } - } - my_body = bdup; - } - - msg = iks_make_msg(IKS_TYPE_NONE, to, my_body); - iks_insert_attrib(msg, "type", "chat"); - - if (!from) { - from = handle->login; - } - - iks_insert_attrib(msg, "from", from); - - if (subject) { - iks_insert_attrib(msg, "subject", subject); - } - - if (bdup) { - free(bdup); - } - - if (my_body_base) { - free(my_body_base); - } - - apr_queue_push(handle->queue, msg); - msg = NULL; - -} - -int ldl_global_debug(int on) -{ - if (on > -1) { - globals.debug = on ? 1 : 0; - } - - return globals.debug ? 1 : 0; -} - -void ldl_global_set_logger(ldl_logger_t logger) -{ - globals.logger = logger; -} - -unsigned int ldl_session_terminate(ldl_session_t *session) -{ - iks *iq, *sess; - unsigned int id; - apr_hash_t *hash = session->handle->sessions; - - new_session_iq(session, &iq, &sess, &id, "terminate"); - - if ((session->handle->flags & LDL_FLAG_JINGLE)) { - ldl_set_jingle_tag(session, iq, "session-terminate"); - } - - schedule_packet(session->handle, id, iq, LDL_RETRY); - - if (session->id) { - apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); - } - - if (session->them) { - apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); - } - - return id; - -} - - - -unsigned int ldl_session_transport(ldl_session_t *session, - ldl_candidate_t *candidates, - unsigned int clen) - -{ - iks *iq, *sess, *tag; - unsigned int x, id = 0; - - - if ((session->handle->flags & LDL_FLAG_JINGLE)) { - return ldl_session_candidates(session, candidates, clen); - } - - - - for (x = 0; x < clen; x++) { - char buf[512]; - iq = NULL; - sess = NULL; - id = 0; - - new_session_iq(session, &iq, &sess, &id, "transport-info"); - - tag = sess; - - //if (0) add_elements(session, tag); - tag = iks_insert(tag, "transport"); - iks_insert_attrib(tag, "xmlns", "http://www.google.com/transport/p2p"); - //iks_insert_attrib(tag, "xmlns", "urn:xmpp:jingle:transports:raw-udp:1"); - - tag = iks_insert(tag, "candidate"); - - if (candidates[x].name) { - iks_insert_attrib(tag, "name", candidates[x].name); - } - if (candidates[x].address) { - iks_insert_attrib(tag, "address", candidates[x].address); - } - if (candidates[x].port) { - snprintf(buf, sizeof(buf), "%u", candidates[x].port); - iks_insert_attrib(tag, "port", buf); - } - if (candidates[x].username) { - iks_insert_attrib(tag, "username", candidates[x].username); - } - if (candidates[x].password) { - iks_insert_attrib(tag, "password", candidates[x].password); - } - if (candidates[x].pref) { - snprintf(buf, sizeof(buf), "%0.1f", candidates[x].pref); - iks_insert_attrib(tag, "preference", buf); - } - if (candidates[x].protocol) { - iks_insert_attrib(tag, "protocol", candidates[x].protocol); - } - if (candidates[x].type) { - iks_insert_attrib(tag, "type", candidates[x].type); - } - - iks_insert_attrib(tag, "network", "0"); - iks_insert_attrib(tag, "generation", "0"); - schedule_packet(session->handle, id, iq, LDL_RETRY); - } - - return id; -} - -unsigned int ldl_session_candidates(ldl_session_t *session, - ldl_candidate_t *candidates, - unsigned int clen) - -{ - iks *iq = NULL, *sess = NULL, *tag = NULL; - unsigned int x = 0, id = 0; - - - unsigned int pass = 0; - iks *jingle = NULL, *jin_content = NULL, *p_trans = NULL; - const char *tname = ""; - const char *type = ""; - - if ((session->handle->flags & LDL_FLAG_JINGLE)) { - - - new_jingle_iq(session, &iq, &jingle, &id, "transport-info"); - - for (pass = 0; pass < 2; pass++) { - - if (pass == 0) { - type = "rtp"; - tname = "audio"; - } else { - type = "video_rtp"; - tname = "video"; - } - - jin_content = iks_insert(jingle, "jin:content"); - iks_insert_attrib(jin_content, "name", tname); - iks_insert_attrib(jin_content, "creator", "initiator"); - - for (x = 0; x < clen; x++) { - char buf[512]; - - if (strcasecmp(candidates[x].name, type)) { - continue; - } - - p_trans = iks_insert(jin_content, "p:transport"); - iks_insert_attrib(p_trans, "xmlns:p", "http://www.google.com/transport/p2p"); - - - - tag = iks_insert(p_trans, "candidate"); - - if (candidates[x].name) { - iks_insert_attrib(tag, "name", candidates[x].name); - } - if (candidates[x].address) { - iks_insert_attrib(tag, "address", candidates[x].address); - } - if (candidates[x].port) { - snprintf(buf, sizeof(buf), "%u", candidates[x].port); - iks_insert_attrib(tag, "port", buf); - } - if (candidates[x].username) { - iks_insert_attrib(tag, "username", candidates[x].username); - } - if (candidates[x].password) { - iks_insert_attrib(tag, "password", candidates[x].password); - } - if (candidates[x].pref) { - snprintf(buf, sizeof(buf), "%0.1f", candidates[x].pref); - iks_insert_attrib(tag, "preference", buf); - } - if (candidates[x].protocol) { - iks_insert_attrib(tag, "protocol", candidates[x].protocol); - } - if (candidates[x].type) { - iks_insert_attrib(tag, "type", candidates[x].type); - } - - iks_insert_attrib(tag, "network", "0"); - iks_insert_attrib(tag, "generation", "0"); - } - } - - - schedule_packet(session->handle, id, iq, LDL_RETRY); - - iq = NULL; - sess = NULL; - tag = NULL; - id = 0; - } - - - new_session_iq(session, &iq, &sess, &id, "candidates"); - add_elements(session, sess); - - for (x = 0; x < clen; x++) { - char buf[512]; - //iq = NULL; - //sess = NULL; - //id = 0; - - tag = iks_insert(sess, "ses:candidate"); - - - - if (candidates[x].name) { - iks_insert_attrib(tag, "name", candidates[x].name); - } - if (candidates[x].address) { - iks_insert_attrib(tag, "address", candidates[x].address); - } - if (candidates[x].port) { - snprintf(buf, sizeof(buf), "%u", candidates[x].port); - iks_insert_attrib(tag, "port", buf); - } - if (candidates[x].username) { - iks_insert_attrib(tag, "username", candidates[x].username); - } - if (candidates[x].password) { - iks_insert_attrib(tag, "password", candidates[x].password); - } - if (candidates[x].pref) { - snprintf(buf, sizeof(buf), "%0.1f", candidates[x].pref); - iks_insert_attrib(tag, "preference", buf); - } - if (candidates[x].protocol) { - iks_insert_attrib(tag, "protocol", candidates[x].protocol); - } - if (candidates[x].type) { - iks_insert_attrib(tag, "type", candidates[x].type); - } - - iks_insert_attrib(tag, "network", "0"); - iks_insert_attrib(tag, "generation", "0"); - - } - - schedule_packet(session->handle, id, iq, LDL_RETRY); - - return id; -} - - - -char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len) -{ - iks *pres, *msg; - char *lid = NULL, *low_id = NULL; - struct ldl_buffer buffer; - time_t started, elapsed, next = 0; - char *notice = "Call Me!"; - - buffer.buf = buf; - buffer.len = len; - buffer.hit = 0; - - apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, &buffer); - - started = time(NULL); - for(;;) { - elapsed = time(NULL) - started; - if (elapsed == next) { - msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); - iks_insert_attrib(msg, "from", from); - apr_queue_push(handle->queue, msg); - msg = NULL; - - pres = iks_new("presence"); - iks_insert_attrib(pres, "xmlns", "jabber:client"); - iks_insert_attrib(pres, "type", "probe"); - iks_insert_attrib(pres, "to", id); - iks_insert_attrib(pres, "from", from); - apr_queue_push(handle->queue, pres); - pres = NULL; - next += 5; - } - if (elapsed >= 17) { - break; - } - if (buffer.hit) { - lid = buffer.buf; - break; - } - ldl_yield(1000); - } - - if ((low_id = strdup(id))) { - lowercase(id); - apr_hash_set(handle->probe_hash, low_id, APR_HASH_KEY_STRING, NULL); - free(low_id); - } - - return lid; -} - - -char *ldl_handle_disco(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len) -{ - iks *iq, *query, *msg; - char *lid = NULL; - struct ldl_buffer buffer; - apr_time_t started; - unsigned int elapsed; - char *notice = "Call Me!"; - int again = 0; - unsigned int myid; - char idbuf[80]; - - myid = next_id(); - snprintf(idbuf, sizeof(idbuf), "%u", myid); - - buffer.buf = buf; - buffer.len = len; - buffer.hit = 0; - - if ((iq = iks_new("iq"))) { - if ((query = iks_insert(iq, "query"))) { - iks_insert_attrib(iq, "type", "get"); - iks_insert_attrib(iq, "to", id); - iks_insert_attrib(iq,"from", from); - iks_insert_attrib(iq, "id", idbuf); - iks_insert_attrib(query, "xmlns", "http://jabber.org/protocol/disco#info"); - } else { - iks_delete(iq); - globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); - return NULL; - } - } else { - globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); - return NULL; - } - - apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, &buffer); - msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); - apr_queue_push(handle->queue, msg); - msg = NULL; - msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, notice); - apr_queue_push(handle->queue, msg); - msg = NULL; - apr_queue_push(handle->queue, iq); - iq = NULL; - - //schedule_packet(handle, next_id(), pres, LDL_RETRY); - - started = apr_time_now(); - for(;;) { - elapsed = (unsigned int)((apr_time_now() - started) / 1000); - if (elapsed > 5000 && ! again) { - msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); - apr_queue_push(handle->queue, msg); - msg = NULL; - again++; - } - if (elapsed > 10000) { - break; - } - if (buffer.hit) { - lid = buffer.buf; - break; - } - ldl_yield(1000); - } - - apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, NULL); - return lid; -} - - - -unsigned int ldl_session_describe(ldl_session_t *session, - ldl_payload_t *payloads, - unsigned int plen, - ldl_description_t description, unsigned int *audio_ssrc, unsigned int *video_ssrc, - ldl_crypto_data_t *audio_crypto_data, ldl_crypto_data_t *video_crypto_data) -{ - iks *iq; - iks *sess, *payload = NULL, *tag = NULL;//, *u = NULL; - - unsigned int x, id; - int video_call = 0; - int compat = 1; - //char *vid_mux = ldl_session_get_value(session, "video:rtcp-mux"); - //char *aud_mux = ldl_session_get_value(session, "audio:rtcp-mux"); - char tmp[80]; - iks *jpayload = NULL, *tp = NULL; - iks *jingle, *jin_audio, *jin_audio_desc = NULL, *jin_video = NULL, *jin_video_desc = NULL, *crypto; - - - if (!*audio_ssrc) { - *audio_ssrc = (uint32_t) ((intptr_t) session + (uint32_t) time(NULL)); - } - - if (!*video_ssrc) { - *video_ssrc = (uint32_t) ((intptr_t) payloads + (uint32_t) time(NULL)); - } - - if ((session->handle->flags & LDL_FLAG_JINGLE)) { - new_jingle_iq(session, &iq, &jingle, &id, description == LDL_DESCRIPTION_ACCEPT ? "session-accept" : "session-initiate"); - iks_insert_attrib(jingle, "initiator", session->initiator ? session->initiator : session->them); - - if (compat) { - sess = iks_insert (iq, "ses:session"); - iks_insert_attrib(sess, "xmlns:ses", "http://www.google.com/session"); - - iks_insert_attrib(sess, "type", description == LDL_DESCRIPTION_ACCEPT ? "accept" : "initiate"); - iks_insert_attrib(sess, "id", session->id); - iks_insert_attrib(sess, "initiator", session->initiator ? session->initiator : session->them); - } - - } else { - new_session_iq(session, &iq, &sess, &id, description == LDL_DESCRIPTION_ACCEPT ? "accept" : "initiate"); - } - - - /* Check if this is a video call */ - for (x = 0; x < plen; x++) { - if (payloads[x].type == LDL_PAYLOAD_VIDEO) { - video_call = 1; - if ((session->handle->flags & LDL_FLAG_JINGLE)) { - jin_video = iks_insert(jingle, "jin:content"); - iks_insert_attrib(jin_video, "name", "video"); - iks_insert_attrib(jin_video, "creator", "initiator"); - //iks_insert_attrib(jin_video, "senders", "both"); - jin_video_desc = iks_insert(jin_video, "rtp:description"); - iks_insert_attrib(jin_video_desc, "xmlns:rtp", "urn:xmpp:jingle:apps:rtp:1"); - iks_insert_attrib(jin_video_desc, "media", "video"); - snprintf(tmp, sizeof(tmp), "%u", *video_ssrc); - iks_insert_attrib(jin_video_desc, "ssrc", tmp); - tp = iks_insert(jin_video, "p:transport"); - iks_insert_attrib(tp, "xmlns:p", "http://www.google.com/transport/p2p"); - - } - - break; - } - } - - - if ((session->handle->flags & LDL_FLAG_JINGLE)) { - jin_audio = iks_insert(jingle, "jin:content"); - iks_insert_attrib(jin_audio, "name", "audio"); - iks_insert_attrib(jin_audio, "creator", "initiator"); - //iks_insert_attrib(jin_audio, "senders", "both"); - jin_audio_desc = iks_insert(jin_audio, "rtp:description"); - iks_insert_attrib(jin_audio_desc, "xmlns:rtp", "urn:xmpp:jingle:apps:rtp:1"); - iks_insert_attrib(jin_audio_desc, "media", "audio"); - snprintf(tmp, sizeof(tmp), "%u", *audio_ssrc); - iks_insert_attrib(jin_audio_desc, "ssrc", tmp); - tp = iks_insert(jin_audio, "p:transport"); - iks_insert_attrib(tp, "xmlns:p", "http://www.google.com/transport/p2p"); - } - - if (compat) { - - if (video_call) { - tag = iks_insert(sess, "vid:description"); - iks_insert_attrib(tag, "xmlns:vid", "http://www.google.com/session/video"); - } else { - tag = iks_insert(sess, "pho:description"); - iks_insert_attrib(tag, "xmlns:pho", "http://www.google.com/session/phone"); - } - - if (video_call) { - - for (x = 0; x < plen; x++) { - char idbuf[80]; - - if (payloads[x].type != LDL_PAYLOAD_VIDEO) { - continue; - } - - sprintf(idbuf, "%d", payloads[x].id); - - - payload = iks_insert(tag, "vid:payload-type"); - - iks_insert_attrib(payload, "id", idbuf); - iks_insert_attrib(payload, "name", payloads[x].name); - - if (payloads[x].type == LDL_PAYLOAD_VIDEO && video_call) { - if (payloads[x].width) { - sprintf(idbuf, "%d", payloads[x].width); - iks_insert_attrib(payload, "width", idbuf); - } - if (payloads[x].height) { - sprintf(idbuf, "%d", payloads[x].height); - iks_insert_attrib(payload, "height", idbuf); - } - if (payloads[x].framerate) { - sprintf(idbuf, "%d", payloads[x].framerate); - iks_insert_attrib(payload, "framerate", idbuf); - } - } - - } - - - //if (vid_mux) { - // iks_insert(tag, "rtcp-mux"); - //} - - //payload = iks_insert(tag, "vid:src-id"); - //iks_insert_cdata(payload, "123456789", 0); - - - //iks_insert_attrib(payload, "xmlns:rtp", "urn:xmpp:jingle:apps:rtp:1"); - //iks_insert(payload, "vid:usage"); - } - } - - for (x = 0; x < plen; x++) { - char idbuf[80]; - - if (payloads[x].type == LDL_PAYLOAD_VIDEO && !video_call) { - continue; - } - - sprintf(idbuf, "%d", payloads[x].id); - - if (payloads[x].type == LDL_PAYLOAD_AUDIO) { - - if ((session->handle->flags & LDL_FLAG_JINGLE)) { - char ratebuf[80]; - char buf[80]; - iks *param; - - jpayload = iks_insert(jin_audio_desc, "rtp:payload-type"); - iks_insert_attrib(jpayload, "id", idbuf); - sprintf(ratebuf, "%d", payloads[x].rate); - iks_insert_attrib(jpayload, "name", payloads[x].name); - iks_insert_attrib(jpayload, "clockrate", ratebuf); - param = iks_insert(jpayload, "rtp:parameter"); - iks_insert_attrib(param, "name", "bitrate"); - sprintf(buf, "%d", payloads[x].bps); - iks_insert_attrib(param, "value", buf); - - sprintf(buf, "%d", payloads[x].ptime); - iks_insert_attrib(jpayload, "ptime", ratebuf); - iks_insert_attrib(jpayload, "maxptime", ratebuf); - - } - - } else if (payloads[x].type == LDL_PAYLOAD_VIDEO && video_call) { - - if ((session->handle->flags & LDL_FLAG_JINGLE)) { - char buf[80]; - iks *param; - - jpayload = iks_insert(jin_video_desc, "rtp:payload-type"); - iks_insert_attrib(jpayload, "id", idbuf); - iks_insert_attrib(jpayload, "name", payloads[x].name); - param = iks_insert(jpayload, "rtp:parameter"); - iks_insert_attrib(param, "name", "width"); - sprintf(buf, "%d", payloads[x].width); - iks_insert_attrib(param, "value", buf); - - - param = iks_insert(jpayload, "rtp:parameter"); - iks_insert_attrib(param, "name", "height"); - sprintf(buf, "%d", payloads[x].height); - iks_insert_attrib(param, "value", buf); - - param = iks_insert(jpayload, "rtp:parameter"); - iks_insert_attrib(param, "name", "framerate"); - sprintf(buf, "%d", payloads[x].framerate); - iks_insert_attrib(param, "value", buf); - - } - } - - if (compat) { - - if (payloads[x].type == LDL_PAYLOAD_AUDIO) { - - payload = iks_insert(tag, "pho:payload-type"); - - iks_insert_attrib(payload, "id", idbuf); - iks_insert_attrib(payload, "name", payloads[x].name); - - if (payloads[x].rate) { - sprintf(idbuf, "%d", payloads[x].rate); - iks_insert_attrib(payload, "clockrate", idbuf); - } - - if (payloads[x].bps) { - sprintf(idbuf, "%d", payloads[x].bps); - iks_insert_attrib(payload, "bitrate", idbuf); - } - - iks_insert_attrib(payload, "xmlns:pho", "http://www.google.com/session/phone"); - } - } - //if (payloads[x].id == 34) payloads[x].id = 98; /* XXX */ - - } - - if ((session->handle->flags & LDL_FLAG_JINGLE)) { - if (jin_video_desc && video_crypto_data) { - payload = iks_insert(jin_video_desc, "rtp:encryption"); - crypto = iks_insert(payload, "rtp:crypto"); - iks_insert_attrib(crypto, "crypto-suite", video_crypto_data->suite); - iks_insert_attrib(crypto, "key-params", video_crypto_data->key); - iks_insert_attrib(crypto, "tag", video_crypto_data->tag); - } - - - if (jin_audio_desc && audio_crypto_data) { - payload = iks_insert(jin_audio_desc, "rtp:encryption"); - crypto = iks_insert(payload, "rtp:crypto"); - iks_insert_attrib(crypto, "crypto-suite", audio_crypto_data->suite); - iks_insert_attrib(crypto, "key-params", audio_crypto_data->key); - iks_insert_attrib(crypto, "tag", audio_crypto_data->tag); - } - } - - //if (aud_mux) { - // iks_insert(tag, "rtcp-mux"); - //} - - //payload = iks_insert(tag, "pho:src-id"); - //iks_insert_cdata(payload, "987654321", 0); - //iks_insert_attrib(payload, "xmlns:pho", "http://www.google.com/session/phone"); - - //payload = iks_insert(tag, "rtp:encryption"); - //iks_insert_attrib(payload, "xmlns:rtp", "urn:xmpp:jingle:apps:rtp:1"); - //u = iks_insert(payload, "pho:usage"); - //iks_insert_attrib(u, "xmlns:pho", "http://www.google.com/session/phone"); - -#if 0 - if (description == LDL_DESCRIPTION_INITIATE) { - tp = iks_insert (sess, "transport"); - iks_insert_attrib(tp, "xmlns", "http://www.google.com/transport/p2p"); - } -#endif - - - schedule_packet(session->handle, id, iq, LDL_RETRY); - - return id; -} - -ldl_state_t ldl_session_get_state(ldl_session_t *session) -{ - return session->state; -} - -ldl_status ldl_session_get_candidates(ldl_session_t *session, ldl_transport_type_t tport, ldl_candidate_t **candidates, unsigned int *len) -{ - assert(tport < LDL_TPORT_MAX); - - if (session->candidate_len[tport]) { - *candidates = session->candidates[tport]; - *len = session->candidate_len[tport]; - return LDL_STATUS_SUCCESS; - } else { - *candidates = NULL; - *len = 0; - return LDL_STATUS_FALSE; - } -} - -ldl_status ldl_session_get_payloads(ldl_session_t *session, ldl_payload_t **payloads, unsigned int *len) -{ - if (session->payload_len) { - *payloads = session->payloads; - *len = session->payload_len; - return LDL_STATUS_SUCCESS; - } else { - *payloads = NULL; - *len = 0; - return LDL_STATUS_FALSE; - } -} - -ldl_status ldl_global_terminate(void) -{ - if (globals.flag_mutex) { - ldl_clear_flag_locked((&globals), LDL_FLAG_READY); - } else { - ldl_clear_flag((&globals), LDL_FLAG_READY); - } - return LDL_STATUS_SUCCESS; -} - -ldl_status ldl_global_init(int debug) -{ - if (ldl_test_flag((&globals), LDL_FLAG_INIT)) { - return LDL_STATUS_FALSE; - } - - if (apr_initialize() != LDL_STATUS_SUCCESS) { - apr_terminate(); - return LDL_STATUS_MEMERR; - } - - memset(&globals, 0, sizeof(globals)); - - if (apr_pool_create(&globals.memory_pool, NULL) != LDL_STATUS_SUCCESS) { - globals.logger(DL_LOG_CRIT, "Could not allocate memory pool\n"); - return LDL_STATUS_MEMERR; - } - - apr_thread_mutex_create(&globals.flag_mutex, APR_THREAD_MUTEX_NESTED, globals.memory_pool); - globals.log_stream = stdout; - globals.debug = debug; - globals.id = 300; - globals.logger = default_logger; - globals.avatar_hash = apr_hash_make(globals.memory_pool); - ldl_set_flag_locked((&globals), LDL_FLAG_INIT); - ldl_set_flag_locked((&globals), LDL_FLAG_READY); - - return LDL_STATUS_SUCCESS; -} - -ldl_status ldl_global_destroy(void) -{ - if (!ldl_test_flag(&globals, LDL_FLAG_INIT)) { - return LDL_STATUS_FALSE; - } - - apr_pool_destroy(globals.memory_pool); - ldl_clear_flag(&globals, LDL_FLAG_INIT); - apr_terminate(); - - return LDL_STATUS_SUCCESS; -} - -void ldl_global_set_log_stream(FILE *log_stream) -{ - assert(ldl_test_flag(&globals, LDL_FLAG_INIT)); - - globals.log_stream = log_stream; -} - -int8_t ldl_handle_ready(ldl_handle_t *handle) -{ - return (int8_t) (ldl_test_flag(handle, LDL_FLAG_RUNNING) && ldl_test_flag((&globals), LDL_FLAG_READY)); -} - -ldl_status ldl_handle_init(ldl_handle_t **handle, - char *login, - char *password, - char *server, - ldl_user_flag_t flags, - char *status_msg, - char *priority, - ldl_loop_callback_t loop_callback, - ldl_session_callback_t session_callback, - ldl_response_callback_t response_callback, - void *private_info) -{ - apr_pool_t *pool; - assert(ldl_test_flag(&globals, LDL_FLAG_INIT)); - *handle = NULL; - - if ((apr_pool_create(&pool, globals.memory_pool)) != LDL_STATUS_SUCCESS) { - return LDL_STATUS_MEMERR; - } - - if (!login) { - globals.logger(DL_LOG_ERR, "No login supplied!\n"); - return LDL_STATUS_FALSE; - } - - if (!password) { - globals.logger(DL_LOG_ERR, "No password supplied!\n"); - return LDL_STATUS_FALSE; - } - - - if ((*handle = apr_palloc(pool, sizeof(ldl_handle_t)))) { - ldl_handle_t *new_handle = *handle; - memset(new_handle, 0, sizeof(ldl_handle_t)); - new_handle->log_stream = globals.log_stream; - new_handle->login = apr_pstrdup(pool, login); - new_handle->password = apr_pstrdup(pool, password); - - if (server) { - char *p; - - new_handle->server = apr_pstrdup(pool, server); - if ((p = strchr(new_handle->server, ':'))) { - *p++ = '\0'; - new_handle->port = (uint16_t)atoi(p); - } - } - - if (status_msg) { - new_handle->status_msg = apr_pstrdup(pool, status_msg); - } - - if (priority) { - new_handle->priority = apr_pstrdup(pool, priority); - } - - if (loop_callback) { - new_handle->loop_callback = loop_callback; - } - - if (session_callback) { - new_handle->session_callback = session_callback; - } - - if (response_callback) { - new_handle->response_callback = response_callback; - } - - new_handle->private_info = private_info; - new_handle->pool = pool; - new_handle->flags |= flags; - apr_queue_create(&new_handle->queue, LDL_HANDLE_QLEN, new_handle->pool); - apr_queue_create(&new_handle->retry_queue, LDL_HANDLE_QLEN, new_handle->pool); - new_handle->features |= IKS_STREAM_BIND|IKS_STREAM_SESSION; - - if (new_handle->flags & LDL_FLAG_SASL_PLAIN) { - new_handle->features |= IKS_STREAM_SASL_PLAIN; - } else if (new_handle->flags & LDL_FLAG_SASL_MD5) { - new_handle->features |= IKS_STREAM_SASL_MD5; - } - - new_handle->sessions = apr_hash_make(new_handle->pool); - new_handle->retry_hash = apr_hash_make(new_handle->pool); - new_handle->probe_hash = apr_hash_make(new_handle->pool); - new_handle->sub_hash = apr_hash_make(new_handle->pool); - apr_thread_mutex_create(&new_handle->lock, APR_THREAD_MUTEX_NESTED, new_handle->pool); - apr_thread_mutex_create(&new_handle->flag_mutex, APR_THREAD_MUTEX_NESTED, new_handle->pool); - - return LDL_STATUS_SUCCESS; - } - - return LDL_STATUS_FALSE; -} - -void ldl_handle_run(ldl_handle_t *handle) -{ - ldl_clear_flag_locked(handle, LDL_FLAG_STOPPED); - ldl_set_flag_locked(handle, LDL_FLAG_RUNNING); - xmpp_connect(handle, handle->login, handle->password); - ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); -} - -int ldl_handle_running(ldl_handle_t *handle) -{ - return ldl_test_flag(handle, LDL_FLAG_RUNNING) ? 1 : 0; -} - - -void ldl_session_set_gateway(ldl_session_t *session) -{ - ldl_set_flag(session, LDL_FLAG_GATEWAY); -} - -int ldl_session_gateway(ldl_session_t *session) -{ - return ldl_test_flag(session, LDL_FLAG_GATEWAY) ? 1 : 0; -} - -int ldl_handle_connected(ldl_handle_t *handle) -{ - return ldl_test_flag(handle, LDL_FLAG_CONNECTED) ? 1 : 0; -} - -int ldl_handle_authorized(ldl_handle_t *handle) -{ - return ldl_test_flag(handle, LDL_FLAG_AUTHORIZED) ? 1 : 0; -} - -void ldl_handle_stop(ldl_handle_t *handle) -{ - ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); -#if 0 - if (ldl_test_flag(handle, LDL_FLAG_TLS)) { - int fd; - if ((fd = iks_fd(handle->parser)) > -1) { - shutdown(fd, 0x02); - } - } -#endif - - while(!ldl_test_flag(handle, LDL_FLAG_STOPPED)) { - microsleep(100); - } - -} - -ldl_status ldl_handle_destroy(ldl_handle_t **handle) -{ - apr_pool_t *pool = (*handle)->pool; - - ldl_handle_stop(*handle); - ldl_flush_queue(*handle, 1); - - - apr_pool_destroy(pool); - *handle = NULL; - return LDL_STATUS_SUCCESS; -} - - -void ldl_handle_set_log_stream(ldl_handle_t *handle, FILE *log_stream) -{ - assert(ldl_test_flag(&globals, LDL_FLAG_INIT)); - - handle->log_stream = log_stream; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ diff --git a/libs/libdingaling/src/libdingaling.h b/libs/libdingaling/src/libdingaling.h deleted file mode 100644 index 05fafc6da9..0000000000 --- a/libs/libdingaling/src/libdingaling.h +++ /dev/null @@ -1,751 +0,0 @@ -/* - * libDingaLing XMPP Jingle Library - * Copyright (C) 2005-2014, Anthony Minessale II - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is libDingaLing XMPP Jingle Library - * - * The Initial Developer of the Original Code is - * Anthony Minessale II - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II - * - * libdingaling.h -- Main Header File - * - */ - -/*! \file libdingaling.h - \brief Main Header File -*/ - -/*! - \defgroup core1 libDingaLing Library - \ingroup LIBDINGALING - \{ -*/ -/* OMG */ -#ifdef _MSC_VER -#define __LDL_FUNC__ __FUNCTION__ -#define inline __inline -#else -#define __LDL_FUNC__ (const char *)__func__ -#endif - -#ifndef LIBDINGALING_H -#define LIBDINGALING_H -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __STUPIDFORMATBUG__ -} -#endif - -#if defined (__SVR4) && defined (__sun) -#define __EXTENSIONS__ 1 -#include -#endif - -#define LDL_HANDLE_QLEN 2000 -#define LDL_MAX_CANDIDATES 25 -#define LDL_MAX_PAYLOADS 50 -#define LDL_RETRY 3 -#define IKS_NS_COMPONENT "jabber:component:accept" -/* period between keep alive signals in 1sec units*/ -#define LDL_KEEPALIVE_TIMEOUT 300 - -typedef struct ldl_crypto_data_s { - char *tag; - char *suite; - char *key; -} ldl_crypto_data_t; - -/*! \brief A structure to store a jingle candidate */ -struct ldl_candidate { - /*! the transport id of the candidate */ - char *tid; - /*! the name of the candidate */ - char *name; - /*! the type of the candidate */ - char *type; - /*! the protocol of the candidate */ - char *protocol; - /*! the STUN username of the candidate */ - char *username; - /*! the STUN password of the candidate */ - char *password; - /*! the ip address of the candidate */ - char *address; - /*! the stun/rtp port of the candidate */ - uint16_t port; - /*! the preference level of the candidate */ - double pref; -}; -typedef struct ldl_candidate ldl_candidate_t; - -typedef enum { - LDL_PAYLOAD_AUDIO, - LDL_PAYLOAD_VIDEO -} ldl_payload_type_t; - -/*! \brief A structure to store a jingle audio payload */ -struct ldl_payload { - /*! the type of the payload */ - ldl_payload_type_t type; - /*! the iana name of the payload type */ - char *name; - /*! the iana id of the payload type */ - unsigned int id; - - /* Audio */ - - /*! the transfer rate of the payload type */ - unsigned int rate; - /*! the bits per second of the payload type */ - unsigned int bps; - - /* Video */ - - /*! the width of the video payload type */ - unsigned int width; - /*! the width of the video payload type */ - unsigned int height; - /*! the framerate of the video payload type */ - unsigned int framerate; - - unsigned int ptime; -}; -typedef struct ldl_payload ldl_payload_t; - - -enum ldl_transport_type { - LDL_TPORT_RTP, - LDL_TPORT_VIDEO_RTP, - LDL_TPORT_RTCP, - LDL_TPORT_VIDEO_RTCP, - - /* Nothing below that line */ - LDL_TPORT_MAX -}; -typedef enum ldl_transport_type ldl_transport_type_t; - -static inline const char *ldl_transport_type_str(ldl_transport_type_t type) -{ - static const char *name[] = { "rtp", "video_rtp", "rtcp", "video_rtcp" }; - return type >= LDL_TPORT_MAX ? NULL : name[type]; -} - -static inline ldl_transport_type_t ldl_transport_type_parse(const char *type) { - if (!strcasecmp(type, "rtp")) { - return LDL_TPORT_RTP; - } else if (!strcasecmp(type, "rtcp")) { - return LDL_TPORT_RTCP; - } else if (!strcasecmp(type, "video_rtp")) { - return LDL_TPORT_VIDEO_RTP; - } else if (!strcasecmp(type, "video_rtcp")) { - return LDL_TPORT_VIDEO_RTCP; - } else { - return LDL_TPORT_MAX; - } -} - -#if 0 -/*! \brief A structure to store a jingle video payload */ -struct ldl_vpayload { - /*! the iana name of the video payload type */ - char *name; - /*! the iana id of the video payload type */ - unsigned int id; - /*! the width of the video payload type */ - unsigned int width; - /*! the width of the video payload type */ - unsigned int height; - /*! the framerate of the video payload type */ - unsigned int framerate; -}; -typedef struct ldl_vpayload ldl_vpayload_t; -#endif - -struct ldl_handle; -typedef struct ldl_handle ldl_handle_t; - -struct ldl_session; -typedef struct ldl_session ldl_session_t; - -typedef enum { - LDL_STATUS_SUCCESS, - LDL_STATUS_FALSE, - LDL_STATUS_MEMERR, -} ldl_status; - -typedef enum { - LDL_FLAG_INIT = (1 << 0), - LDL_FLAG_RUNNING = (1 << 1), - LDL_FLAG_AUTHORIZED = (1 << 2), - LDL_FLAG_READY = (1 << 3), - LDL_FLAG_CONNECTED = (1 << 4), - LDL_FLAG_STOPPED = (1 << 5), - LDL_FLAG_BREAK = (1 << 6) -} ldl_flag_t; - -typedef enum { - LDL_FLAG_NONE = 0, - LDL_FLAG_TLS = (1 << 10), - LDL_FLAG_SASL_PLAIN = (1 << 11), - LDL_FLAG_SASL_MD5 = (1 << 12), - LDL_FLAG_COMPONENT = (1 << 13), - LDL_FLAG_OUTBOUND = (1 << 14), - LDL_FLAG_GATEWAY = (1 << 15), - LDL_FLAG_JINGLE = (1 << 16) -} ldl_user_flag_t; - -typedef enum { - LDL_SIGNAL_NONE, - LDL_SIGNAL_INITIATE, - LDL_SIGNAL_CANDIDATES, - LDL_SIGNAL_MSG, - LDL_SIGNAL_PRESENCE_IN, - LDL_SIGNAL_PRESENCE_OUT, - LDL_SIGNAL_PRESENCE_PROBE, - LDL_SIGNAL_ROSTER, - LDL_SIGNAL_SUBSCRIBE, - LDL_SIGNAL_UNSUBSCRIBE, - LDL_SIGNAL_VCARD, - LDL_SIGNAL_TERMINATE, - LDL_SIGNAL_ERROR, - LDL_SIGNAL_LOGIN_SUCCESS, - LDL_SIGNAL_LOGIN_FAILURE, - LDL_SIGNAL_CONNECTED, - LDL_SIGNAL_TRANSPORT_ACCEPT, - LDL_SIGNAL_REJECT, - LDL_SIGNAL_REDIRECT -} ldl_signal_t; - -typedef enum { - LDL_REPLY_ACK, - LDL_REPLY_NACK, -} ldl_reply_t; - -typedef enum { - LDL_STATE_NEW, - LDL_STATE_ANSWERED, - LDL_STATE_DESTROYED, -} ldl_state_t; - -typedef enum { - LDL_DESCRIPTION_INITIATE, - LDL_DESCRIPTION_ACCEPT -} ldl_description_t; - -typedef enum { - LDL_QUEUE_NONE, - LDL_QUEUE_SENT -} ldl_queue_t; - -#define DL_PRE __FILE__, __LDL_FUNC__, __LINE__ -#define DL_LOG_DEBUG DL_PRE, 7 -#define DL_LOG_INFO DL_PRE, 6 -#define DL_LOG_NOTICE DL_PRE, 5 -#define DL_LOG_WARNING DL_PRE, 4 -#define DL_LOG_ERR DL_PRE, 3 -#define DL_LOG_CRIT DL_PRE, 2 -#define DL_LOG_ALERT DL_PRE, 1 -#define DL_LOG_EMERG DL_PRE, 0 - -typedef ldl_status (*ldl_loop_callback_t)(ldl_handle_t *); -typedef ldl_status (*ldl_session_callback_t)(ldl_handle_t *, ldl_session_t *, ldl_signal_t, char *, char *, char *, char *); -typedef ldl_status (*ldl_response_callback_t)(ldl_handle_t *, char *); -typedef void (*ldl_logger_t)(char *file, const char *func, int line, int level, char *fmt, ...); - -#define ldl_yield(ms) apr_sleep(ms * 10); apr_thread_yield(); - -/*! - \brief Test for a common domain in 2 jid - \param id_a the first id - \param id_b the second id - \return 1 if the domains match 0 if they dont or -1 if either id is invalid - \note the id may or may not contain a user and/or resource -*/ -static inline int ldl_jid_domcmp(char *id_a, char *id_b) -{ - char *id_a_host, *id_b_host, *id_a_r, *id_b_r; - - id_a_host = strchr(id_a, '@'); - if (id_a_host) { - id_a_host++; - } else { - id_a_host = id_a; - } - - id_b_host = strchr(id_b, '@'); - if (id_b_host) { - id_b_host++; - } else { - id_b_host = id_b; - } - - if (id_a_host && id_b_host) { - size_t id_a_len = 0, id_b_len = 0, len = 0; - - id_a_r = strchr(id_a_host, '/'); - if (id_a_r) { - id_a_len = id_a_r - id_a_host; - } else { - id_a_len = strlen(id_a_host); - } - - id_b_r = strchr(id_b_host, '/'); - if (id_b_r) { - id_b_len = id_b_r - id_b_host; - } else { - id_b_len = strlen(id_b_host); - } - - if (id_a_len > id_b_len) { - len = id_b_len; - } else { - len = id_a_len; - } - - return strncasecmp(id_a_host, id_b_host, len) ? 0 : 1; - } - return -1; -} - -/*! - \brief Test for the existance of a flag on an arbitary object - \param obj the object to test - \param flag the or'd list of flags to test - \return true value if the object has the flags defined -*/ -#define ldl_test_flag(obj, flag) ((obj)->flags & flag) - - -/*! - \brief Set a flag on an arbitrary object - \param obj the object to set the flags on - \param flag the or'd list of flags to set -*/ -#define ldl_set_flag(obj, flag) (obj)->flags |= (flag) - -/*! - \brief Clear a flag on an arbitrary object - \param obj the object to test - \param flag the or'd list of flags to clear -*/ -#define ldl_clear_flag(obj, flag) (obj)->flags &= ~(flag) - -/*! - \brief Set a flag on an arbitrary object while locked - \param obj the object to set the flags on - \param flag the or'd list of flags to set -*/ -#define ldl_set_flag_locked(obj, flag) assert(obj->flag_mutex != NULL);\ -apr_thread_mutex_lock(obj->flag_mutex);\ -(obj)->flags |= (flag);\ -apr_thread_mutex_unlock(obj->flag_mutex); - -/*! - \brief Clear a flag on an arbitrary object - \param obj the object to test - \param flag the or'd list of flags to clear -*/ -#define ldl_clear_flag_locked(obj, flag) apr_thread_mutex_lock(obj->flag_mutex); (obj)->flags &= ~(flag); apr_thread_mutex_unlock(obj->flag_mutex); - -/*! - \brief Copy flags from one arbitrary object to another - \param dest the object to copy the flags to - \param src the object to copy the flags from - \param flags the flags to copy -*/ -#define ldl_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags)) - -/*! - \brief Test for NULL or zero length string - \param s the string to test - \return true value if the string is NULL or zero length -*/ -#define ldl_strlen_zero(s) (s && *s != '\0') ? 0 : 1 - -/*! - \brief Destroy a Jingle Session - \param session_p the session to destroy - \return SUCCESS OR FAILURE -*/ -ldl_status ldl_session_destroy(ldl_session_t **session_p); - -/*! - \brief Get a value from a session - \param session the session - \param key the key to look up - \return the value -*/ -char *ldl_session_get_value(ldl_session_t *session, char *key); - -/*! - \brief Set a value on a session - \param session the session - \param key the key to set - \param val the value of the key -*/ -void ldl_session_set_value(ldl_session_t *session, const char *key, const char *val); - -/*! - \brief Create a Jingle Session - \param session_p pointer to reference the session - \param handle handle to associate the session with - \param id the id to use for the session - \param them the id of the other end of the call - \param me the id of our end of the call - \param flags user flags - \return SUCCESS OR FAILURE -*/ -ldl_status ldl_session_create(ldl_session_t **session_p, ldl_handle_t *handle, char *id, char *them, char *me, ldl_user_flag_t flags); - -/*! - \brief get the id of a session - \param session the session to get the id of - \return the requested id -*/ -char *ldl_session_get_id(ldl_session_t *session); - -/*! - \brief Get the caller name of a session - \param session the session to get the caller from - \return the caller name -*/ -char *ldl_session_get_caller(ldl_session_t *session); - -/*! - \brief Get the callee name of a session - \param session the session to get the callee from - \return the callee name -*/ -char *ldl_session_get_callee(ldl_session_t *session); - -/*! - \brief Set the ip of a session - \param session the session to set the ip on - \param ip the ip -*/ -void ldl_session_set_ip(ldl_session_t *session, char *ip); - -/*! - \brief Get the ip of a session - \param session the session to get the ip from - \return the ip -*/ -char *ldl_session_get_ip(ldl_session_t *session); - -/*! - \brief Set a private pointer to associate with the session - \param session the session to set the data pointer to - \param private_data the data to associate -*/ -void ldl_session_set_private(ldl_session_t *session, void *private_data); - -/*! - \brief Get a private pointer from a session - \param session the session to get the data from - \return the data -*/ -void *ldl_session_get_private(ldl_session_t *session); - -/*! - \brief Accept a candidate - \param session the session to accept on - \param candidate the candidate to accept -*/ -void ldl_session_accept_candidate(ldl_session_t *session, ldl_candidate_t *candidate); - -/*! - \brief turn logging on/off - \param on (TRUE or FALSE) - \return current state -*/ -int ldl_global_debug(int on); - -/*! - \brief Set a custom logger - \param logger the logger function -*/ -void ldl_global_set_logger(ldl_logger_t logger); - -/*! - \brief Perform a probe on a given id to resolve the proper Jingle Resource - \param handle the connection handle to use. - \param id the id to probe - \param from the from string - \param buf a string to store the result - \param len the size in bytes of the string - \return a pointer to buf if a successful lookup was made otherwise NULL -*/ -char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len); - -/*! - \brief Perform a discovery on a given id to resolve the proper Jingle Resource - \param handle the connection handle to use. - \param id the id to probe - \param from the from string - \param buf a string to store the result - \param len the size in bytes of the string - \return a pointer to buf if a successful lookup was made otherwise NULL -*/ -char *ldl_handle_disco(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len); - -/*! - \brief Signal a termination request on a given session - \param session the session to terminate - \return TRUE if the signal was sent. -*/ -unsigned int ldl_session_terminate(ldl_session_t *session); - -/*! - \brief Get the private data of a connection handle - \param handle the conection handle - \return the requested data -*/ -void *ldl_handle_get_private(ldl_handle_t *handle); - -/*! - \brief Get the full login of a connection handle - \param handle the conection handle - \return the requested data -*/ -char *ldl_handle_get_login(ldl_handle_t *handle); - -/*! - \brief Send a message to a session - \param session the session handle - \param subject optional subject - \param body body of the message -*/ -void ldl_session_send_msg(ldl_session_t *session, char *subject, char *body); - -/*! - \brief Send a presence notification to a target - \param handle the handle to send with - \param from the from address - \param to the to address - \param type the type of presence - \param rpid data for the icon - \param message a status message - \param avatar the path to an avatar image -*/ -void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message, char *avatar); - -/*! - \brief Send a vcard - \param handle the handle to send with - \param from the from address - \param to the to address - \param id the request id - \param vcard the text xml of the vcard -*/ -void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, char *vcard); - -/*! - \brief Send a message - \param handle the conection handle - \param from the message sender - \param to the message recipiant - \param subject optional subject - \param body body of the message -*/ -void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char *subject, const char *body); - -/*! - \brief Offer candidates to a potential session - \param session the session to send candidates on - \param candidates an array of candidate description objects - \param clen the number of elements in the candidates array - \return the message_id of the generated xmpp request -*/ -unsigned int ldl_session_candidates(ldl_session_t *session, - ldl_candidate_t *candidates, - unsigned int clen); - -unsigned int ldl_session_transport(ldl_session_t *session, - ldl_candidate_t *candidates, - unsigned int clen); - -/*! - \brief Initiate or Accept a new session and provide transport options - \param session the session to initiate or accept - \param payloads an array of payload description objects - \param plen the number of elements in the payloads array - \param description the type of description LDL_DESCRIPTION_INITIATE or LDL_DESCRIPTION_ACCEPT - \return the message_id of the generated xmpp request -*/ -unsigned int ldl_session_describe(ldl_session_t *session, - ldl_payload_t *payloads, - unsigned int plen, - ldl_description_t description, unsigned int *audio_ssrc, unsigned int *video_ssrc, - ldl_crypto_data_t *audio_crypto_data, ldl_crypto_data_t *video_crypto_data); - - -/*! - \brief get a session's state - \param session a session to get the state from - \return the state -*/ -ldl_state_t ldl_session_get_state(ldl_session_t *session); - - -/*! - \brief get the candidates - \param session the session - \param tport type of transport (rtp,rtcp,video_rtp,video_rtcp,etc.) - \param candidates pointer to point at array of the candidates - \param len the resulting len of the array pointer - \return success or failure -*/ -ldl_status ldl_session_get_candidates(ldl_session_t *session, ldl_transport_type_t tport, ldl_candidate_t **candidates, unsigned int *len); - -/*! - \brief get the payloads - \param session the session - \param payloads pointer to point at array of the payloads - \param len the resulting len of the array pointer - \return success or failure -*/ -ldl_status ldl_session_get_payloads(ldl_session_t *session, ldl_payload_t **payloads, unsigned int *len); - -/*! - \brief Initilize libDingaLing - \param debug debug level - \return success or failure -*/ -ldl_status ldl_global_init(int debug); - -/*! - \brief Destroy libDingaLing - \return success or failure -*/ -ldl_status ldl_global_destroy(void); - -/*! - \brief Set the log stream - \param log_stream the new log stream -*/ -void ldl_global_set_log_stream(FILE *log_stream); - -int8_t ldl_handle_ready(ldl_handle_t *handle); - -/*! - \brief Initilize a new libDingaLing handle - \param handle the Dingaling handle to initialize - \param login the xmpp login - \param password the password - \param server the server address - \param flags user flags - \param status_msg status message to advertise - \param loop_callback optional loop callback - \param session_callback function to call on session signalling - \param response_callback function to call on responses - \param private_info optional pointer to private data - \return success or failure -*/ -ldl_status ldl_handle_init(ldl_handle_t **handle, - char *login, - char *password, - char *server, - ldl_user_flag_t flags, - char *status_msg, - char *priority, - ldl_loop_callback_t loop_callback, - ldl_session_callback_t session_callback, - ldl_response_callback_t response_callback, - void *private_info); - -/*! - \brief Run a libDingaLing handle - \param handle the Dingaling handle to run -*/ -void ldl_handle_run(ldl_handle_t *handle); - -int ldl_session_gateway(ldl_session_t *handle); -void ldl_session_set_gateway(ldl_session_t *session); - -/*! - \brief Stop a libDingaLing handle - \param handle the Dingaling handle to stop -*/ -void ldl_handle_stop(ldl_handle_t *handle); - -int ldl_handle_running(ldl_handle_t *handle); -int ldl_handle_connected(ldl_handle_t *handle); -int ldl_handle_authorized(ldl_handle_t *handle); - - -/*! - \brief Destroy a libDingaLing handle - \param handle the Dingaling handle to destroy - \return success or failure -*/ -ldl_status ldl_handle_destroy(ldl_handle_t **handle); - -/*! - \brief Set the log stream on a handle - \param handle the Dingaling handle - \param log_stream the new log stream -*/ -void ldl_handle_set_log_stream(ldl_handle_t *handle, FILE *log_stream); - -ldl_status ldl_global_terminate(void); - -///\} - - -#ifdef __cplusplus -} -#endif -/** \mainpage libDingaling - * libDingaling - Cross Platform Jingle (Google Talk) voip signaling library - - * \section intro Introduction - * - * \section supports Supported Platforms - * libDingaling has been built on the following platforms: - * - * - Linux (x86, x86_64) - * - Windows (MSVC 2005) - * - Mac OS X (intel & ppc ) - * - * \section depends Dependencies - * libDingaling makes use of the following external libraries. - * - * - APR (http://apr.apache.org) - * - iksemel (http://iksemel.jabberstudio.org/) - * - * \section license Licensing - * - * libDingaling is licensed under the terms of the MPL 1.1 - * - */ -#endif - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ diff --git a/libs/libdingaling/src/sha1.c b/libs/libdingaling/src/sha1.c deleted file mode 100644 index 100ab0e513..0000000000 --- a/libs/libdingaling/src/sha1.c +++ /dev/null @@ -1,639 +0,0 @@ -/*- - * Copyright (c) 2001-2003 Allan Saddi - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY ALLAN SADDI AND HIS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL ALLAN SADDI OR HIS CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $Id: sha1.c 680 2003-07-25 21:57:38Z asaddi $ - */ - -/* - * Define WORDS_BIGENDIAN if compiling on a big-endian architecture. - * - * Define SHA1_TEST to test the implementation using the NIST's - * sample messages. The output should be: - * - * a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d - * 84983e44 1c3bd26e baae4aa1 f95129e5 e54670f1 - * 34aa973c d4c4daa4 f61eeb2b dbad2731 6534016f - */ - -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif - -#ifdef _MSC_VER -#define inline __inline -#endif - -#include - -#include "sha1.h" - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-const-variable" -#endif - -#if 0 -static const char rcsid[] = - "$Id: sha1.c 680 2003-07-25 21:57:38Z asaddi $"; -#endif /* !lint */ - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -#define ROTL(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) -#define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) - -#define F_0_19(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) -#define F_20_39(x, y, z) ((x) ^ (y) ^ (z)) -#define F_40_59(x, y, z) (((x) & ((y) | (z))) | ((y) & (z))) -#define F_60_79(x, y, z) ((x) ^ (y) ^ (z)) - -#define DO_ROUND(F, K) { \ - temp = ROTL(a, 5) + F(b, c, d) + e + *(W++) + K; \ - e = d; \ - d = c; \ - c = ROTL(b, 30); \ - b = a; \ - a = temp; \ -} - -#define K_0_19 0x5a827999L -#define K_20_39 0x6ed9eba1L -#define K_40_59 0x8f1bbcdcL -#define K_60_79 0xca62c1d6L - -#ifndef RUNTIME_ENDIAN - -#ifdef WORDS_BIGENDIAN - -#define BYTESWAP(x) (x) -#define BYTESWAP64(x) (x) - -#else /* WORDS_BIGENDIAN */ - -#define BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \ - (ROTL((x), 8) & 0x00ff00ffL)) -#define BYTESWAP64(x) _byteswap64(x) - -static inline uint64_t _byteswap64(uint64_t x) -{ - uint32_t a = (uint32_t)(x >> 32); - uint32_t b = (uint32_t) x; - return ((uint64_t) BYTESWAP(b) << 32) | (uint64_t) BYTESWAP(a); -} - -#endif /* WORDS_BIGENDIAN */ - -#else /* !RUNTIME_ENDIAN */ - -#define BYTESWAP(x) _byteswap(sc->littleEndian, x) -#define BYTESWAP64(x) _byteswap64(sc->littleEndian, x) - -#define _BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \ - (ROTL((x), 8) & 0x00ff00ffL)) -#define _BYTESWAP64(x) __byteswap64(x) - -static inline uint64_t __byteswap64(uint64_t x) -{ - uint32_t a = x >> 32; - uint32_t b = (uint32_t) x; - return ((uint64_t) _BYTESWAP(b) << 32) | (uint64_t) _BYTESWAP(a); -} - -static inline uint32_t _byteswap(int littleEndian, uint32_t x) -{ - if (!littleEndian) - return x; - else - return _BYTESWAP(x); -} - -static inline uint64_t _byteswap64(int littleEndian, uint64_t x) -{ - if (!littleEndian) - return x; - else - return _BYTESWAP64(x); -} - -static inline void setEndian(int *littleEndianp) -{ - union { - uint32_t w; - uint8_t b[4]; - } endian; - - endian.w = 1L; - *littleEndianp = endian.b[0] != 0; -} - -#endif /* !RUNTIME_ENDIAN */ - -static const uint8_t padding[64] = { - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -void -SHA1Init (SHA1Context *sc) -{ -#ifdef RUNTIME_ENDIAN - setEndian (&sc->littleEndian); -#endif /* RUNTIME_ENDIAN */ - - sc->totalLength = 0LL; - sc->hash[0] = 0x67452301L; - sc->hash[1] = 0xefcdab89L; - sc->hash[2] = 0x98badcfeL; - sc->hash[3] = 0x10325476L; - sc->hash[4] = 0xc3d2e1f0L; - sc->bufferLength = 0L; -} - -static void -burnStack (int size) -{ - char buf[128]; - - memset (buf, 0, sizeof (buf)); - size -= sizeof (buf); - if (size > 0) - burnStack (size); -} - -static void -SHA1Guts (SHA1Context *sc, const uint32_t *cbuf) -{ - uint32_t buf[80]; - uint32_t *W, *W3, *W8, *W14, *W16; - uint32_t a, b, c, d, e, temp; - int i; - - W = buf; - - for (i = 15; i >= 0; i--) { - *(W++) = BYTESWAP(*cbuf); - cbuf++; - } - - W16 = &buf[0]; - W14 = &buf[2]; - W8 = &buf[8]; - W3 = &buf[13]; - - for (i = 63; i >= 0; i--) { - *W = *(W3++) ^ *(W8++) ^ *(W14++) ^ *(W16++); - *W = ROTL(*W, 1); - W++; - } - - a = sc->hash[0]; - b = sc->hash[1]; - c = sc->hash[2]; - d = sc->hash[3]; - e = sc->hash[4]; - - W = buf; - -#ifndef SHA1_UNROLL -#define SHA1_UNROLL 20 -#endif /* !SHA1_UNROLL */ - -#if SHA1_UNROLL == 1 - for (i = 19; i >= 0; i--) - DO_ROUND(F_0_19, K_0_19); - - for (i = 19; i >= 0; i--) - DO_ROUND(F_20_39, K_20_39); - - for (i = 19; i >= 0; i--) - DO_ROUND(F_40_59, K_40_59); - - for (i = 19; i >= 0; i--) - DO_ROUND(F_60_79, K_60_79); -#elif SHA1_UNROLL == 2 - for (i = 9; i >= 0; i--) { - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - } - - for (i = 9; i >= 0; i--) { - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - } - - for (i = 9; i >= 0; i--) { - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - } - - for (i = 9; i >= 0; i--) { - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - } -#elif SHA1_UNROLL == 4 - for (i = 4; i >= 0; i--) { - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - } - - for (i = 4; i >= 0; i--) { - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - } - - for (i = 4; i >= 0; i--) { - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - } - - for (i = 4; i >= 0; i--) { - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - } -#elif SHA1_UNROLL == 5 - for (i = 3; i >= 0; i--) { - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - } - - for (i = 3; i >= 0; i--) { - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - } - - for (i = 3; i >= 0; i--) { - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - } - - for (i = 3; i >= 0; i--) { - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - } -#elif SHA1_UNROLL == 10 - for (i = 1; i >= 0; i--) { - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - } - - for (i = 1; i >= 0; i--) { - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - } - - for (i = 1; i >= 0; i--) { - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - } - - for (i = 1; i >= 0; i--) { - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - } -#elif SHA1_UNROLL == 20 - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); -#else /* SHA1_UNROLL */ -#error SHA1_UNROLL must be 1, 2, 4, 5, 10 or 20! -#endif - - sc->hash[0] += a; - sc->hash[1] += b; - sc->hash[2] += c; - sc->hash[3] += d; - sc->hash[4] += e; -} - -void -SHA1Update (SHA1Context *sc, const void *vdata, uint32_t len) -{ - const uint8_t *data = vdata; - uint32_t bufferBytesLeft; - uint32_t bytesToCopy; - int needBurn = 0; - -#ifdef SHA1_FAST_COPY - if (sc->bufferLength) { - bufferBytesLeft = 64L - sc->bufferLength; - - bytesToCopy = bufferBytesLeft; - if (bytesToCopy > len) - bytesToCopy = len; - - memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy); - - sc->totalLength += bytesToCopy * 8L; - - sc->bufferLength += bytesToCopy; - data += bytesToCopy; - len -= bytesToCopy; - - if (sc->bufferLength == 64L) { - SHA1Guts (sc, sc->buffer.words); - needBurn = 1; - sc->bufferLength = 0L; - } - } - - while (len > 63) { - sc->totalLength += 512L; - - SHA1Guts (sc, data); - needBurn = 1; - - data += 64L; - len -= 64L; - } - - if (len) { - memcpy (&sc->buffer.bytes[sc->bufferLength], data, len); - - sc->totalLength += len * 8L; - - sc->bufferLength += len; - } -#else /* SHA1_FAST_COPY */ - while (len) { - bufferBytesLeft = 64L - sc->bufferLength; - - bytesToCopy = bufferBytesLeft; - if (bytesToCopy > len) - bytesToCopy = len; - - memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy); - - sc->totalLength += bytesToCopy * 8L; - - sc->bufferLength += bytesToCopy; - data += bytesToCopy; - len -= bytesToCopy; - - if (sc->bufferLength == 64L) { - SHA1Guts (sc, sc->buffer.words); - needBurn = 1; - sc->bufferLength = 0L; - } - } -#endif /* SHA1_FAST_COPY */ - - if (needBurn) - burnStack (sizeof (uint32_t[86]) + sizeof (uint32_t *[5]) + sizeof (int)); -} - -void -SHA1Final (SHA1Context *sc, uint8_t hash[SHA1_HASH_SIZE]) -{ - uint32_t bytesToPad; - uint64_t lengthPad; - int i; - - bytesToPad = 120L - sc->bufferLength; - if (bytesToPad > 64L) - bytesToPad -= 64L; - - lengthPad = BYTESWAP64(sc->totalLength); - - SHA1Update (sc, padding, bytesToPad); - SHA1Update (sc, &lengthPad, 8L); - - if (hash) { - for (i = 0; i < SHA1_HASH_WORDS; i++) { -#ifdef SHA1_FAST_COPY - *((uint32_t *) hash) = BYTESWAP(sc->hash[i]); -#else /* SHA1_FAST_COPY */ - hash[0] = (uint8_t) (sc->hash[i] >> 24); - hash[1] = (uint8_t) (sc->hash[i] >> 16); - hash[2] = (uint8_t) (sc->hash[i] >> 8); - hash[3] = (uint8_t) sc->hash[i]; -#endif /* SHA1_FAST_COPY */ - hash += 4; - } - } -} - -#ifdef SHA1_TEST - -#include -#include -#include - -int -main (int argc, char *argv[]) -{ - SHA1Context foo; - uint8_t hash[SHA1_HASH_SIZE]; - char buf[1000]; - int i; - - SHA1Init (&foo); - SHA1Update (&foo, "abc", 3); - SHA1Final (&foo, hash); - - for (i = 0; i < SHA1_HASH_SIZE;) { - printf ("%02x", hash[i++]); - if (!(i % 4)) - printf (" "); - } - printf ("\n"); - - SHA1Init (&foo); - SHA1Update (&foo, - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - 56); - SHA1Final (&foo, hash); - - for (i = 0; i < SHA1_HASH_SIZE;) { - printf ("%02x", hash[i++]); - if (!(i % 4)) - printf (" "); - } - printf ("\n"); - - SHA1Init (&foo); - memset (buf, 'a', sizeof (buf)); - for (i = 0; i < 1000; i++) - SHA1Update (&foo, buf, sizeof (buf)); - SHA1Final (&foo, hash); - - for (i = 0; i < SHA1_HASH_SIZE;) { - printf ("%02x", hash[i++]); - if (!(i % 4)) - printf (" "); - } - printf ("\n"); - - exit (0); -} - -#endif /* SHA1_TEST */ diff --git a/libs/libdingaling/src/sha1.h b/libs/libdingaling/src/sha1.h deleted file mode 100644 index 9283165c76..0000000000 --- a/libs/libdingaling/src/sha1.h +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 2001-2003 Allan Saddi - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY ALLAN SADDI AND HIS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL ALLAN SADDI OR HIS CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $Id: sha1.h 347 2003-02-23 22:11:49Z asaddi $ - */ - -#ifndef _SHA1_H -#define _SHA1_H - -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# else -# ifndef uint32_t -# ifdef WIN32 -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -typedef __int8 int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned long in_addr_t; -# endif -# endif -# endif -#endif - -#define SHA1_HASH_SIZE 20 - -/* Hash size in 32-bit words */ -#define SHA1_HASH_WORDS 5 - -struct _SHA1Context { - uint64_t totalLength; - uint32_t hash[SHA1_HASH_WORDS]; - uint32_t bufferLength; - union { - uint32_t words[16]; - uint8_t bytes[64]; - } buffer; -#ifdef RUNTIME_ENDIAN - int littleEndian; -#endif /* RUNTIME_ENDIAN */ -}; - -typedef struct _SHA1Context SHA1Context; - -#ifdef __cplusplus -extern "C" { -#endif - -void SHA1Init (SHA1Context *sc); -void SHA1Update (SHA1Context *sc, const void *data, uint32_t len); -void SHA1Final (SHA1Context *sc, uint8_t hash[SHA1_HASH_SIZE]); - -#ifdef __cplusplus -} -#endif - -#endif /* _SHA1_H */ diff --git a/src/include/switch.h b/src/include/switch.h index b7bae46c0e..8bfd15a3f6 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -226,11 +226,6 @@ * mod_portaudio * - portaudio (http://www.portaudio.com/) * - * mod_dingaling - * - libdingaling (internal library distributed with freeswitch which depends on) - * - APR (http://apr.apache.org) - * - iksemel (http://iksemel.jabberstudio.org/) - * * mod_sofia * - sofia-sip (http://opensource.nokia.com/projects/sofia-sip/) * diff --git a/src/mod/Makefile.am b/src/mod/Makefile.am index 05bea17bc4..4225ec7fd9 100644 --- a/src/mod/Makefile.am +++ b/src/mod/Makefile.am @@ -10,7 +10,7 @@ check: $(OUR_CHECK_MODULES) mod_skypopen-all: mod_gsmopen-all mod_gsmopen-all: mod_spandsp-all mod_unimrcp-all: mod_sofia-all -mod_rayo-all: mod_dingaling-all +mod_rayo-all: mod_ssml-all mod_ssml-all: mod_rayo-all $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODULES) $(OUR_DISABLED_MODULES) $(OUR_DISABLED_CLEAN_MODULES) $(OUR_DISABLED_INSTALL_MODULES) $(OUR_DISABLED_UNINSTALL_MODULES) $(OUR_TEST_MODULES) $(OUR_CHECK_MODULES): diff --git a/src/mod/endpoints/mod_dingaling/Makefile.am b/src/mod/endpoints/mod_dingaling/Makefile.am deleted file mode 100644 index 3412a3ef59..0000000000 --- a/src/mod/endpoints/mod_dingaling/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -include $(top_srcdir)/build/modmake.rulesam -MODNAME=mod_dingaling -IKS_DIR=$(switch_srcdir)/libs/iksemel -IKS_BUILDDIR=$(switch_builddir)/libs/iksemel -IKS_LA=$(IKS_BUILDDIR)/src/libiksemel.la -DING_DIR=$(switch_srcdir)/libs/libdingaling -DING_BUILDDIR=$(switch_builddir)/libs/libdingaling - -mod_LTLIBRARIES = mod_dingaling.la -mod_dingaling_la_SOURCES = mod_dingaling.c ../../../../libs/libdingaling/src/libdingaling.c ../../../../libs/libdingaling/src/sha1.c -mod_dingaling_la_CFLAGS = $(AM_CFLAGS) -mod_dingaling_la_CFLAGS += `$(switch_builddir)/libs/apr/apr-1-config --cflags --cppflags --includes` -mod_dingaling_la_CFLAGS += `$(switch_builddir)/libs/apr-util/apu-1-config --includes` -mod_dingaling_la_CFLAGS += -I$(DING_DIR)/src -I$(DING_BUILDDIR)/src -I$(IKS_DIR)/include -mod_dingaling_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(IKS_LA) -mod_dingaling_la_LDFLAGS = -avoid-version -module -no-undefined -shared - -BUILT_SOURCES=$(IKS_LA) - -$(IKS_LA): $(IKS_BUILDDIR) $(IKS_DIR) $(IKS_DIR)/.update - @cd $(IKS_BUILDDIR) && $(MAKE) - @$(TOUCH_TARGET) - -deps: $(IKS_LA) \ No newline at end of file diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.2017.vcxproj b/src/mod/endpoints/mod_dingaling/mod_dingaling.2017.vcxproj deleted file mode 100644 index 7c142aa75a..0000000000 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.2017.vcxproj +++ /dev/null @@ -1,165 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mod_dingaling - {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} - mod_dingaling - Win32Proj - - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) - - - 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - /NODEFAULTLIB:LIMBCTD %(AdditionalOptions) - $(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) - - - 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - /NODEFAULTLIB:LIMBCTD %(AdditionalOptions) - $(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) - - - 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - $(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) - - - 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - $(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - - - - {1906d736-08bd-4ee1-924f-b536249b9a54} - false - - - {f057da7f-79e5-4b00-845c-ef446ef055e3} - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - false - - - {e727e8f6-935d-46fe-8b0e-37834748a0e3} - false - - - {202d7a4e-760d-4d0e-afa1-d7459ced30ff} - false - - - - - - \ No newline at end of file diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c deleted file mode 100644 index 6b1728ebe5..0000000000 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ /dev/null @@ -1,4482 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * - * The Initial Developer of the Original Code is - * Anthony Minessale II - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II - * - * - * mod_dingaling.c -- Jingle Endpoint Module - * - */ -#include -#include -#include - -#define SWITCH_RTP_KEY_LEN 30 -#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32" -#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80" - -#define MDL_RTCP_DUR 5000 -#define DL_CAND_WAIT 10000000 -#define DL_CAND_INITIAL_WAIT 2000000 -//#define DL_CAND_WAIT 2000000 -//#define DL_CAND_INITIAL_WAIT 5000000 - -#define DL_EVENT_LOGIN_SUCCESS "dingaling::login_success" -#define DL_EVENT_LOGIN_FAILURE "dingaling::login_failure" -#define DL_EVENT_CONNECTED "dingaling::connected" -#define MDL_CHAT_PROTO "jingle" -#define MDL_CHAT_FROM_GUESS "auto_from" - -SWITCH_MODULE_LOAD_FUNCTION(mod_dingaling_load); -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dingaling_shutdown); -SWITCH_MODULE_DEFINITION(mod_dingaling, mod_dingaling_load, mod_dingaling_shutdown, NULL); - -static switch_memory_pool_t *module_pool = NULL; -switch_endpoint_interface_t *dingaling_endpoint_interface; - -static char sub_sql[] = - "CREATE TABLE jabber_subscriptions (\n" - " sub_from VARCHAR(255),\n" " sub_to VARCHAR(255),\n" " show_pres VARCHAR(255),\n" " status VARCHAR(255)\n" ");\n"; - - -typedef enum { - TFLAG_IO = (1 << 0), - TFLAG_INBOUND = (1 << 1), - TFLAG_OUTBOUND = (1 << 2), - TFLAG_READING = (1 << 3), - TFLAG_WRITING = (1 << 4), - TFLAG_BYE = (1 << 5), - TFLAG_VOICE = (1 << 6), - TFLAG_RTP_READY = (1 << 7), - TFLAG_CODEC_READY = (1 << 8), - TFLAG_TRANSPORT = (1 << 9), - TFLAG_ANSWER = (1 << 10), - TFLAG_VAD_NONE = (1 << 11), - TFLAG_VAD_IN = (1 << 12), - TFLAG_VAD_OUT = (1 << 13), - TFLAG_VAD = (1 << 14), - TFLAG_DO_CAND = (1 << 15), - TFLAG_DO_DESC = (1 << 16), - TFLAG_LANADDR = (1 << 17), - TFLAG_AUTO = (1 << 18), - TFLAG_DTMF = (1 << 19), - TFLAG_TIMER = (1 << 20), - TFLAG_TERM = (1 << 21), - TFLAG_TRANSPORT_ACCEPT = (1 << 22), - TFLAG_READY = (1 << 23), - TFLAG_NAT_MAP = (1 << 24), - TFLAG_SECURE = (1 << 25), - TFLAG_VIDEO_RTP_READY = (1 << 7) -} TFLAGS; - -typedef enum { - GFLAG_MY_CODEC_PREFS = (1 << 0) -} GFLAGS; - -#define MAX_ACL 100 - -static struct { - int debug; - char *dialplan; - char *codec_string; - char *codec_order[SWITCH_MAX_CODECS]; - int codec_order_last; - char *codec_rates_string; - char *codec_rates[SWITCH_MAX_CODECS]; - int codec_rates_last; - unsigned int flags; - unsigned int init; - switch_hash_t *profile_hash; - int running; - int handles; - char guess_ip[80]; - switch_event_node_t *in_node; - switch_event_node_t *probe_node; - switch_event_node_t *out_node; - switch_event_node_t *roster_node; - int auto_nat; -} globals; - -struct mdl_profile { - char *name; - char *login; - char *password; - char *message; - char *priority; -#ifdef AUTO_REPLY - char *auto_reply; -#endif - char *dialplan; - char *ip; - char *extip; - char *lanaddr; - char *server; - char *exten; - char *context; - char *timer_name; - char *dbname; - char *avatar; - char *odbc_dsn; - switch_bool_t purge; - switch_thread_rwlock_t *rwlock; - switch_mutex_t *mutex; - ldl_handle_t *handle; - uint32_t flags; - uint32_t user_flags; - char *acl[MAX_ACL]; - uint32_t acl_count; - char *local_network; -}; -typedef struct mdl_profile mdl_profile_t; - -/*! \brief The required components to setup a jingle transport */ -typedef struct mdl_transport { - char *remote_ip; - switch_port_t remote_port; - - switch_port_t local_port; /*!< The real local port */ - switch_port_t adv_local_port; - unsigned int ssrc; - - char local_user[17]; - char local_pass[17]; - char *remote_user; - char *remote_pass; - int ptime; - int payload_count; - int restart_rtp; - - switch_codec_t read_codec; - switch_codec_t write_codec; - - switch_frame_t read_frame; - - uint32_t codec_rate; - char *codec_name; - - switch_payload_t codec_num; - switch_payload_t r_codec_num; - - char *stun_ip; - uint16_t stun_port; - - switch_rtp_t *rtp_session; - ldl_transport_type_t type; - - int total; - int accepted; - - int ready; - - int codec_index; - - int vid_width; - int vid_height; - int vid_rate; - - switch_byte_t has_crypto; - int crypto_tag; - unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN]; - unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN]; - switch_rtp_crypto_key_type_t crypto_send_type; - switch_rtp_crypto_key_type_t crypto_recv_type; - switch_rtp_crypto_key_type_t crypto_type; - - char *local_crypto_key; - char *remote_crypto_key; - - ldl_crypto_data_t *local_crypto_data; - -} mdl_transport_t; - - -struct private_object { - unsigned int flags; - mdl_profile_t *profile; - switch_core_session_t *session; - switch_channel_t *channel; - - switch_caller_profile_t *caller_profile; - unsigned short samprate; - switch_mutex_t *mutex; - const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS]; - unsigned int num_codecs; - - mdl_transport_t transports[LDL_TPORT_MAX+1]; - - ldl_session_t *dlsession; - - char *us; - char *them; - unsigned int cand_id; - unsigned int desc_id; - unsigned int dc; - - uint32_t timestamp_send; - int32_t timestamp_recv; - uint32_t last_read; - - switch_time_t next_desc; - switch_time_t next_cand; - - char *recip; - char *dnis; - switch_mutex_t *flag_mutex; - - int read_count; - switch_time_t audio_ready; - -}; - -struct rfc2833_digit { - char digit; - int duration; -}; - -SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan); -SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string); -SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string); - -SWITCH_STANDARD_API(dl_login); -SWITCH_STANDARD_API(dl_logout); -SWITCH_STANDARD_API(dl_pres); -SWITCH_STANDARD_API(dl_debug); -SWITCH_STANDARD_API(dingaling); -static switch_status_t channel_on_init(switch_core_session_t *session); -static switch_status_t channel_on_hangup(switch_core_session_t *session); -static switch_status_t channel_on_destroy(switch_core_session_t *session); -static switch_status_t channel_on_routing(switch_core_session_t *session); -static switch_status_t channel_on_exchange_media(switch_core_session_t *session); -static switch_status_t channel_on_soft_execute(switch_core_session_t *session); -static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, - switch_caller_profile_t *outbound_profile, - switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, - switch_call_cause_t *cancel_cause); -static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); -static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); -static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig); - -static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal, - char *to, char *from, char *subject, char *msg); -static ldl_status handle_response(ldl_handle_t *handle, char *id); -static switch_status_t load_config(void); -static int sin_callback(void *pArg, int argc, char **argv, char **columnNames); - -static switch_status_t soft_reload(void); - -#define is_special(s) (s && (strstr(s, "ext+") || strstr(s, "user+"))) - -static char *translate_rpid(char *in, char *ext) -{ - char *r = NULL; - - if (in && (strstr(in, "null") || strstr(in, "NULL"))) { - in = NULL; - } - - if (!in) { - in = ext; - } - - if (!in) { - return NULL; - } - - if (!strcasecmp(in, "busy")) { - r = "dnd"; - } - - if (!strcasecmp(in, "unavailable")) { - r = "dnd"; - } - - if (!strcasecmp(in, "idle")) { - r = "away"; - } - - if (ext && !strcasecmp(ext, "idle")) { - r = "away"; - } else if (ext && !strcasecmp(ext, "away")) { - r = "away"; - } - - return r; -} - - -static switch_cache_db_handle_t *mdl_get_db_handle(mdl_profile_t *profile) -{ - switch_cache_db_handle_t *dbh = NULL; - char *dsn; - - if (!zstr(profile->odbc_dsn)) { - dsn = profile->odbc_dsn; - } else { - dsn = profile->dbname; - } - - if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) { - dbh = NULL; - } - - return dbh; - -} - - -static switch_status_t mdl_execute_sql(mdl_profile_t *profile, char *sql, switch_mutex_t *mutex) -{ - switch_cache_db_handle_t *dbh = NULL; - switch_status_t status = SWITCH_STATUS_FALSE; - - if (mutex) { - switch_mutex_lock(mutex); - } - - if (!(dbh = mdl_get_db_handle(profile))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); - goto end; - } - - status = switch_cache_db_execute_sql(dbh, sql, NULL); - - end: - - switch_cache_db_release_db_handle(&dbh); - - if (mutex) { - switch_mutex_unlock(mutex); - } - - return status; -} - -char *mdl_execute_sql2str(mdl_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len) -{ - switch_cache_db_handle_t *dbh = NULL; - - char *ret = NULL; - - if (mutex) { - switch_mutex_lock(mutex); - } - - if (!(dbh = mdl_get_db_handle(profile))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); - goto end; - } - - ret = switch_cache_db_execute_sql2str(dbh, sql, resbuf, len, NULL); - -end: - - switch_cache_db_release_db_handle(&dbh); - - if (mutex) { - switch_mutex_unlock(mutex); - } - - return ret; - -} - - -static switch_bool_t mdl_execute_sql_callback(mdl_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, - void *pdata) -{ - switch_bool_t ret = SWITCH_FALSE; - char *errmsg = NULL; - switch_cache_db_handle_t *dbh = NULL; - - if (mutex) { - switch_mutex_lock(mutex); - } - - if (!(dbh = mdl_get_db_handle(profile))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); - goto end; - } - - switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, &errmsg); - - if (errmsg) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg); - free(errmsg); - } - - end: - - switch_cache_db_release_db_handle(&dbh); - - if (mutex) { - switch_mutex_unlock(mutex); - } - - return ret; -} - - - - -static int sub_callback(void *pArg, int argc, char **argv, char **columnNames) -{ - mdl_profile_t *profile = (mdl_profile_t *) pArg; - - char *sub_from = argv[0]; - char *sub_to = argv[1]; - char *type = argv[2]; - char *rpid = argv[3]; - char *status = argv[4]; - //char *proto = argv[5]; - - if (zstr(type)) { - type = NULL; - } else if (!strcasecmp(type, "unavailable")) { - status = NULL; - } - rpid = translate_rpid(rpid, status); - - //ldl_handle_send_presence(profile->handle, sub_to, sub_from, "probe", rpid, status); - ldl_handle_send_presence(profile->handle, sub_to, sub_from, type, rpid, status, profile->avatar); - - - return 0; -} - -static int rost_callback(void *pArg, int argc, char **argv, char **columnNames) -{ - mdl_profile_t *profile = (mdl_profile_t *) pArg; - - char *sub_from = argv[0]; - char *sub_to = argv[1]; - char *show = argv[2]; - char *status = argv[3]; - - if (!strcasecmp(status, "n/a")) { - if (!strcasecmp(show, "dnd")) { - status = "Busy"; - } else if (!strcasecmp(show, "away")) { - status = "Idle"; - } - } - - ldl_handle_send_presence(profile->handle, sub_to, sub_from, NULL, show, status, profile->avatar); - - return 0; -} - -static void pres_event_handler(switch_event_t *event) -{ - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - void *val; - char *proto = switch_event_get_header(event, "proto"); - char *from = switch_event_get_header(event, "from"); - char *status = switch_event_get_header(event, "status"); - char *rpid = switch_event_get_header(event, "rpid"); - char *type = switch_event_get_header(event, "event_subtype"); - char *sql; - char pstr[128] = ""; - - if (globals.running != 1) { - return; - } - - if (!proto) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Missing 'proto' header\n"); - return; - } - - if (!from) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Missing 'from' header\n"); - return; - } - - if (status && !strcasecmp(status, "n/a")) { - status = NULL; - } - - switch (event->event_id) { - case SWITCH_EVENT_PRESENCE_PROBE: - if (proto) { - char *subsql; - char *to = switch_event_get_header(event, "to"); - char *f_host = NULL; - if (to) { - if ((f_host = strchr(to, '@'))) { - f_host++; - } - } - - if (f_host && (profile = switch_core_hash_find(globals.profile_hash, f_host))) { - if (to && (subsql = switch_mprintf("select * from jabber_subscriptions where sub_to='%q' and sub_from='%q'", to, from))) { - mdl_execute_sql_callback(profile, profile->mutex, subsql, sin_callback, profile); - switch_safe_free(subsql); - } - } - } - return; - case SWITCH_EVENT_PRESENCE_IN: - if (!status) { - status = "Available"; - } - break; - case SWITCH_EVENT_PRESENCE_OUT: - type = "unavailable"; - break; - default: - break; - } - - - if (!type) { - type = ""; - } - if (!rpid) { - rpid = ""; - } - if (!status) { - status = "Away"; - } - - if (proto) { - switch_snprintf(pstr, sizeof(pstr), "%s+", proto); - } - - sql = - switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from jabber_subscriptions where sub_to = '%q%q'", type, rpid, status, proto, pstr, - from); - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - - if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { - continue; - } - - - if (sql) { - switch_bool_t worked = mdl_execute_sql_callback(profile, profile->mutex, sql, sub_callback, profile); - - if (!worked) { - continue; - } - } - - - } - - switch_safe_free(sql); -} - -static switch_status_t chat_send(switch_event_t *message_event) -{ - char *user = NULL, *host, *f_user = NULL, *ffrom = NULL, *f_host = NULL, *f_resource = NULL; - mdl_profile_t *profile = NULL; - const char *proto; - const char *from; - const char *from_full; - const char *to_full; - const char *to; - const char *body; - const char *hint; - const char *profile_name; - switch_status_t status = SWITCH_STATUS_SUCCESS; - - proto = switch_event_get_header(message_event, "proto"); - from = switch_event_get_header(message_event, "from"); - from_full = switch_event_get_header(message_event, "from_full"); - to_full = switch_event_get_header(message_event, "to_full"); - to = switch_event_get_header(message_event, "to"); - body = switch_event_get_body(message_event); - hint = switch_event_get_header(message_event, "hint"); - profile_name = switch_event_get_header(message_event, "ldl_profile"); - - switch_assert(proto != NULL); - - if (from && (f_user = strdup(from))) { - if ((f_host = strchr(f_user, '@'))) { - *f_host++ = '\0'; - if ((f_resource = strchr(f_host, '/'))) { - *f_resource++ = '\0'; - } - } - } - - if ((profile_name && (profile = switch_core_hash_find(globals.profile_hash, profile_name)))) { - from = from_full; - to = to_full; - - ldl_handle_send_msg(profile->handle, (char *) from, (char *) to, NULL, switch_str_nil(body)); - } else if (to && (user = strdup(to))) { - if ((host = strchr(user, '@'))) { - *host++ = '\0'; - } - - if (f_host && ((profile_name && (profile = switch_core_hash_find(globals.profile_hash, profile_name))) - || (profile = switch_core_hash_find(globals.profile_hash, f_host)))) { - - if (!strcmp(proto, MDL_CHAT_PROTO)) { - from = hint; - } else { - char *p; - - if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { - from = ffrom = strdup(profile->login); - } else { - from = ffrom = switch_mprintf("%s+%s", proto, from); - } - - if ((p = strchr(from, '/'))) { - *p = '\0'; - } - } - if (!(profile->user_flags & LDL_FLAG_COMPONENT) && !strcmp(f_user, MDL_CHAT_FROM_GUESS)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Using auto_from jid address for profile %s\n", profile->name); - ldl_handle_send_msg(profile->handle, NULL, (char *) to, NULL, switch_str_nil(body)); - } else { - ldl_handle_send_msg(profile->handle, (char *) from, (char *) to, NULL, switch_str_nil(body)); - } - switch_safe_free(ffrom); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Profile %s\n", f_host ? f_host : "NULL"); - status = SWITCH_STATUS_FALSE; - goto done; - } - } - - done: - switch_safe_free(user); - switch_safe_free(f_user); - - return status; -} - - -static void roster_event_handler(switch_event_t *event) -{ - char *status = switch_event_get_header(event, "status"); - char *from = switch_event_get_header(event, "from"); - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - void *val; - char *sql; - - if (globals.running != 1) { - return; - } - - if (status && !strcasecmp(status, "n/a")) { - status = NULL; - } - - if (from) { - sql = switch_mprintf("select *,'%q' from jabber_subscriptions where sub_from='%q'", status ? status : "", from); - } else { - sql = switch_mprintf("select *,'%q' from jabber_subscriptions", status ? status : ""); - } - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - - if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { - continue; - } - - - if (sql) { - switch_bool_t worked = mdl_execute_sql_callback(profile, profile->mutex, sql, rost_callback, profile); - if (!worked) { - continue; - } - } - - } - - switch_safe_free(sql); - -} - -static void ipchanged_event_handler(switch_event_t *event) -{ - const char *cond = switch_event_get_header(event, "condition"); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "EVENT_TRAP: IP change detected\n"); - - if (cond && !strcmp(cond, "network-external-address-change")) { - const char *old_ip4 = switch_event_get_header_nil(event, "network-external-address-previous-v4"); - const char *new_ip4 = switch_event_get_header_nil(event, "network-external-address-change-v4"); - switch_hash_index_t *hi; - void *val; - char *tmp; - mdl_profile_t *profile; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "IP change detected [%s]->[%s]\n", old_ip4, new_ip4); - if (globals.profile_hash) { - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - if (old_ip4 && profile->extip && !strcmp(profile->extip, old_ip4)) { - tmp = profile->extip; - profile->extip = strdup(new_ip4); - switch_safe_free(tmp); - } - } - } - } -} - -static int so_callback(void *pArg, int argc, char **argv, char **columnNames) -{ - mdl_profile_t *profile = (mdl_profile_t *) pArg; - - char *sub_from = argv[0]; - char *sub_to = argv[1]; - - - ldl_handle_send_presence(profile->handle, sub_to, sub_from, "unavailable", "dnd", "Bub-Bye", profile->avatar); - - return 0; -} - - -static int sin_callback(void *pArg, int argc, char **argv, char **columnNames) -{ - mdl_profile_t *profile = (mdl_profile_t *) pArg; - switch_event_t *event; - - //char *sub_from = argv[0]; - char *sub_to = argv[1]; - - if (is_special(sub_to)) { - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", sub_to); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "available"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Online"); - switch_event_fire(&event); - } - } - - return 0; -} - -static void sign_off(void) -{ - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - void *val; - char *sql; - - - - sql = switch_mprintf("select * from jabber_subscriptions"); - - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - - if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { - continue; - } - - - if (sql) { - switch_bool_t worked = mdl_execute_sql_callback(profile, profile->mutex, sql, so_callback, profile); - if (!worked) { - continue; - } - } - - } - - switch_yield(1000000); - switch_safe_free(sql); - -} - -static void sign_on(mdl_profile_t *profile) -{ - char *sql; - - - if ((sql = switch_mprintf("select * from jabber_subscriptions where sub_to like 'ext+%%' or sub_to like 'user+%%' or sub_to like 'conf+%%'"))) { - mdl_execute_sql_callback(profile, profile->mutex, sql, sin_callback, profile); - switch_safe_free(sql); - } -} - -static void terminate_session(switch_core_session_t **session, int line, switch_call_cause_t cause) -{ - if (*session) { - switch_channel_t *channel = switch_core_session_get_channel(*session); - switch_channel_state_t state = switch_channel_get_state(channel); - struct private_object *tech_pvt = NULL; - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*session), SWITCH_LOG_DEBUG, "Terminate called from line %d state=%s\n", line, - switch_channel_state_name(state)); - - tech_pvt = switch_core_session_get_private(*session); - - - if (tech_pvt && tech_pvt->profile && tech_pvt->profile->ip && tech_pvt->transports[LDL_TPORT_RTP].local_port) { - switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_RTP].local_port); - } - - if (tech_pvt && tech_pvt->profile && tech_pvt->profile->ip && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { - switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port); - } - - if (!switch_core_session_running(*session) && (!tech_pvt || !switch_test_flag(tech_pvt, TFLAG_READY))) { - switch_core_session_destroy(session); - return; - } - - if (!tech_pvt || switch_test_flag(tech_pvt, TFLAG_TERM)) { - /*once is enough */ - return; - } - - if (state < CS_HANGUP) { - switch_channel_hangup(channel, cause); - } - - switch_mutex_lock(tech_pvt->flag_mutex); - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - switch_set_flag(tech_pvt, TFLAG_TERM); - } - switch_set_flag(tech_pvt, TFLAG_BYE); - switch_clear_flag(tech_pvt, TFLAG_IO); - switch_mutex_unlock(tech_pvt->flag_mutex); - - *session = NULL; - } - -} - -static void dl_logger(char *file, const char *func, int line, int level, char *fmt, ...) -{ - va_list ap; - char *data = NULL; - - va_start(ap, fmt); - if (switch_vasprintf(&data, fmt, ap) != -1) { - if (!strncasecmp(data, "+xml:", 5)) { - switch_xml_t xml; - char *form; - char *ll = data + 5; - char *xmltxt; - - if (ll) { - if ((xmltxt = strchr(ll, ':'))) { - *xmltxt++ = '\0'; - if (strlen(xmltxt) > 2) { - xml = switch_xml_parse_str(xmltxt, strlen(xmltxt)); - form = switch_xml_toxml(xml, SWITCH_FALSE); - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, - "%s:\n-------------------------------------------------------------------------------\n" "%s\n", ll, form); - switch_xml_free(xml); - free(data); - switch_safe_free(form); - } - } - } - } else { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, "%s\n", data); - } - } - va_end(ap); -} - -static int get_codecs(struct private_object *tech_pvt) -{ - char *codec_string = NULL; - const char *var; - char *codec_order[SWITCH_MAX_CODECS]; - int codec_order_last; - char **codec_order_p = NULL; - - - switch_assert(tech_pvt != NULL); - switch_assert(tech_pvt->session != NULL); - - if (!tech_pvt->num_codecs) { - - if ((var = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) { - codec_string = (char *)var; - codec_order_last = switch_separate_string(codec_string, ',', codec_order, SWITCH_MAX_CODECS); - codec_order_p = codec_order; - } else { - codec_string = globals.codec_string; - codec_order_last = globals.codec_order_last; - codec_order_p = globals.codec_order; - } - - if (codec_string) { - if ((tech_pvt->num_codecs = switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, NULL, - SWITCH_MAX_CODECS, codec_order_p, codec_order_last)) <= 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n"); - return 0; - } - - } else if (((tech_pvt->num_codecs = switch_loadable_module_get_codecs(tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n"); - return 0; - } - } - - return tech_pvt->num_codecs; -} - - - -static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t *thread, void *obj) -{ - ldl_handle_t *handle = obj; - mdl_profile_t *profile = NULL; - - - - profile = ldl_handle_get_private(handle); - globals.handles++; - switch_set_flag(profile, TFLAG_IO); - ldl_handle_run(handle); - switch_clear_flag(profile, TFLAG_IO); - globals.handles--; - ldl_handle_destroy(&profile->handle); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s [%s] Destroyed\n", profile->name, profile->login); - - return NULL; -} - -static void handle_thread_launch(ldl_handle_t *handle) -{ - switch_thread_t *thread; - switch_threadattr_t *thd_attr = NULL; - - switch_threadattr_create(&thd_attr, module_pool); - switch_threadattr_detach_set(thd_attr, 1); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&thread, thd_attr, handle_thread_run, handle, module_pool); - -} - - -switch_status_t mdl_build_crypto(struct private_object *tech_pvt, ldl_transport_type_t ttype, - int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction) -{ - unsigned char b64_key[512] = ""; - const char *type_str; - unsigned char *key; - char *p; - - - if (!switch_test_flag(tech_pvt, TFLAG_SECURE)) { - return SWITCH_STATUS_SUCCESS; - } - - - if (type == AES_CM_128_HMAC_SHA1_80) { - type_str = SWITCH_RTP_CRYPTO_KEY_80; - } else { - type_str = SWITCH_RTP_CRYPTO_KEY_32; - } - - if (direction == SWITCH_RTP_CRYPTO_SEND) { - key = tech_pvt->transports[ttype].local_raw_key; - } else { - key = tech_pvt->transports[ttype].remote_raw_key; - - } - - switch_rtp_get_random(key, SWITCH_RTP_KEY_LEN); - switch_b64_encode(key, SWITCH_RTP_KEY_LEN, b64_key, sizeof(b64_key)); - p = strrchr((char *) b64_key, '='); - - while (p && *p && *p == '=') { - *p-- = '\0'; - } - - tech_pvt->transports[ttype].local_crypto_key = switch_core_session_sprintf(tech_pvt->session, "%d %s inline:%s", index, type_str, b64_key); - tech_pvt->transports[ttype].local_crypto_data = switch_core_session_alloc(tech_pvt->session, sizeof(ldl_crypto_data_t)); - tech_pvt->transports[ttype].local_crypto_data->tag = switch_core_session_sprintf(tech_pvt->session, "%d", index); - tech_pvt->transports[ttype].local_crypto_data->suite = switch_core_session_strdup(tech_pvt->session, type_str); - tech_pvt->transports[ttype].local_crypto_data->key = switch_core_session_sprintf(tech_pvt->session, "inline:%s", (char *)b64_key); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Local Key [%s]\n", tech_pvt->transports[ttype].local_crypto_key); - - tech_pvt->transports[ttype].crypto_type = AES_CM_128_NULL_AUTH; - - - return SWITCH_STATUS_SUCCESS; -} - - -static switch_status_t mdl_add_crypto(struct private_object *tech_pvt, - ldl_transport_type_t ttype, const char *key_str, switch_rtp_crypto_direction_t direction) -{ - unsigned char key[SWITCH_RTP_MAX_CRYPTO_LEN]; - switch_rtp_crypto_key_type_t type; - char *p; - - - p = strchr(key_str, ' '); - - if (p && *p && *(p + 1)) { - p++; - if (!strncasecmp(p, SWITCH_RTP_CRYPTO_KEY_32, strlen(SWITCH_RTP_CRYPTO_KEY_32))) { - type = AES_CM_128_HMAC_SHA1_32; - } else if (!strncasecmp(p, SWITCH_RTP_CRYPTO_KEY_80, strlen(SWITCH_RTP_CRYPTO_KEY_80))) { - type = AES_CM_128_HMAC_SHA1_80; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Parse Error near [%s]\n", p); - goto bad; - } - - p = strchr(p, ' '); - if (p && *p && *(p + 1)) { - p++; - if (strncasecmp(p, "inline:", 7)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Parse Error near [%s]\n", p); - goto bad; - } - - p += 7; - switch_b64_decode(p, (char *) key, sizeof(key)); - - if (direction == SWITCH_RTP_CRYPTO_SEND) { - tech_pvt->transports[ttype].crypto_send_type = type; - memcpy(tech_pvt->transports[ttype].local_raw_key, key, SWITCH_RTP_KEY_LEN); - } else { - tech_pvt->transports[ttype].crypto_recv_type = type; - memcpy(tech_pvt->transports[ttype].remote_raw_key, key, SWITCH_RTP_KEY_LEN); - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, - "%s Setting %s crypto key\n", ldl_transport_type_str(ttype), switch_core_session_get_name(tech_pvt->session)); - tech_pvt->transports[ttype].has_crypto++; - - - return SWITCH_STATUS_SUCCESS; - } - - } - - bad: - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Error!\n"); - return SWITCH_STATUS_FALSE; - -} - -static void try_secure(struct private_object *tech_pvt, ldl_transport_type_t ttype) -{ - switch_secure_settings_t ssec; /* Used just to wrap over params in a call to switch_rtp_add_crypto_key. */ - - if (!switch_test_flag(tech_pvt, TFLAG_SECURE)) { - return; - } - - memset(&ssec, 0, sizeof(ssec)); - - if (tech_pvt->transports[ttype].crypto_recv_type) { - tech_pvt->transports[ttype].crypto_type = tech_pvt->transports[ttype].crypto_recv_type; - } - - if (tech_pvt->transports[ttype].crypto_type) { - - memcpy(ssec.local_raw_key, tech_pvt->transports[ttype].local_raw_key, switch_core_media_crypto_keysalt_len(tech_pvt->transports[ttype].crypto_type)); - ssec.local_crypto_key = switch_core_session_strdup(tech_pvt->session, tech_pvt->transports[ttype].local_crypto_key); - switch_core_media_add_crypto(tech_pvt->session, &ssec, SWITCH_RTP_CRYPTO_SEND); - switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, SWITCH_RTP_CRYPTO_SEND_RTCP, tech_pvt->transports[ttype].crypto_type, &ssec); - - memcpy(ssec.remote_raw_key, tech_pvt->transports[ttype].remote_raw_key, switch_core_media_crypto_keysalt_len(tech_pvt->transports[ttype].crypto_type)); - ssec.remote_crypto_key = switch_core_session_strdup(tech_pvt->session, tech_pvt->transports[ttype].local_crypto_key); - switch_core_media_add_crypto(tech_pvt->session, &ssec, SWITCH_RTP_CRYPTO_RECV); - switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->transports[ttype].crypto_type, &ssec); - - switch_channel_set_variable(tech_pvt->channel, "jingle_secure_audio_confirmed", "true"); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_NOTICE, - "%s %s crypto confirmed\n", ldl_transport_type_str(ttype), switch_core_session_get_name(tech_pvt->session)); - } -} - - - -static int activate_audio_rtp(struct private_object *tech_pvt) -{ - switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session); - const char *err; - int ms = tech_pvt->transports[LDL_TPORT_RTP].ptime; - switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0}; - int locked = 0; - int r = 1; - - - //if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { - // return 1; - //} - - if (!(tech_pvt->transports[LDL_TPORT_RTP].remote_ip && tech_pvt->transports[LDL_TPORT_RTP].remote_port)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No valid rtp candidates received!\n"); - return 0; - } - - if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].read_codec)) { - locked = 1; - switch_mutex_lock(tech_pvt->transports[LDL_TPORT_RTP].read_codec.mutex); - if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { - switch_rtp_kill_socket(tech_pvt->transports[LDL_TPORT_RTP].rtp_session); - switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_RTP].rtp_session); - } - - - } else { - if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_RTP].read_codec, - tech_pvt->transports[LDL_TPORT_RTP].codec_name, - NULL, - NULL, - tech_pvt->transports[LDL_TPORT_RTP].codec_rate, - ms, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - r = 0; - goto end; - } - tech_pvt->transports[LDL_TPORT_RTP].read_codec.session = tech_pvt->session; - - tech_pvt->transports[LDL_TPORT_RTP].read_frame.rate = tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_second; - tech_pvt->transports[LDL_TPORT_RTP].read_frame.codec = &tech_pvt->transports[LDL_TPORT_RTP].read_codec; - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Read Codec to %s@%d\n", - tech_pvt->transports[LDL_TPORT_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_second); - - if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_RTP].write_codec, - tech_pvt->transports[LDL_TPORT_RTP].codec_name, - NULL, - NULL, - tech_pvt->transports[LDL_TPORT_RTP].codec_rate, - ms, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - r = 0; - goto end; - } - tech_pvt->transports[LDL_TPORT_RTP].write_codec.session = tech_pvt->session; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Write Codec to %s@%d\n", - tech_pvt->transports[LDL_TPORT_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_RTP].write_codec.implementation->samples_per_second); - - switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].read_codec); - switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].write_codec); - } - - if (globals.auto_nat && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->transports[LDL_TPORT_RTP].remote_ip, tech_pvt->profile->local_network)) { - switch_port_t external_port = 0; - switch_nat_add_mapping((switch_port_t) tech_pvt->transports[LDL_TPORT_RTP].local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE); - - if (external_port) { - tech_pvt->transports[LDL_TPORT_RTP].adv_local_port = external_port; - switch_set_flag(tech_pvt, TFLAG_NAT_MAP); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "NAT mapping returned 0. Run freeswitch with -nonat since it's not working right.\n"); - } - } - - if (tech_pvt->transports[LDL_TPORT_RTP].adv_local_port != tech_pvt->transports[LDL_TPORT_RTP].local_port) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", - tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_RTP].local_port, - tech_pvt->transports[LDL_TPORT_RTP].adv_local_port, - tech_pvt->transports[LDL_TPORT_RTP].remote_ip, - tech_pvt->transports[LDL_TPORT_RTP].remote_port, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->iananame, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->ianacode, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->microseconds_per_packet - - ); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP AUDIO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", - tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_RTP].local_port, - tech_pvt->transports[LDL_TPORT_RTP].remote_ip, - tech_pvt->transports[LDL_TPORT_RTP].remote_port, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->iananame, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->ianacode, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->microseconds_per_packet - ); - } - - flags[SWITCH_RTP_FLAG_DATAWAIT]++; - flags[SWITCH_RTP_FLAG_GOOGLEHACK]++; - flags[SWITCH_RTP_FLAG_AUTOADJ]++; - flags[SWITCH_RTP_FLAG_RAW_WRITE]++; - flags[SWITCH_RTP_FLAG_AUTO_CNG]++; - - if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) { - flags[SWITCH_RTP_FLAG_USE_TIMER]++; - } - - if (switch_true(switch_channel_get_variable(channel, "disable_rtp_auto_adjust"))) { - flags[SWITCH_RTP_FLAG_AUTOADJ] = 0; - } - - if (!(tech_pvt->transports[LDL_TPORT_RTP].rtp_session = switch_rtp_new(tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_RTP].local_port, - tech_pvt->transports[LDL_TPORT_RTP].remote_ip, - tech_pvt->transports[LDL_TPORT_RTP].remote_port, - tech_pvt->transports[LDL_TPORT_RTP].codec_num, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet, - tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->microseconds_per_packet, - flags, tech_pvt->profile->timer_name, &err, switch_core_session_get_pool(tech_pvt->session), 0, 0))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - r = 0; - goto end; - } else { - uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0; - uint8_t vad_out = switch_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0; - uint8_t inb = switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1; - - switch_rtp_set_ssrc(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_RTP].ssrc); - - switch_rtp_intentional_bugs(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, RTP_BUG_GEN_ONE_GEN_ALL); - - - if (tech_pvt->transports[LDL_TPORT_RTCP].remote_port) { - switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, MDL_RTCP_DUR, - tech_pvt->transports[LDL_TPORT_RTCP].remote_port, SWITCH_FALSE); - - } - - try_secure(tech_pvt, LDL_TPORT_RTP); - - switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, - tech_pvt->transports[LDL_TPORT_RTP].remote_user, - tech_pvt->transports[LDL_TPORT_RTP].local_user, - tech_pvt->transports[LDL_TPORT_RTP].remote_pass, NULL, - IPR_RTP, - ICE_GOOGLE_JINGLE, 0); - - if ((vad_in && inb) || (vad_out && !inb)) { - if (switch_rtp_enable_vad(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, tech_pvt->session, &tech_pvt->transports[LDL_TPORT_RTP].read_codec, SWITCH_VAD_FLAG_TALKING) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "VAD ERROR %s\n", err); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - r = 0; - goto end; - } - switch_set_flag_locked(tech_pvt, TFLAG_VAD); - } - //switch_rtp_set_cng_pt(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 13); - switch_rtp_set_telephony_event(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, 101); - - if (tech_pvt->transports[LDL_TPORT_RTCP].remote_port) { - switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, - tech_pvt->transports[LDL_TPORT_RTCP].remote_user, - tech_pvt->transports[LDL_TPORT_RTCP].local_user, - tech_pvt->transports[LDL_TPORT_RTCP].remote_pass, - NULL, IPR_RTCP, - ICE_GOOGLE_JINGLE, 0); - - } - - - - } - - end: - - if (locked) { - switch_mutex_unlock(tech_pvt->transports[LDL_TPORT_RTP].read_codec.mutex); - } - - return r; -} - - -static int activate_video_rtp(struct private_object *tech_pvt) -{ - switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session); - const char *err; - int ms = 0; - switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0}; - int r = 1, locked = 0; - - - if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) { - r = 1; goto end; - } - - if (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No valid video_rtp candidates received!\n"); - r = 0; goto end; - } - - if (zstr(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No valid video_rtp codecs received!\n"); - r = 0; goto end; - } - - if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec)) { - locked = 1; - switch_mutex_lock(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.mutex); - if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) { - switch_rtp_kill_socket(tech_pvt->transports[LDL_TPORT_RTP].rtp_session); - switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session); - } - - } else { - if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name, - NULL, - NULL, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_rate, - ms, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - r = 0; goto end; - } - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.rate = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_second; - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.codec = &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec; - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Read Codec to %s@%d\n", - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_second); - - if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].write_codec, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name, - NULL, - NULL, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_rate, - ms, - 1, - SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, - NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Can't load codec?\n"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - r = 0; goto end; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Write Codec to %s@%d\n", - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name, (int) tech_pvt->transports[LDL_TPORT_VIDEO_RTP].write_codec.implementation->samples_per_second); - - switch_core_session_set_video_read_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec); - switch_core_session_set_video_write_codec(tech_pvt->session, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].write_codec); - } - - if (globals.auto_nat && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, tech_pvt->profile->local_network)) { - switch_port_t external_port = 0; - switch_nat_add_mapping((switch_port_t) tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE); - - if (external_port) { - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port = external_port; - switch_set_flag(tech_pvt, TFLAG_NAT_MAP); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "NAT mapping returned 0. Run freeswitch with -nonat since it's not working right.\n"); - } - } - - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port != tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d(%d) -> %s:%d codec: %s(%d) %dh %di\n", - tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->iananame, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->ianacode, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_packet, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->microseconds_per_packet - - ); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "SETUP VIDEO RTP %s:%d -> %s:%d codec: %s(%d) %dh %di\n", - tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->iananame, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->ianacode, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->samples_per_packet, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation->microseconds_per_packet - ); - } - - flags[SWITCH_RTP_FLAG_DATAWAIT]++; - flags[SWITCH_RTP_FLAG_GOOGLEHACK]++; - flags[SWITCH_RTP_FLAG_AUTOADJ]++; - flags[SWITCH_RTP_FLAG_RAW_WRITE]++; - flags[SWITCH_RTP_FLAG_VIDEO]++; - - if (switch_true(switch_channel_get_variable(channel, "disable_rtp_auto_adjust"))) { - flags[SWITCH_RTP_FLAG_AUTOADJ] = 0; - } - - if (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session = switch_rtp_new(tech_pvt->profile->ip, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_ip, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_port, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num, - 1, - 90000, - flags, NULL, &err, switch_core_session_get_pool(tech_pvt->session), 0, 0))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - r = 0; goto end; - } else { - switch_rtp_set_ssrc(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc); - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port) { - switch_rtp_activate_rtcp(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, MDL_RTCP_DUR, - tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port, SWITCH_FALSE); - } - try_secure(tech_pvt, LDL_TPORT_VIDEO_RTP); - - - switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_user, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_user, - NULL, NULL, IPR_RTP, ICE_GOOGLE_JINGLE, 0);//tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_pass); - switch_channel_set_flag(channel, CF_VIDEO); - switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY); - //switch_rtp_set_default_payload(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num); - //switch_rtp_set_recv_pt(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num); - - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port) { - - switch_rtp_activate_ice(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, - tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_user, - tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].local_user, - NULL, NULL, IPR_RTCP, ICE_GOOGLE_JINGLE, 0);//tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_pass); - } - - - - } - - end: - if (locked) { - switch_mutex_unlock(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.mutex); - } - - return r; -} - - - -static int activate_rtp(struct private_object *tech_pvt) -{ - int r = 0; - - if (tech_pvt->transports[LDL_TPORT_RTP].ready) { - r += activate_audio_rtp(tech_pvt); - } - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready) { - if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted) { - r += activate_video_rtp(tech_pvt); - } - } - - return r; -} - - -static int do_tport_candidates(struct private_object *tech_pvt, ldl_transport_type_t ttype, ldl_candidate_t *cand, int force) -{ - switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session); - char *advip = tech_pvt->profile->extip ? tech_pvt->profile->extip : tech_pvt->profile->ip; - char *err = NULL, *address = NULL; - - if (!force && tech_pvt->transports[ttype].ready) { - return 0; - } - - if (switch_test_flag(tech_pvt, TFLAG_LANADDR)) { - advip = tech_pvt->profile->ip; - } - address = advip; - - if (address && !strncasecmp(address, "host:", 5)) { - char *lookup = switch_stun_host_lookup(address + 5, switch_core_session_get_pool(tech_pvt->session)); - - if (zstr(lookup)) { - address = address + 5; - } else { - address = lookup; - } - } - - memset(cand, 0, sizeof(*cand)); - switch_stun_random_string(tech_pvt->transports[ttype].local_user, 16, NULL); - switch_stun_random_string(tech_pvt->transports[ttype].local_pass, 16, NULL); - - cand->port = tech_pvt->transports[ttype].adv_local_port; - cand->address = address; - - if (advip && !strncasecmp(advip, "stun:", 5)) { - char *stun_ip = advip + 5; - - if (tech_pvt->transports[ttype].stun_ip) { - cand->address = tech_pvt->transports[ttype].stun_ip; - cand->port = tech_pvt->transports[ttype].stun_port; - } else { - if (!stun_ip) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Stun Failed! NO STUN SERVER!\n"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return 0; - } - - cand->address = tech_pvt->profile->ip; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Stun Lookup Local %s:%d\n", cand->address, - cand->port); - if (switch_stun_lookup - (&cand->address, &cand->port, stun_ip, SWITCH_STUN_DEFAULT_PORT, &err, - switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, - SWITCH_STUN_DEFAULT_PORT, err); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return 0; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_INFO, "Stun Success %s:%d\n", cand->address, cand->port); - } - cand->type = "stun"; - tech_pvt->transports[ttype].stun_ip = switch_core_session_strdup(tech_pvt->session, cand->address); - tech_pvt->transports[ttype].stun_port = cand->port; - } else { - cand->type = "local"; - } - - cand->name = (char *)ldl_transport_type_str(ttype); - cand->username = tech_pvt->transports[ttype].local_user; - cand->password = tech_pvt->transports[ttype].local_pass; - cand->pref = 1; - cand->protocol = "udp"; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, - "Send %s Candidate %s:%d [%s]\n", ldl_transport_type_str(ttype), cand->address, cand->port, - cand->username); - - - - tech_pvt->transports[ttype].ready = 1; - - return 1; -} - - -static int do_candidates(struct private_object *tech_pvt, int force) -{ - ldl_candidate_t cand[4] = {{0}}; - int idx = 0; - - if (switch_test_flag(tech_pvt, TFLAG_DO_CAND)) { - return 1; - } - - tech_pvt->next_cand += DL_CAND_WAIT; - if (switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->dlsession) { - return 0; - } - switch_set_flag_locked(tech_pvt, TFLAG_DO_CAND); - - idx += do_tport_candidates(tech_pvt, LDL_TPORT_RTP, &cand[idx], force); - idx += do_tport_candidates(tech_pvt, LDL_TPORT_RTCP, &cand[idx], force); - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index > -1) { - idx += do_tport_candidates(tech_pvt, LDL_TPORT_VIDEO_RTP, &cand[idx], force); - idx += do_tport_candidates(tech_pvt, LDL_TPORT_VIDEO_RTCP, &cand[idx], force); - } - - if (idx && cand[0].name) { - if (ldl_session_gateway(tech_pvt->dlsession) && switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - tech_pvt->cand_id = ldl_session_transport(tech_pvt->dlsession, cand, idx); - } else { - tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, idx); - } - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtp candidates.\n", - tech_pvt->transports[LDL_TPORT_RTP].accepted, tech_pvt->transports[LDL_TPORT_RTP].total); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u rtcp candidates.\n", - tech_pvt->transports[LDL_TPORT_RTCP].accepted, tech_pvt->transports[LDL_TPORT_RTCP].total); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rtp candidates\n", - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].accepted, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].total); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Accepted %u of %u video_rctp candidates\n", - tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted, tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].total); - - - - if ((tech_pvt->transports[LDL_TPORT_RTP].ready && tech_pvt->transports[LDL_TPORT_RTCP].ready)) { - switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT); - switch_set_flag_locked(tech_pvt, TFLAG_RTP_READY); - tech_pvt->audio_ready = switch_micro_time_now(); - } - - - switch_clear_flag_locked(tech_pvt, TFLAG_DO_CAND); - return 1; - -} - - - - -static char *lame(char *in) -{ - if (!strncasecmp(in, "ilbc", 4)) { - return "iLBC"; - } else { - return in; - } -} - - -static void setup_codecs(struct private_object *tech_pvt) -{ - ldl_payload_t payloads[LDL_MAX_PAYLOADS] = { {0} }; - unsigned int idx = 0, i = 0; - int dft_audio = -1, dft_video = -1; - - memset(payloads, 0, sizeof(payloads)); - - for (idx = 0; idx < tech_pvt->num_codecs && (dft_audio == -1 || dft_video == -1); idx++) { - if (dft_audio < 0 && tech_pvt->codecs[idx]->codec_type == SWITCH_CODEC_TYPE_AUDIO) { - dft_audio = idx; - } - if (dft_video < 0 && tech_pvt->codecs[idx]->codec_type == SWITCH_CODEC_TYPE_VIDEO) { - dft_video = idx; - } - } - - if (dft_audio == -1 && dft_video == -1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Cannot find a codec.\n"); - return; - } - - idx = 0; - - payloads[0].type = LDL_PAYLOAD_AUDIO; - if (tech_pvt->transports[LDL_TPORT_RTP].codec_index < 0) { - if (dft_audio > -1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have my audio codec yet here's one\n"); - tech_pvt->transports[LDL_TPORT_RTP].codec_name = lame(tech_pvt->codecs[dft_audio]->iananame); - tech_pvt->transports[LDL_TPORT_RTP].codec_num = tech_pvt->codecs[dft_audio]->ianacode; - tech_pvt->transports[LDL_TPORT_RTP].codec_rate = tech_pvt->codecs[dft_audio]->samples_per_second; - tech_pvt->transports[LDL_TPORT_RTP].r_codec_num = tech_pvt->codecs[dft_audio]->ianacode; - tech_pvt->transports[LDL_TPORT_RTP].codec_index = dft_audio; - - payloads[0].name = lame(tech_pvt->codecs[dft_audio]->iananame); - payloads[0].id = tech_pvt->codecs[dft_audio]->ianacode; - payloads[0].rate = tech_pvt->codecs[dft_audio]->samples_per_second; - payloads[0].bps = tech_pvt->codecs[dft_audio]->bits_per_second; - payloads[0].ptime = tech_pvt->codecs[dft_audio]->microseconds_per_packet / 1000; - idx++; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have an audio codec.\n"); - } - } else { - payloads[0].name = lame(tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->iananame); - payloads[0].id = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->ianacode; - payloads[0].rate = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->samples_per_second; - payloads[0].bps = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->bits_per_second; - payloads[0].ptime = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_RTP].codec_index]->microseconds_per_packet / 1000; - idx++; - } - - - payloads[1].type = LDL_PAYLOAD_VIDEO; - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index < 0) { - if (dft_video > -1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have my video codec yet here's one\n"); - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name = lame(tech_pvt->codecs[dft_video]->iananame); - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num = tech_pvt->codecs[dft_video]->ianacode; - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_rate = tech_pvt->codecs[dft_video]->samples_per_second; - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].r_codec_num = tech_pvt->codecs[dft_video]->ianacode; - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index = dft_video; - - payloads[1].name = lame(tech_pvt->codecs[dft_video]->iananame); - payloads[1].id = tech_pvt->codecs[dft_video]->ianacode; - payloads[1].rate = tech_pvt->codecs[dft_video]->samples_per_second; - payloads[1].bps = tech_pvt->codecs[dft_video]->bits_per_second; - payloads[1].width = 600; - payloads[1].height = 400; - payloads[1].framerate = 30; - - idx++; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Don't have video codec.\n"); - } - } else { - payloads[1].name = lame(tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index]->iananame); - payloads[1].id = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index]->ianacode; - payloads[1].rate = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index]->samples_per_second; - payloads[1].bps = tech_pvt->codecs[tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index]->bits_per_second; - idx++; - } - - for(i = 0; i < idx; i++) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Describe [%s@%d]\n", payloads[i].name, payloads[i].rate); - } - - - if (!payloads[1].id && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { - switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port); - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port = 0; - } - - - tech_pvt->desc_id = ldl_session_describe(tech_pvt->dlsession, payloads, idx, - switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? LDL_DESCRIPTION_INITIATE : LDL_DESCRIPTION_ACCEPT, - &tech_pvt->transports[LDL_TPORT_RTP].ssrc, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ssrc, - tech_pvt->transports[LDL_TPORT_RTP].local_crypto_data, - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_crypto_data); - - -} - -static int do_describe(struct private_object *tech_pvt, int force) -{ - - if (!tech_pvt->session) { - return 0; - } - - tech_pvt->next_desc += DL_CAND_WAIT; - - if (switch_test_flag(tech_pvt, TFLAG_BYE)) { - return 0; - } - - - switch_set_flag_locked(tech_pvt, TFLAG_DO_CAND); - if (!get_codecs(tech_pvt)) { - terminate_session(&tech_pvt->session, __LINE__, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - return 0; - } - - - if (force || !switch_test_flag(tech_pvt, TFLAG_CODEC_READY)) { - setup_codecs(tech_pvt); - switch_set_flag_locked(tech_pvt, TFLAG_CODEC_READY); - } - switch_clear_flag_locked(tech_pvt, TFLAG_DO_CAND); - return 1; -} - -static switch_status_t negotiate_media(switch_core_session_t *session) -{ - switch_status_t ret = SWITCH_STATUS_FALSE; - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - switch_time_t started; - switch_time_t now; - unsigned int elapsed, audio_elapsed; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch_set_flag_locked(tech_pvt, TFLAG_IO); - - started = switch_micro_time_now(); - - /* jingle has no ringing indication so we will just pretend that we got one */ - switch_channel_mark_ring_ready(channel); - - if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - tech_pvt->next_cand = started + DL_CAND_WAIT; - tech_pvt->next_desc = started; - } else { - tech_pvt->next_cand = started + DL_CAND_WAIT; - tech_pvt->next_desc = started + DL_CAND_WAIT; - } - - while (!(switch_test_flag(tech_pvt, TFLAG_CODEC_READY) && - switch_test_flag(tech_pvt, TFLAG_RTP_READY) && - (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || switch_test_flag(tech_pvt, TFLAG_VIDEO_RTP_READY)) && - switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) && //tech_pvt->read_count && - tech_pvt->transports[LDL_TPORT_RTP].remote_ip && tech_pvt->transports[LDL_TPORT_RTP].remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) { - now = switch_micro_time_now(); - elapsed = (unsigned int) ((now - started) / 1000); - - - if (switch_test_flag(tech_pvt, TFLAG_RTP_READY) && !switch_test_flag(tech_pvt, TFLAG_VIDEO_RTP_READY)) { - audio_elapsed = (unsigned int) ((now - tech_pvt->audio_ready) / 1000); - if (audio_elapsed > 1000) { - switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY); - } - } - - if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) { - goto out; - } - - - if (now >= tech_pvt->next_desc) { - if (!do_describe(tech_pvt, 0)) { - goto out; - } - } - - if (tech_pvt->next_cand && now >= tech_pvt->next_cand) { - if (!do_candidates(tech_pvt, 0)) { - goto out; - } - } - if (elapsed > 60000) { - terminate_session(&tech_pvt->session, __LINE__, SWITCH_CAUSE_NORMAL_CLEARING); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - goto done; - } - - if (switch_test_flag(tech_pvt, TFLAG_BYE) || !switch_test_flag(tech_pvt, TFLAG_IO)) { - goto done; - } - - if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { - switch_rtp_ping(tech_pvt->transports[LDL_TPORT_RTP].rtp_session); - } - - if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session)) { - switch_rtp_ping(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session); - } - - switch_yield(20000); - } - - if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) { - goto done; - } - - if (!activate_rtp(tech_pvt)) { - goto done; - } - - if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (!do_candidates(tech_pvt, 0)) { - goto done; - } - if (switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT)) { - switch_channel_answer(channel); - } - } - ret = SWITCH_STATUS_SUCCESS; - - switch_channel_audio_sync(channel); - - - goto done; - - out: - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - done: - - return ret; -} - -/* - State methods they get called when the state changes to the specific state - returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next - so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. -*/ -static switch_status_t channel_on_init(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - switch_status_t status = SWITCH_STATUS_SUCCESS; - - switch_channel_set_variable(channel, "jitterbuffer_msec", "1p"); - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - tech_pvt->transports[LDL_TPORT_RTP].read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN; - - switch_set_flag(tech_pvt, TFLAG_READY); - - if (negotiate_media(session) == SWITCH_STATUS_SUCCESS) { - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - switch_channel_mark_answered(channel); - } - status = SWITCH_STATUS_SUCCESS; - } - - return status; -} - -static switch_status_t channel_on_routing(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_execute(switch_core_session_t *session) -{ - - switch_channel_t *channel = NULL; - struct private_object *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - switch_assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel)); - - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_destroy(switch_core_session_t *session) -{ - //switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - - if (tech_pvt) { - if (tech_pvt->transports[LDL_TPORT_RTP].rtp_session) { - switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_RTP].rtp_session); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "NUKE RTP\n"); - tech_pvt->transports[LDL_TPORT_RTP].rtp_session = NULL; - } - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session) { - switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "NUKE RTP\n"); - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session = NULL; - } - - if (switch_test_flag(tech_pvt, TFLAG_NAT_MAP)) { - switch_nat_del_mapping((switch_port_t) tech_pvt->transports[LDL_TPORT_RTP].adv_local_port, SWITCH_NAT_UDP); - switch_clear_flag(tech_pvt, TFLAG_NAT_MAP); - } - - if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].read_codec)) { - switch_core_codec_destroy(&tech_pvt->transports[LDL_TPORT_RTP].read_codec); - } - - if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].write_codec)) { - switch_core_codec_destroy(&tech_pvt->transports[LDL_TPORT_RTP].write_codec); - } - - if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec)) { - switch_core_codec_destroy(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec); - } - - if (switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].write_codec)) { - switch_core_codec_destroy(&tech_pvt->transports[LDL_TPORT_RTP].write_codec); - } - - if (tech_pvt->dlsession) { - ldl_session_destroy(&tech_pvt->dlsession); - } - - if (tech_pvt->profile) { - switch_thread_rwlock_unlock(tech_pvt->profile->rwlock); - - if (tech_pvt->profile->purge) { - mdl_profile_t *profile = tech_pvt->profile; - if (switch_core_hash_delete(globals.profile_hash, profile->name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name); - } - } - } - } - - return SWITCH_STATUS_SUCCESS; -} - - -static switch_status_t channel_on_hangup(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - if (tech_pvt->profile->ip && tech_pvt->transports[LDL_TPORT_RTP].local_port) { - switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_RTP].local_port); - } - - if (tech_pvt->profile->ip && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port) { - switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port); - } - - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); - - /* Dunno why, but if googletalk calls us for the first time, as soon as the call ends - they think we are offline for no reason so we send this presence packet to stop it from happening - We should find out why..... - */ - if ((tech_pvt->profile->user_flags & LDL_FLAG_COMPONENT) && is_special(tech_pvt->them)) { - ldl_handle_send_presence(tech_pvt->profile->handle, tech_pvt->them, tech_pvt->us, NULL, NULL, "Click To Call", tech_pvt->profile->avatar); - } - - if (!switch_test_flag(tech_pvt, TFLAG_TERM) && tech_pvt->dlsession) { - ldl_session_terminate(tech_pvt->dlsession); - switch_set_flag_locked(tech_pvt, TFLAG_TERM); - } - - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel)); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - - if (!(tech_pvt = switch_core_session_get_private(session))) { - return SWITCH_STATUS_SUCCESS; - } - - switch (sig) { - case SWITCH_SIG_KILL: - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); - - if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { - switch_rtp_kill_socket(tech_pvt->transports[LDL_TPORT_RTP].rtp_session); - } - break; - case SWITCH_SIG_BREAK: - if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { - switch_rtp_set_flag(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, SWITCH_RTP_FLAG_BREAK); - } - break; - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel)); - - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_exchange_media(switch_core_session_t *session) -{ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n"); - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_soft_execute(switch_core_session_t *session) -{ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n"); - return SWITCH_STATUS_SUCCESS; -} - - -static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf) -{ - struct private_object *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "DTMF [%c]\n", dtmf->digit); - - return switch_rtp_queue_rfc2833(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, dtmf); - -} - -static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) -{ - struct private_object *tech_pvt = NULL; - switch_channel_t *channel = switch_core_session_get_channel(session); - //int payload = 0; - - tech_pvt = (struct private_object *) switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - while (!(tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation && switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session))) { - if (switch_channel_ready(channel)) { - switch_yield(10000); - } else { - return SWITCH_STATUS_GENERR; - } - } - - - tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen = 0; - switch_set_flag_locked(tech_pvt, TFLAG_READING); - -#if 0 - if (tech_pvt->last_read) { - elapsed = (unsigned int) ((switch_micro_time_now() - tech_pvt->last_read) / 1000); - if (elapsed > 60000) { - return SWITCH_STATUS_TIMEOUT; - } - } -#endif - - - if (switch_test_flag(tech_pvt, TFLAG_IO)) { - //switch_status_t status; - - switch_assert(tech_pvt->transports[LDL_TPORT_RTP].rtp_session != NULL); - tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen = 0; - - - while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen == 0) { - tech_pvt->transports[LDL_TPORT_RTP].read_frame.flags = SFF_NONE; - - switch_rtp_zerocopy_read_frame(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, &tech_pvt->transports[LDL_TPORT_RTP].read_frame, flags); - - tech_pvt->read_count++; -#if 0 - if (tech_pvt->read_count == 1 && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - setup_codecs(tech_pvt); - } -#endif - - //payload = tech_pvt->transports[LDL_TPORT_RTP].read_frame.payload; - -#if 0 - elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000); - - if (timeout > -1) { - if (elapsed >= (unsigned int) timeout) { - return SWITCH_STATUS_BREAK; - } - } - - elapsed = (unsigned int) ((switch_micro_time_now() - last_act) / 1000); - if (elapsed >= hard_timeout) { - return SWITCH_STATUS_BREAK; - } -#endif - if (switch_rtp_has_dtmf(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { - switch_dtmf_t dtmf = { 0 }; - switch_rtp_dequeue_dtmf(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, &dtmf); - switch_channel_queue_dtmf(channel, &dtmf); - } - - - if (tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen > 0) { - size_t bytes = 0; - int frames = 1; - - if (!switch_test_flag((&tech_pvt->transports[LDL_TPORT_RTP].read_frame), SFF_CNG)) { - if ((bytes = tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->encoded_bytes_per_packet)) { - frames = (int)(tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen / bytes); - } - tech_pvt->transports[LDL_TPORT_RTP].read_frame.samples = (int) (frames * tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet); - } - break; - } - } - } - - switch_clear_flag_locked(tech_pvt, TFLAG_READING); - - if (tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen == 0) { - switch_set_flag((&tech_pvt->transports[LDL_TPORT_RTP].read_frame), SFF_CNG); - tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen = 2; - } - - *frame = &tech_pvt->transports[LDL_TPORT_RTP].read_frame; - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) -{ - struct private_object *tech_pvt; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_status_t status = SWITCH_STATUS_SUCCESS; - int bytes = 0, samples = 0, frames = 0; - - tech_pvt = (struct private_object *) switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - while (!(tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation && switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session))) { - if (switch_channel_ready(channel)) { - switch_yield(10000); - } else { - return SWITCH_STATUS_GENERR; - } - } - - if (!switch_core_codec_ready(&tech_pvt->transports[LDL_TPORT_RTP].read_codec) || !tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation) { - return SWITCH_STATUS_GENERR; - } - - if (!switch_test_flag(tech_pvt, TFLAG_IO)) { - return SWITCH_STATUS_SUCCESS; - } - - switch_set_flag_locked(tech_pvt, TFLAG_WRITING); - - if (!switch_test_flag(frame, SFF_CNG)) { - if (tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->encoded_bytes_per_packet) { - bytes = tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->encoded_bytes_per_packet; - frames = ((int) frame->datalen / bytes); - } else - frames = 1; - - samples = frames * tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet; - } -#if 0 - printf("%s %s->%s send %d bytes %d samples in %d frames ts=%d\n", - switch_channel_get_name(channel), - tech_pvt->local_sdp_audio_ip, tech_pvt->remote_sdp_audio_ip, frame->datalen, samples, frames, tech_pvt->timestamp_send); -#endif - - tech_pvt->timestamp_send += samples; - //switch_rtp_write_frame(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, frame, tech_pvt->timestamp_send); - if (switch_rtp_write_frame(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, frame) < 0) { - status = SWITCH_STATUS_GENERR; - } - - switch_clear_flag_locked(tech_pvt, TFLAG_WRITING); - return status; -} - - -static switch_status_t channel_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) -{ - struct private_object *tech_pvt = NULL; - switch_channel_t *channel = switch_core_session_get_channel(session); - //int payload = 0; - //switch_status_t status; - - tech_pvt = (struct private_object *) switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - if (!switch_test_flag(tech_pvt, TFLAG_IO)) { - return SWITCH_STATUS_GENERR; - } - - while (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation && switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session))) { - if (switch_channel_ready(channel)) { - switch_yield(10000); - } else { - return SWITCH_STATUS_GENERR; - } - } - - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen = 0; - - while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen == 0) { - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.flags = SFF_NONE; - switch_rtp_zerocopy_read_frame(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame, flags); - } - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen == 0) { - switch_set_flag((&tech_pvt->transports[LDL_TPORT_RTP].read_frame), SFF_CNG); - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame.datalen = 2; - } - - *frame = &tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_frame; - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) -{ - struct private_object *tech_pvt = (struct private_object *)switch_core_session_get_private(session); - switch_channel_t *channel = switch_core_session_get_channel(session); - int wrote = 0; - - switch_assert(tech_pvt != NULL); - - while (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec.implementation && switch_rtp_ready(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session))) { - if (switch_channel_ready(channel)) { - switch_yield(10000); - } else { - return SWITCH_STATUS_GENERR; - } - } - - if (!switch_test_flag(tech_pvt, TFLAG_IO)) { - return SWITCH_STATUS_SUCCESS; - } - - if (!switch_test_flag(frame, SFF_CNG)) { - wrote = switch_rtp_write_frame(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, frame); - } - - return wrote > -1 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_GENERR; -} - -static switch_status_t channel_answer_channel(switch_core_session_t *session) -{ - struct private_object *tech_pvt; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); - } - - return SWITCH_STATUS_SUCCESS; -} - - -static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) -{ - struct private_object *tech_pvt; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_ANSWER: - channel_answer_channel(session); - break; - case SWITCH_MESSAGE_INDICATE_STUN_ERROR: - //switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_NORMAL_CLEARING); - break; - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event) -{ - struct private_object *tech_pvt; - char *subject, *body; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - - if (!(body = switch_event_get_body(event))) { - body = ""; - } - - if (!(subject = switch_event_get_header(event, "subject"))) { - subject = "None"; - } - - ldl_session_send_msg(tech_pvt->dlsession, subject, body); - - return SWITCH_STATUS_SUCCESS; -} - -switch_state_handler_table_t dingaling_event_handlers = { - /*.on_init */ channel_on_init, - /*.on_routing */ channel_on_routing, - /*.on_execute */ channel_on_execute, - /*.on_hangup */ channel_on_hangup, - /*.on_exchange_media */ channel_on_exchange_media, - /*.on_soft_execute */ channel_on_soft_execute, - /*.on_consume_media */ NULL, - /*.on_hibernate */ NULL, - /*.on_reset */ NULL, - /*.on_park */ NULL, - /*.on_reporting */ NULL, - /*.on_destroy */ channel_on_destroy -}; - -switch_io_routines_t dingaling_io_routines = { - /*.outgoing_channel */ channel_outgoing_channel, - /*.transports[LDL_TPORT_RTP].read_frame */ channel_read_frame, - /*.write_frame */ channel_write_frame, - /*.kill_channel */ channel_kill_channel, - /*.send_dtmf */ channel_send_dtmf, - /*.receive_message */ channel_receive_message, - /*.receive_event */ channel_receive_event, - /*.state_change */ NULL, - /*.read_video_frame */ channel_read_video_frame, - /*.write_video_frame */ channel_write_video_frame -}; - - - -/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines - that allocate memory or you will have 1 channel with memory allocated from another channel's pool! -*/ -static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, - switch_caller_profile_t *outbound_profile, - switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t oflags, - switch_call_cause_t *cancel_cause) -{ - struct private_object *tech_pvt; - switch_channel_t *channel; - switch_caller_profile_t *caller_profile = NULL; - mdl_profile_t *mdl_profile = NULL; - ldl_session_t *dlsession = NULL; - char *profile_name; - char *callto; - char idbuf[1024]; - char *full_id = NULL; - char sess_id[11] = ""; - char *dnis = NULL; - char workspace[1024] = ""; - char *p, *u, ubuf[512] = "", *user = NULL, *f_cid_msg = NULL; - const char *cid_msg = NULL; - ldl_user_flag_t flags = LDL_FLAG_OUTBOUND; - const char *var; - char name[128]; - - *new_session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, oflags, pool); - - if (!*new_session) { - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - if (!outbound_profile) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Doh! no caller profile\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - switch_copy_string(workspace, outbound_profile->destination_number, sizeof(workspace)); - profile_name = workspace; - - if ((callto = strchr(profile_name, '/'))) { - *callto++ = '\0'; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Invalid URL!\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_INVALID_NUMBER_FORMAT; - } - - if ((dnis = strchr(callto, ':'))) { - *dnis++ = '\0'; - } - - for (p = callto; p && *p; p++) { - *p = (char) tolower(*p); - } - - if ((p = strchr(profile_name, '@'))) { - *p++ = '\0'; - u = profile_name; - profile_name = p; - switch_snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", u, profile_name); - user = ubuf; - } - - mdl_profile = switch_core_hash_find(globals.profile_hash, profile_name); - - if (!mdl_profile) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Unknown Profile!\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - if (!(mdl_profile->user_flags & LDL_FLAG_COMPONENT)) { - user = ldl_handle_get_login(mdl_profile->handle); - } else { - if (!user) { - const char *id_num; - - if (!(id_num = outbound_profile->caller_id_number)) { - if (!(id_num = outbound_profile->caller_id_name)) { - id_num = "nobody"; - } - } - - if (strchr(id_num, '@')) { - switch_snprintf(ubuf, sizeof(ubuf), "%s/talk", id_num); - user = ubuf; - } else { - switch_snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", id_num, profile_name); - user = ubuf; - } - } - } - - if (mdl_profile->purge) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' is marked for deletion, disallowing outgoing call\n", - mdl_profile->name); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_NORMAL_UNSPECIFIED); - return SWITCH_CAUSE_NORMAL_UNSPECIFIED; - } - - if (switch_thread_rwlock_tryrdlock(mdl_profile->rwlock) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't do read lock on profile '%s'\n", mdl_profile->name); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_NORMAL_UNSPECIFIED); - return SWITCH_CAUSE_NORMAL_UNSPECIFIED; - } - - if (!ldl_handle_ready(mdl_profile->handle)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Doh! we are not logged in yet!\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - if (switch_stristr("voice.google.com", callto)) { - full_id = callto; - flags |= LDL_FLAG_GATEWAY; - } else if (!(full_id = ldl_handle_probe(mdl_profile->handle, callto, user, idbuf, sizeof(idbuf)))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Unknown Recipient!\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_NO_USER_RESPONSE); - return SWITCH_CAUSE_NO_USER_RESPONSE; - } - - switch_core_session_add_stream(*new_session, NULL); - tech_pvt = (struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object)); - - if (!tech_pvt) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "Hey where is my memory pool?\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - memset(tech_pvt, 0, sizeof(*tech_pvt)); - tech_pvt->profile = mdl_profile; - switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(*new_session)); - tech_pvt->flags |= globals.flags; - tech_pvt->flags |= mdl_profile->flags; - channel = switch_core_session_get_channel(*new_session); - switch_core_session_set_private(*new_session, tech_pvt); - tech_pvt->session = *new_session; - tech_pvt->channel = switch_core_session_get_channel(tech_pvt->session); - tech_pvt->transports[LDL_TPORT_RTP].codec_index = -1; - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index = -1; - - switch_set_flag(tech_pvt, TFLAG_SECURE); - mdl_build_crypto(tech_pvt, LDL_TPORT_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); - mdl_build_crypto(tech_pvt, LDL_TPORT_VIDEO_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); - - if (!(tech_pvt->transports[LDL_TPORT_RTP].local_port = switch_rtp_request_port(mdl_profile->ip))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "No RTP port available!\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - tech_pvt->transports[LDL_TPORT_RTP].adv_local_port = tech_pvt->transports[LDL_TPORT_RTP].local_port; - tech_pvt->transports[LDL_TPORT_RTCP].adv_local_port = tech_pvt->transports[LDL_TPORT_RTP].local_port + 1; - if (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port = switch_rtp_request_port(mdl_profile->ip))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "No RTP port available!\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port; - tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].adv_local_port = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port + 1; - - tech_pvt->recip = switch_core_session_strdup(*new_session, full_id); - if (dnis) { - tech_pvt->dnis = switch_core_session_strdup(*new_session, dnis); - } - - switch_snprintf(name, sizeof(name), "dingaling/%s", outbound_profile->destination_number); - switch_channel_set_name(channel, name); - - caller_profile = switch_caller_profile_clone(*new_session, outbound_profile); - switch_channel_set_caller_profile(channel, caller_profile); - tech_pvt->caller_profile = caller_profile; - - switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND); - - switch_stun_random_string(sess_id, 10, "0123456789"); - tech_pvt->us = switch_core_session_strdup(*new_session, user); - tech_pvt->them = switch_core_session_strdup(*new_session, full_id); - ldl_session_create(&dlsession, mdl_profile->handle, sess_id, full_id, user, flags); - - if (session) { - switch_channel_t *calling_channel = switch_core_session_get_channel(session); - cid_msg = switch_channel_get_variable(calling_channel, "dl_cid_msg"); - } - - if (!cid_msg) { - f_cid_msg = switch_mprintf("Incoming Call From %s %s\n", outbound_profile->caller_id_name, outbound_profile->caller_id_number); - cid_msg = f_cid_msg; - } - - if ((flags & LDL_FLAG_GATEWAY)) { - cid_msg = NULL; - } - - if (cid_msg) { - char *them; - them = strdup(tech_pvt->them); - if (them) { - char *ptr; - if ((ptr = strchr(them, '/'))) { - *ptr = '\0'; - } - ldl_handle_send_msg(mdl_profile->handle, tech_pvt->us, them, "", switch_str_nil(cid_msg)); - } - switch_safe_free(them); - } - switch_safe_free(f_cid_msg); - - ldl_session_set_private(dlsession, *new_session); - ldl_session_set_value(dlsession, "dnis", dnis); - ldl_session_set_value(dlsession, "caller_id_name", outbound_profile->caller_id_name); - ldl_session_set_value(dlsession, "caller_id_number", outbound_profile->caller_id_number); - tech_pvt->dlsession = dlsession; - - if ((var = switch_event_get_header(var_event, "absolute_codec_string"))) { - switch_channel_set_variable(channel, "absolute_codec_string", var); - } - - if (!get_codecs(tech_pvt)) { - terminate_session(new_session, __LINE__, SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL); - return SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL; - } - switch_channel_set_state(channel, CS_INIT); - return SWITCH_CAUSE_SUCCESS; -} - -static switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches) -{ - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - void *val; - const void *vvar; - switch_console_callback_match_t *my_matches = NULL; - switch_status_t status = SWITCH_STATUS_FALSE; - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, &vvar, NULL, &val); - profile = (mdl_profile_t *) val; - if (!strncmp("dl_logout", line, 9)) { - if (profile->handle) { - switch_console_push_match(&my_matches, profile->name); - } - } else if (!strncmp("dl_login", line, 8)) { - if (!switch_test_flag(profile, TFLAG_IO)) { - char *profile_name = switch_mprintf("profile=%s", profile->name); - switch_console_push_match(&my_matches, profile_name); - free(profile_name); - } - } else if (!strncmp("dl_pres", line, 7)) { - if (profile->user_flags & LDL_FLAG_COMPONENT) { - switch_console_push_match(&my_matches, profile->name); - } - } else { - switch_console_push_match(&my_matches, profile->name); - } - } - - if (my_matches) { - *matches = my_matches; - status = SWITCH_STATUS_SUCCESS; - } - - return status; -} - -SWITCH_MODULE_LOAD_FUNCTION(mod_dingaling_load) -{ - switch_chat_interface_t *chat_interface; - switch_api_interface_t *api_interface; - - module_pool = pool; - - memset(&globals, 0, sizeof(globals)); - - load_config(); - - if (switch_event_reserve_subclass(DL_EVENT_LOGIN_SUCCESS) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", DL_EVENT_LOGIN_SUCCESS); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_reserve_subclass(DL_EVENT_LOGIN_FAILURE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", DL_EVENT_LOGIN_FAILURE); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_reserve_subclass(DL_EVENT_CONNECTED) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", DL_EVENT_CONNECTED); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.in_node) != - SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.probe_node) != - SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.out_node) != - SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_bind_removable(modname, SWITCH_EVENT_ROSTER, SWITCH_EVENT_SUBCLASS_ANY, roster_event_handler, NULL, &globals.roster_node) - != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, ipchanged_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); - return SWITCH_STATUS_GENERR; - } - - - /* connect my internal structure to the blank pointer passed to me */ - *module_interface = switch_loadable_module_create_module_interface(pool, modname); - dingaling_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE); - dingaling_endpoint_interface->interface_name = "dingaling"; - dingaling_endpoint_interface->io_routines = &dingaling_io_routines; - dingaling_endpoint_interface->state_handler = &dingaling_event_handlers; - -#define PRES_SYNTAX "dl_pres " -#define LOGOUT_SYNTAX "dl_logout " -#define LOGIN_SYNTAX "Existing Profile:\ndl_login profile=\nDynamic Profile:\ndl_login var1=val1;var2=val2;varN=valN\n" -#define DEBUG_SYNTAX "dl_debug [true|false]" -#define DINGALING_SYNTAX "dingaling [status|reload]" - - SWITCH_ADD_API(api_interface, "dl_debug", "DingaLing Debug", dl_debug, DEBUG_SYNTAX); - SWITCH_ADD_API(api_interface, "dl_pres", "DingaLing Presence", dl_pres, PRES_SYNTAX); - SWITCH_ADD_API(api_interface, "dl_logout", "DingaLing Logout", dl_logout, LOGOUT_SYNTAX); - SWITCH_ADD_API(api_interface, "dl_login", "DingaLing Login", dl_login, LOGIN_SYNTAX); - SWITCH_ADD_API(api_interface, "dingaling", "DingaLing Menu", dingaling, DINGALING_SYNTAX); - SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send); - - switch_console_set_complete("add dl_debug ::[true:false"); - switch_console_set_complete("add dl_pres ::dingaling::list_profiles"); - switch_console_set_complete("add dl_logout ::dingaling::list_profiles"); - switch_console_set_complete("add dl_login ::dingaling::list_profiles"); - switch_console_set_complete("add dl_login login="); - switch_console_set_complete("add dingaling status"); - switch_console_set_complete("add dingaling reload"); - switch_console_add_complete_func("::dingaling::list_profiles", list_profiles); - - /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; -} - -static ldl_status handle_loop(ldl_handle_t *handle) -{ - if (!globals.running) { - return LDL_STATUS_FALSE; - } - return LDL_STATUS_SUCCESS; -} - -static switch_status_t init_profile(mdl_profile_t *profile, uint8_t login) -{ - ldl_handle_t *handle; - - if (!profile) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid Profile\n"); - return SWITCH_STATUS_FALSE; - } - - if (!(profile->login && profile->password && profile->dialplan && profile->message && profile->ip && profile->name && profile->exten)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Invalid Profile\n" "login[%s]\n" "pass[%s]\n" "dialplan[%s]\n" - "message[%s]\n" "rtp-ip[%s]\n" "name[%s]\n" "exten[%s]\n", - switch_str_nil(profile->login), - switch_str_nil(profile->password), - switch_str_nil(profile->dialplan), - switch_str_nil(profile->message), switch_str_nil(profile->ip), switch_str_nil(profile->name), switch_str_nil(profile->exten)); - - return SWITCH_STATUS_FALSE; - } - - if (switch_test_flag(profile, TFLAG_TIMER) && !profile->timer_name) { - profile->timer_name = switch_core_strdup(module_pool, "soft"); - } - - if (!login) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created Profile for %s@%s\n", profile->login, profile->dialplan); - switch_core_hash_insert(globals.profile_hash, profile->name, profile); - return SWITCH_STATUS_SUCCESS; - } - - if (ldl_handle_init(&handle, - profile->login, - profile->password, - profile->server, - profile->user_flags, profile->message, profile->priority, handle_loop, handle_signalling, handle_response, profile) == LDL_STATUS_SUCCESS) { - profile->purge = SWITCH_FALSE; - switch_thread_rwlock_create(&profile->rwlock, module_pool); - - profile->handle = handle; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Started Thread for %s@%s\n", profile->login, profile->dialplan); - switch_core_hash_insert(globals.profile_hash, profile->name, profile); - handle_thread_launch(handle); - } - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dingaling_shutdown) -{ - sign_off(); - - if (globals.running) { - int x = 0; - globals.running = 0; - ldl_global_terminate(); - while (globals.handles > 0) { - switch_yield(100000); - x++; - if (x > 100) { - break; - } - } - - if (globals.init) { - ldl_global_destroy(); - } - } - - switch_event_free_subclass(DL_EVENT_LOGIN_SUCCESS); - switch_event_free_subclass(DL_EVENT_LOGIN_FAILURE); - switch_event_free_subclass(DL_EVENT_CONNECTED); - switch_event_unbind(&globals.in_node); - switch_event_unbind(&globals.probe_node); - switch_event_unbind(&globals.out_node); - switch_event_unbind(&globals.roster_node); - switch_event_unbind_callback(ipchanged_event_handler); - - - switch_core_hash_destroy(&globals.profile_hash); - - switch_safe_free(globals.dialplan); - switch_safe_free(globals.codec_string); - switch_safe_free(globals.codec_rates_string); - - return SWITCH_STATUS_SUCCESS; -} - - -static void set_profile_val(mdl_profile_t *profile, char *var, char *val) -{ - if (!var) - return; - - if (!strcasecmp(var, "login")) { - profile->login = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "password")) { - profile->password = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "avatar")) { - profile->avatar = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) { - profile->odbc_dsn = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) { - switch_set_flag(profile, TFLAG_TIMER); - } else if (!strcasecmp(var, "dialplan") && !zstr(val)) { - profile->dialplan = switch_core_strdup(module_pool, val); -#ifdef AUTO_REPLY // gotta fix looping on this - } else if (!strcasecmp(var, "auto-reply")) { - profile->auto_reply = switch_core_strdup(module_pool, val); -#endif - } else if (!strcasecmp(var, "name") && !zstr(val)) { - profile->name = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "message") && !zstr(val)) { - profile->message = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "priority") && !zstr(val)) { - profile->priority = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "local-network-acl") && !zstr(val)) { - profile->local_network = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "rtp-ip")) { - profile->ip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip); - } else if (!strcasecmp(var, "ext-rtp-ip")) { - char *ip = globals.guess_ip; - if (val && !strcasecmp(val, "auto-nat")) { - ip = globals.auto_nat ? switch_core_get_variable_pdup("nat_public_addr", module_pool) : globals.guess_ip; - } else if (val && !strcasecmp(val, "auto")) { - globals.auto_nat = 0; - ip = globals.guess_ip; - } else { - globals.auto_nat = 0; - ip = zstr(val) ? globals.guess_ip : val; - } - if (ip) { - profile->extip = switch_core_strdup(module_pool, ip); - } - } else if (!strcasecmp(var, "server") && !zstr(val)) { - profile->server = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "rtp-timer-name") && !zstr(val)) { - profile->timer_name = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "lanaddr") && !zstr(val)) { - profile->lanaddr = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "candidate-acl")) { - if (profile->acl_count < MAX_ACL) { - profile->acl[profile->acl_count++] = strdup(val); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max acl records of %d reached\n", MAX_ACL); - } - } else if (!strcasecmp(var, "tls")) { - if (switch_true(val)) { - profile->user_flags |= LDL_FLAG_TLS; - } - } else if (!strcasecmp(var, "sasl")) { - if (val && !strcasecmp(val, "plain")) { - profile->user_flags |= LDL_FLAG_SASL_PLAIN; - } else if (val && !strcasecmp(val, "md5")) { - profile->user_flags |= LDL_FLAG_SASL_MD5; - } - } else if (!strcasecmp(var, "use-jingle") && switch_true(val)) { - profile->user_flags |= LDL_FLAG_JINGLE; - } else if (!strcasecmp(var, "exten") && !zstr(val)) { - profile->exten = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "context") && !zstr(val)) { - profile->context = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "auto-login") && !zstr(val)) { - if (switch_true(val)) { - switch_set_flag(profile, TFLAG_AUTO); - } - } else if (!strcasecmp(var, "vad") && val) { - if (!strcasecmp(val, "in")) { - switch_set_flag(profile, TFLAG_VAD_IN); - } else if (!strcasecmp(val, "out")) { - switch_set_flag(profile, TFLAG_VAD_OUT); - } else if (!strcasecmp(val, "both")) { - switch_set_flag(profile, TFLAG_VAD_IN); - switch_set_flag(profile, TFLAG_VAD_OUT); - } else if (!strcasecmp(val, "none")) { - switch_set_flag(profile, TFLAG_VAD_NONE); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val); - } - } -} - -SWITCH_STANDARD_API(dl_debug) -{ - int on, cur; - - if (session) { - return SWITCH_STATUS_FALSE; - } - - if (cmd) { - on = switch_true(cmd); - cur = ldl_global_debug(on); - } else { - cur = ldl_global_debug(-1); - } - - - stream->write_function(stream, "DEBUG IS NOW %s\n", cur ? "ON" : "OFF"); - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_STANDARD_API(dl_pres) -{ - mdl_profile_t *profile; - - if (session) { - return SWITCH_STATUS_FALSE; - } - - if (!cmd) { - stream->write_function(stream, "USAGE: %s\n", PRES_SYNTAX); - return SWITCH_STATUS_SUCCESS; - } - - if ((profile = switch_core_hash_find(globals.profile_hash, cmd))) { - if (profile->user_flags & LDL_FLAG_COMPONENT) { - sign_on(profile); - stream->write_function(stream, "OK\n"); - } else { - stream->write_function(stream, "NO PROFILE %s NOT A COMPONENT\n", cmd); - } - } else { - stream->write_function(stream, "NO SUCH PROFILE %s\n", cmd); - } - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_STANDARD_API(dl_logout) -{ - mdl_profile_t *profile; - - if (session) { - return SWITCH_STATUS_FALSE; - } - - if (!cmd) { - stream->write_function(stream, "USAGE: %s\n", LOGOUT_SYNTAX); - return SWITCH_STATUS_SUCCESS; - } - - if (((profile = switch_core_hash_find(globals.profile_hash, cmd))) && profile->handle) { - ldl_handle_stop(profile->handle); - stream->write_function(stream, "OK\n"); - } else if (profile) { - stream->write_function(stream, "NOT LOGGED IN\n"); - } else { - stream->write_function(stream, "NO SUCH PROFILE %s\n", cmd); - } - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_STANDARD_API(dingaling) -{ - char *argv[10] = { 0 }; - void *val; - char *myarg = NULL; - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - switch_status_t status = SWITCH_STATUS_SUCCESS; - - if (session) - return status; - - if (zstr(cmd) || !(myarg = strdup(cmd))) { - stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX); - return SWITCH_STATUS_FALSE; - } - - if (switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) != 1) { - stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX); - goto done; - } - - if (argv[0] && !strncasecmp(argv[0], "status", 6)) { - stream->write_function(stream, "--DingaLing status--\n"); - stream->write_function(stream, "login | connected\n"); - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - stream->write_function(stream, "%s | ", profile->login); - if (profile->handle && ldl_handle_authorized(profile->handle)) { - stream->write_function(stream, "AUTHORIZED"); - } else if (profile->handle && ldl_handle_connected(profile->handle)) { - stream->write_function(stream, "CONNECTED"); - } else { - stream->write_function(stream, "UNCONNECTED"); - } - stream->write_function(stream, "\n"); - } - } else if (argv[0] && !strncasecmp(argv[0], "reload", 6)) { - soft_reload(); - stream->write_function(stream, "OK\n"); - } else { - stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX); - } - - done: - switch_safe_free(myarg); - return status; -} - -SWITCH_STANDARD_API(dl_login) -{ - char *argv[20] = { 0 }; - int argc = 0; - char *var, *val, *myarg = NULL; - mdl_profile_t *profile = NULL; - int x; - switch_status_t status = SWITCH_STATUS_SUCCESS; - - if (session) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - if (zstr(cmd)) { - stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX); - status = SWITCH_STATUS_SUCCESS; - goto done; - } - - myarg = strdup(cmd); - - argc = switch_separate_string(myarg, ';', argv, (sizeof(argv) / sizeof(argv[0]))); - - if (argv[0] && !strncasecmp(argv[0], "profile=", 8)) { - char *profile_name = argv[0] + 8; - profile = switch_core_hash_find(globals.profile_hash, profile_name); - - if (profile) { - if (switch_test_flag(profile, TFLAG_IO)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile already exists.\n"); - stream->write_function(stream, "Profile already exists\n"); - status = SWITCH_STATUS_SUCCESS; - goto done; - } - - } - } else { - profile = switch_core_alloc(module_pool, sizeof(*profile)); - - for (x = 0; x < argc; x++) { - var = argv[x]; - if (var && (val = strchr(var, '='))) { - *val++ = '\0'; - set_profile_val(profile, var, val); - } - } - } - - - if (profile && init_profile(profile, 1) == SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "OK\n"); - } else { - stream->write_function(stream, "FAIL\n"); - } - done: - switch_safe_free(myarg); - - return status; -} - - -static switch_bool_t match_profile(mdl_profile_t *profile, mdl_profile_t *new_profile) -{ - if (profile == new_profile) { - return SWITCH_TRUE; - } - - if (((!new_profile->name && !profile->name) || - (new_profile->name && profile->name && !strcasecmp(new_profile->name, profile->name))) && - ((!new_profile->login && !profile->login) || - (new_profile->login && profile->login && !strcasecmp(new_profile->login, profile->login))) && - ((!new_profile->password && !profile->password) || - (new_profile->password && profile->password && !strcasecmp(new_profile->password, profile->password))) && - ((!new_profile->message && !profile->message) || - (new_profile->message && profile->message && !strcasecmp(new_profile->message, profile->message))) && - ((!new_profile->priority && !profile->priority) || - (new_profile->priority && profile->priority && !strcasecmp(new_profile->priority, profile->priority))) && - ((!new_profile->avatar && !profile->avatar) || (new_profile->avatar && profile->avatar && !strcasecmp(new_profile->avatar, profile->avatar))) && -#ifdef AUTO_REPLY - ((!new_profile->auto_reply && !profile->auto_reply) || - (new_profile->auto_reply && profile->auto_reply && !strcasecmp(new_profile->auto_reply, profile->auto_reply))) && -#endif - ((!new_profile->dialplan && !profile->dialplan) || - (new_profile->dialplan && profile->dialplan && !strcasecmp(new_profile->dialplan, profile->dialplan))) && - ((!new_profile->local_network && !profile->local_network) || - (new_profile->local_network && profile->local_network && !strcasecmp(new_profile->local_network, profile->local_network))) && - ((!new_profile->ip && !profile->ip) || - (new_profile->ip && profile->ip && !strcasecmp(new_profile->ip, profile->ip))) && - ((!new_profile->extip && !profile->extip) || - (new_profile->extip && profile->extip && !strcasecmp(new_profile->extip, profile->extip))) && - ((!new_profile->server && !profile->server) || - (new_profile->server && profile->server && !strcasecmp(new_profile->server, profile->server))) && - ((!new_profile->timer_name && !profile->timer_name) || - (new_profile->timer_name && profile->timer_name && !strcasecmp(new_profile->timer_name, profile->timer_name))) && - ((!new_profile->lanaddr && !profile->lanaddr) || - (new_profile->lanaddr && profile->lanaddr && !strcasecmp(new_profile->lanaddr, profile->lanaddr))) && - ((!new_profile->exten && !profile->exten) || - (new_profile->exten && profile->exten && !strcasecmp(new_profile->exten, profile->exten))) && - ((!new_profile->context && !profile->context) || - (new_profile->context && profile->context && !strcasecmp(new_profile->context, profile->context))) && - (new_profile->user_flags == profile->user_flags) && (new_profile->acl_count == profile->acl_count) - ) { - uint32_t i; - - if (!(((!new_profile->odbc_dsn && !profile->odbc_dsn) || - (new_profile->odbc_dsn && profile->odbc_dsn && !strcasecmp(new_profile->odbc_dsn, profile->odbc_dsn))) - )) { - return SWITCH_FALSE; - } - - - for (i = 0; i < new_profile->acl_count; i++) { - if (strcasecmp(new_profile->acl[i], profile->acl[i]) != 0) { - return SWITCH_FALSE; - } - } - } - - return SWITCH_TRUE; -} - -static switch_status_t destroy_profile(char *name) -{ - mdl_profile_t *profile = NULL; - - if ((profile = switch_core_hash_find(globals.profile_hash, name))) { - if (profile->user_flags & LDL_FLAG_COMPONENT) { - switch_mutex_destroy(profile->mutex); - } - - if (switch_thread_rwlock_trywrlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s is busy\n", profile->name); - profile->purge = SWITCH_TRUE; - if (profile->handle) { - ldl_handle_stop(profile->handle); - } - } else { - switch_thread_rwlock_unlock(profile->rwlock); - profile->purge = SWITCH_TRUE; - - if (profile->handle) { - ldl_handle_stop(profile->handle); - } - - if (switch_core_hash_delete(globals.profile_hash, profile->name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name); - } - } - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t soft_reload(void) -{ - char *cf = "dingaling.conf"; - mdl_profile_t *profile = NULL, *old_profile = NULL; - switch_xml_t cfg, xml, /*settings, */ param, xmlint; - - void *data = NULL; - switch_hash_t *name_hash; - switch_hash_index_t *hi; - switch_core_hash_init(&name_hash); - - if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf); - return SWITCH_STATUS_TERM; - } - - if (!(xmlint = switch_xml_child(cfg, "profile"))) { - if ((xmlint = switch_xml_child(cfg, "interface"))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "!!!!!!! DEPRICATION WARNING 'interface' is now 'profile' !!!!!!!\n"); - } - } - - for (; xmlint; xmlint = xmlint->next) { - char *type = (char *) switch_xml_attr_soft(xmlint, "type"); - for (param = switch_xml_child(xmlint, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (!profile) { - profile = switch_core_alloc(module_pool, sizeof(*profile)); - } - - set_profile_val(profile, var, val); - } - - if (profile && type && !strcasecmp(type, "component")) { - char dbname[256]; - switch_cache_db_handle_t *dbh = NULL; - - if (!profile->login && profile->name) { - profile->login = switch_core_strdup(module_pool, profile->name); - } - - switch_set_flag(profile, TFLAG_AUTO); - profile->message = ""; - profile->priority = ""; - profile->user_flags |= LDL_FLAG_COMPONENT; - switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, module_pool); - switch_snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name); - profile->dbname = switch_core_strdup(module_pool, dbname); - - if ((dbh = mdl_get_db_handle(profile))) { - switch_cache_db_test_reactive(dbh, "select * from jabber_subscriptions", NULL, sub_sql); - switch_cache_db_release_db_handle(&dbh); - } - } - - if (profile) { - switch_core_hash_insert(name_hash, profile->name, profile->login); - - if ((old_profile = switch_core_hash_find(globals.profile_hash, profile->name))) { - if (match_profile(old_profile, profile)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found pre-existing profile %s [%s]\n", profile->name, profile->login); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Overwriting pre-existing profile %s [%s]\n", profile->name, profile->login); - destroy_profile(old_profile->name); - init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0); - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found new profile %s [%s]\n", profile->name, profile->login); - init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0); - } - - profile = NULL; - } - } - - switch_xml_free(xml); - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &data); - profile = (mdl_profile_t *) data; - - if (switch_core_hash_find(name_hash, profile->name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New profile %s [%s] activated\n", profile->name, profile->login); - } else { - switch_core_hash_insert(name_hash, profile->name, profile->name); - } - } - - for (hi = switch_core_hash_first(name_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &data); - - if ((profile = switch_core_hash_find(globals.profile_hash, (char *) data))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleting unused profile %s [%s]\n", profile->name, profile->login); - destroy_profile(profile->name); - } - } - - switch_core_hash_destroy(&name_hash); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t load_config(void) -{ - char *cf = "dingaling.conf"; - mdl_profile_t *profile = NULL; - switch_xml_t cfg, xml, settings, param, xmlint; - - memset(&globals, 0, sizeof(globals)); - globals.running = 1; - globals.auto_nat = (switch_nat_get_type() ? 1 : 0); - - switch_find_local_ip(globals.guess_ip, sizeof(globals.guess_ip), NULL, AF_INET); - - switch_core_hash_init(&globals.profile_hash); - - if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf); - return SWITCH_STATUS_TERM; - } - - if ((settings = switch_xml_child(cfg, "settings"))) { - for (param = switch_xml_child(settings, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (!strcasecmp(var, "debug")) { - globals.debug = atoi(val); - } else if (!strcasecmp(var, "codec-prefs")) { - set_global_codec_string(val); - globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS); - } else if (!strcasecmp(var, "codec-rates")) { - set_global_codec_rates_string(val); - globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS); - } - } - } - - if (!(xmlint = switch_xml_child(cfg, "profile"))) { - if ((xmlint = switch_xml_child(cfg, "interface"))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "!!!!!!! DEPRICATION WARNING 'interface' is now 'profile' !!!!!!!\n"); - } - } - - for (; xmlint; xmlint = xmlint->next) { - char *type = (char *) switch_xml_attr_soft(xmlint, "type"); - for (param = switch_xml_child(xmlint, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (!globals.init) { - ldl_global_init(globals.debug); - ldl_global_set_logger(dl_logger); - globals.init = 1; - } - - if (!profile) { - profile = switch_core_alloc(module_pool, sizeof(*profile)); - } - - set_profile_val(profile, var, val); - } - - - if (profile && type && !strcasecmp(type, "component")) { - char dbname[256]; - switch_cache_db_handle_t *dbh = NULL; - - if (!profile->login && profile->name) { - profile->login = switch_core_strdup(module_pool, profile->name); - } - - switch_set_flag(profile, TFLAG_AUTO); - profile->message = ""; - profile->priority = ""; - profile->user_flags |= LDL_FLAG_COMPONENT; - switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, module_pool); - switch_snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name); - profile->dbname = switch_core_strdup(module_pool, dbname); - - - if ((dbh = mdl_get_db_handle(profile))) { - switch_cache_db_test_reactive(dbh, "select * from jabber_subscriptions", NULL, sub_sql); - switch_cache_db_release_db_handle(&dbh); - } - } - - if (profile) { - init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0); - profile = NULL; - } - } - - if (profile) { - init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0); - profile = NULL; - } - - if (!globals.dialplan) { - set_global_dialplan("default"); - } - - if (!globals.init) { - ldl_global_init(globals.debug); - ldl_global_set_logger(dl_logger); - globals.init = 1; - } - - - switch_xml_free(xml); - - return SWITCH_STATUS_SUCCESS; -} - - -static void do_vcard(ldl_handle_t *handle, char *to, char *from, char *id) -{ - switch_event_t *params = NULL; - char *real_to, *to_user, *xmlstr = NULL, *to_host = NULL; - switch_xml_t domain, xml = NULL, user, vcard; - int sent = 0; - - if (!strncasecmp(to, "user+", 5)) { - real_to = to + 5; - } else { - real_to = to; - } - - - if ((to_user = strdup(real_to))) { - if ((to_host = strchr(to_user, '@'))) { - *to_host++ = '\0'; - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); - goto end; - } - - if (!to_host) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Missing Host!\n"); - goto end; - } - - switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS); - switch_assert(params); - switch_event_add_header(params, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "object", "vcard"); - - if (switch_xml_locate("directory", "domain", "name", to_host, &xml, &domain, params, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) { - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "can't find domain for [%s@%s]\n", to_user, to_host); - goto end; - } - - if (!(user = switch_xml_find_child(domain, "user", "id", to_user))) { - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", to_user, to_host); - goto end; - } - - if (!(vcard = switch_xml_child(user, "vcard"))) { - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find tag for user [%s@%s]\n", to_user, to_host); - goto end; - } - - switch_xml_set_attr(vcard, "xmlns", "vcard-tmp"); - - if ((xmlstr = switch_xml_toxml(vcard, SWITCH_FALSE))) { - ldl_handle_send_vcard(handle, to, from, id, xmlstr); - sent = 1; - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); - } - - end: - - switch_event_destroy(¶ms); - - if (!sent) { - ldl_handle_send_vcard(handle, to, from, id, NULL); - } - - if (xml) - switch_xml_free(xml); - switch_safe_free(to_user); - switch_safe_free(params); - switch_safe_free(xmlstr); -} - -static ldl_status parse_candidates(ldl_session_t *dlsession, switch_core_session_t *session, ldl_transport_type_t ttype, const char *subject) -{ - - ldl_candidate_t *candidates; - unsigned int len = 0; - unsigned int x, choice = 0, ok = 0; - uint8_t lanaddr = 0; - struct private_object *tech_pvt = NULL; - ldl_status status = LDL_STATUS_SUCCESS; - - if (!(tech_pvt = switch_core_session_get_private(session))) { - return LDL_STATUS_FALSE; - } - - if (ldl_session_get_candidates(dlsession, ttype, &candidates, &len) != LDL_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Candidate Error!\n"); - switch_set_flag(tech_pvt, TFLAG_BYE); - switch_clear_flag(tech_pvt, TFLAG_IO); - status = LDL_STATUS_FALSE; - goto end; - } - - - tech_pvt->transports[ttype].total = len; - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%u %s candidates\n", len, ldl_transport_type_str(ttype)); - - if (tech_pvt->profile->acl_count) { - for (x = 0; x < len; x++) { - uint32_t y = 0; - - if (strcasecmp(candidates[x].protocol, "udp")) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d has an unsupported protocol!\n", - candidates[x].address, candidates[x].port); - continue; - } - - for (y = 0; y < tech_pvt->profile->acl_count; y++) { - - if (switch_check_network_list_ip(candidates[x].address, tech_pvt->profile->acl[y])) { - choice = x; - ok = 1; - } - - if (ok) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n", - candidates[x].address, candidates[x].port, tech_pvt->profile->acl[y]); - goto end_candidates; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n", - candidates[x].address, candidates[x].port, tech_pvt->profile->acl[y]); - } - } - } - } else { - for (x = 0; x < len; x++) { - - - if (tech_pvt->profile->lanaddr) { - lanaddr = strncasecmp(candidates[x].address, tech_pvt->profile->lanaddr, strlen(tech_pvt->profile->lanaddr)) ? 0 : 1; - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s candidates %s:%d\n", - ldl_transport_type_str(ttype), candidates[x].address, - candidates[x].port); - - - // 192.0.0.0 - 192.0.127.255 is marked as reserved, should we filter all of them? - if (!strcasecmp(candidates[x].protocol, "udp") && - (!strcasecmp(candidates[x].type, "local") || !strcasecmp(candidates[x].type, "stun") || !strcasecmp(candidates[x].type, "relay")) && - ((tech_pvt->profile->lanaddr && - lanaddr) || (strncasecmp(candidates[x].address, "10.", 3) && - strncasecmp(candidates[x].address, "192.168.", 8) && - strncasecmp(candidates[x].address, "127.", 4) && - strncasecmp(candidates[x].address, "255.", 4) && - strncasecmp(candidates[x].address, "0.", 2) && - strncasecmp(candidates[x].address, "1.", 2) && - strncasecmp(candidates[x].address, "2.", 2) && - strncasecmp(candidates[x].address, "172.16.", 7) && - strncasecmp(candidates[x].address, "172.17.", 7) && - strncasecmp(candidates[x].address, "172.18.", 7) && - strncasecmp(candidates[x].address, "172.19.", 7) && - strncasecmp(candidates[x].address, "172.2", 5) && - strncasecmp(candidates[x].address, "172.30.", 7) && - strncasecmp(candidates[x].address, "172.31.", 7) && - strncasecmp(candidates[x].address, "192.0.2.", 8) && strncasecmp(candidates[x].address, "169.254.", 8) - ))) { - choice = x; - ok = 1; - } - } - } - - - end_candidates: - - if (ok) { - ldl_payload_t payloads[5]; - char *key; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, - "Acceptable %s Candidate %s:%d\n", ldl_transport_type_str(ttype), candidates[choice].address, candidates[choice].port); - - - if (tech_pvt->transports[ttype].accepted) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already Accepted [%s:%d]\n", - tech_pvt->transports[ttype].remote_ip, tech_pvt->transports[ttype].remote_port); - //goto end; - } - - - if (tech_pvt->transports[ttype].remote_ip) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already picked an IP [%s]\n", tech_pvt->transports[ttype].remote_ip); - //goto end; - } - - - memset(payloads, 0, sizeof(payloads)); - - tech_pvt->transports[ttype].accepted++; - - if (ttype == LDL_TPORT_VIDEO_RTP) { - if ((key = ldl_session_get_value(dlsession, "video:crypto:1"))) { - mdl_add_crypto(tech_pvt, ttype, key, SWITCH_RTP_CRYPTO_RECV); - } else { - tech_pvt->transports[ttype].crypto_type = 0; - } - } else if (ttype == LDL_TPORT_RTP) { - if ((key = ldl_session_get_value(dlsession, "audio:crypto:1"))) { - mdl_add_crypto(tech_pvt, ttype, key, SWITCH_RTP_CRYPTO_RECV); - } else { - tech_pvt->transports[ttype].crypto_type = 0; - } - } - - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); - //ldl_session_accept_candidate(dlsession, &candidates[choice]); - } - - if (!strcasecmp(subject, "candidates")) { - //switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); - switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); - } - - if (lanaddr) { - switch_set_flag_locked(tech_pvt, TFLAG_LANADDR); - } - - if (!get_codecs(tech_pvt)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto end; - } - - - tech_pvt->transports[ttype].remote_ip = switch_core_session_strdup(session, candidates[choice].address); - ldl_session_set_ip(dlsession, tech_pvt->transports[ttype].remote_ip); - tech_pvt->transports[ttype].remote_port = candidates[choice].port; - tech_pvt->transports[ttype].remote_user = switch_core_session_strdup(session, candidates[choice].username); - tech_pvt->transports[ttype].remote_pass = switch_core_session_strdup(session, candidates[choice].password); - - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (!do_candidates(tech_pvt, 0)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - - goto end; - } - } - - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].accepted && - tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted) { - activate_video_rtp(tech_pvt); - } - - - if (tech_pvt->transports[LDL_TPORT_RTP].accepted && - tech_pvt->transports[LDL_TPORT_RTCP].accepted) { - activate_audio_rtp(tech_pvt); - } - - - tech_pvt->transports[ttype].restart_rtp++; - } - - - status = LDL_STATUS_SUCCESS; - } - - end: - - return status; - -} - - -static ldl_status parse_payloads_type(ldl_session_t *dlsession, switch_core_session_t *session, - ldl_transport_type_t ttype, ldl_payload_t *payloads, unsigned int len) -{ - struct private_object *tech_pvt = NULL; - ldl_status status = LDL_STATUS_SUCCESS; - unsigned int x, y; - int match = 0; - - tech_pvt = switch_core_session_get_private(session); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%u payloads\n", len); - for (x = 0; x < len; x++) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name, - payloads[x].id); - for (y = 0; y < tech_pvt->num_codecs; y++) { - char *name = tech_pvt->codecs[y]->iananame; - - if ((ttype == LDL_TPORT_VIDEO_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_VIDEO) || - (ttype == LDL_TPORT_RTP && tech_pvt->codecs[y]->codec_type != SWITCH_CODEC_TYPE_AUDIO)) { - continue; - } - - if (!strncasecmp(name, "ilbc", 4)) { - name = "ilbc"; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "compare %s %d/%d to %s %d/%d\n", - payloads[x].name, payloads[x].id, payloads[x].rate, - name, tech_pvt->codecs[y]->ianacode, tech_pvt->codecs[y]->samples_per_second); - - if (tech_pvt->codecs[y]->ianacode > 95) { - match = strcasecmp(name, payloads[x].name) ? 0 : 1; - } else { - match = (payloads[x].id == tech_pvt->codecs[y]->ianacode) ? 1 : 0; - } - - if (match && payloads[x].rate == tech_pvt->codecs[y]->samples_per_second) { - tech_pvt->transports[ttype].codec_index = y; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Choosing %s Payload index %u %s %u\n", - ldl_transport_type_str(ttype), - y, - payloads[x].name, payloads[x].id); - tech_pvt->transports[ttype].codec_name = tech_pvt->codecs[y]->iananame; - tech_pvt->transports[ttype].codec_num = tech_pvt->codecs[y]->ianacode; - tech_pvt->transports[ttype].r_codec_num = (switch_payload_t) (payloads[x].id); - tech_pvt->transports[ttype].codec_rate = payloads[x].rate; - tech_pvt->transports[ttype].ptime = payloads[x].ptime; - tech_pvt->transports[ttype].payload_count++; - - if (ttype == LDL_TPORT_VIDEO_RTP) { - tech_pvt->transports[ttype].vid_width = payloads[x].width; - tech_pvt->transports[ttype].vid_height = payloads[x].height; - tech_pvt->transports[ttype].vid_rate = payloads[x].framerate; - } - - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - - - if (!do_describe(tech_pvt, 0)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - } - status = LDL_STATUS_SUCCESS; - goto done; - } - } - } - - done: - - return status; - -} - -static ldl_status parse_payloads(ldl_session_t *dlsession, switch_core_session_t *session, ldl_payload_t *payloads, unsigned int len) -{ - int match = 0; - struct private_object *tech_pvt = NULL; - ldl_status status; - - tech_pvt = switch_core_session_get_private(session); - - - if ((status = parse_payloads_type(dlsession, session, LDL_TPORT_RTP, payloads, len)) == LDL_STATUS_SUCCESS) { - match++; - } - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready) { - if ((status = parse_payloads_type(dlsession, session, LDL_TPORT_VIDEO_RTP, payloads, len)) == LDL_STATUS_SUCCESS) { - match++; - } - } - - if (!match && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (!do_describe(tech_pvt, 0)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - } - } - - - return status; - -} - - -static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject, - char *msg) -{ - mdl_profile_t *profile = NULL; - switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; - struct private_object *tech_pvt = NULL; - switch_event_t *event; - ldl_status status = LDL_STATUS_SUCCESS; - char *sql; - - switch_assert(handle != NULL); - - if (!(profile = ldl_handle_get_private(handle))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "ERROR NO PROFILE!\n"); - status = LDL_STATUS_FALSE; - goto done; - } - - if (!dlsession) { - if (profile->user_flags & LDL_FLAG_COMPONENT) { - switch (dl_signal) { - case LDL_SIGNAL_VCARD: - do_vcard(handle, to, from, subject); - break; - case LDL_SIGNAL_UNSUBSCRIBE: - - if ((sql = switch_mprintf("delete from jabber_subscriptions where sub_from='%q' and sub_to='%q';", from, to))) { - mdl_execute_sql(profile, sql, profile->mutex); - free(sql); - } - - break; - - case LDL_SIGNAL_SUBSCRIBE: - if (profile->user_flags & LDL_FLAG_COMPONENT && ldl_jid_domcmp(from, to)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Attempt to add presence from/to our own domain [%s][%s]\n", - from, to); - } else { - switch_mutex_lock(profile->mutex); - if ((sql = switch_mprintf("delete from jabber_subscriptions where sub_from='%q' and sub_to='%q'", from, to))) { - mdl_execute_sql(profile, sql, NULL); - free(sql); - } - if ((sql = switch_mprintf("insert into jabber_subscriptions values('%q','%q','%q','%q');\n", - switch_str_nil(from), switch_str_nil(to), switch_str_nil(msg), switch_str_nil(subject)))) { - mdl_execute_sql(profile, sql, NULL); - free(sql); - } - switch_mutex_unlock(profile->mutex); - if (is_special(to)) { - ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call", profile->avatar); - } else { - ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Authenticated.\nCome to ClueCon!\nhttp://www.cluecon.com", - profile->avatar); - } -#if 0 - if (is_special(to)) { - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", to); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Click To Call"); - switch_event_fire(&event); - } - } -#endif - } - break; - case LDL_SIGNAL_ROSTER: - if (switch_event_create(&event, SWITCH_EVENT_ROSTER) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_fire(&event); - } - break; - case LDL_SIGNAL_PRESENCE_PROBE: - if (is_special(to)) { - ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call", profile->avatar); - } else { - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to); - switch_event_fire(&event); - } - } - break; - case LDL_SIGNAL_PRESENCE_IN: - - if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'", - switch_str_nil(msg), switch_str_nil(subject), switch_str_nil(from)))) { - mdl_execute_sql(profile, sql, profile->mutex); - free(sql); - } - - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", msg); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", subject); - switch_event_fire(&event); - } - - - if (is_special(to)) { - ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call", profile->avatar); - } -#if 0 - if (is_special(to)) { - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", to); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Click To Call"); - switch_event_fire(&event); - } - } -#endif - break; - - case LDL_SIGNAL_PRESENCE_OUT: - - if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'", - switch_str_nil(msg), switch_str_nil(subject), switch_str_nil(from)))) { - mdl_execute_sql(profile, sql, profile->mutex); - free(sql); - } - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_fire(&event); - } - break; - default: - break; - } - } - - switch (dl_signal) { - case LDL_SIGNAL_MSG:{ - char *proto = MDL_CHAT_PROTO; - char *pproto = NULL, *ffrom = NULL; - char *hint; - char *from_user, *from_host; -#ifdef AUTO_REPLY - if (profile->auto_reply) { - ldl_handle_send_msg(handle, - (profile->user_flags & LDL_FLAG_COMPONENT) ? to : ldl_handle_get_login(profile->handle), from, "", - switch_str_nil(profile->auto_reply)); - } -#endif - - if (strchr(to, '+')) { - pproto = strdup(to); - if ((to = strchr(pproto, '+'))) { - *to++ = '\0'; - } - proto = pproto; - } - - hint = from; - - if (strchr(from, '/') && (ffrom = strdup(from))) { - char *p; - if ((p = strchr(ffrom, '/'))) { - *p = '\0'; - } - from = ffrom; - } - - from_user = strdup(from); - if ((from_host = strchr(from_user, '@'))) { - *from_host++ = '\0'; - } - - - if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", from_user); - if (from_host) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", from_host); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", subject); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "text/plain"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", hint); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", hint); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "ldl_profile", profile->name); - - if (msg) { - switch_event_add_body(event, "%s", msg); - } - } else { - abort(); - } - - switch_safe_free(from_user); - - if (!zstr(msg)) { - if (strcasecmp(proto, MDL_CHAT_PROTO)) { /* yes no ! on purpose */ - switch_core_chat_send(proto, event); - } - - switch_core_chat_send("GLOBAL", event); - } - - switch_event_destroy(&event); - - switch_safe_free(pproto); - switch_safe_free(ffrom); - } - break; - case LDL_SIGNAL_LOGIN_SUCCESS: - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_SUCCESS) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", ldl_handle_get_login(profile->handle)); - switch_event_fire(&event); - } - if (profile->user_flags & LDL_FLAG_COMPONENT) { - sign_on(profile); - } - - break; - case LDL_SIGNAL_LOGIN_FAILURE: - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_FAILURE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", ldl_handle_get_login(profile->handle)); - switch_event_fire(&event); - } - break; - case LDL_SIGNAL_CONNECTED: - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_CONNECTED) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", ldl_handle_get_login(profile->handle)); - switch_event_fire(&event); - } - break; - default: - break; - - } - status = LDL_STATUS_SUCCESS; - goto done; - } - - - if ((session = ldl_session_get_private(dlsession))) { - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - channel = switch_core_session_get_channel(session); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "using Existing session for %s\n", ldl_session_get_id(dlsession)); - - if (switch_channel_down(channel)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Call %s is already over\n", switch_channel_get_name(channel)); - status = LDL_STATUS_FALSE; - goto done; - } - - } else { - if (dl_signal != LDL_SIGNAL_INITIATE && !msg) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Session is already dead\n"); - status = LDL_STATUS_FALSE; - goto done; - } - - if (profile->purge) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' is marked for deletion, disallowing incoming call\n", profile->name); - status = LDL_STATUS_FALSE; - goto done; - } - - if (switch_thread_rwlock_tryrdlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't do read lock on profile '%s'\n", profile->name); - status = LDL_STATUS_FALSE; - goto done; - } - - if ((session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) { - switch_core_session_add_stream(session, NULL); - - if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) { - char *exten; - char *context; - char *cid_name; - char *cid_num; - char *tmp, *t, *them = NULL; - - memset(tech_pvt, 0, sizeof(*tech_pvt)); - switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); - tech_pvt->flags |= globals.flags; - tech_pvt->flags |= profile->flags; - channel = switch_core_session_get_channel(session); - switch_core_session_set_private(session, tech_pvt); - tech_pvt->dlsession = dlsession; - - tech_pvt->session = session; - tech_pvt->channel = switch_core_session_get_channel(session); - tech_pvt->transports[LDL_TPORT_RTP].codec_index = -1; - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index = -1; - tech_pvt->profile = profile; - - switch_set_flag(tech_pvt, TFLAG_SECURE); - mdl_build_crypto(tech_pvt, LDL_TPORT_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); - mdl_build_crypto(tech_pvt, LDL_TPORT_VIDEO_RTP, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND); - - - if (!(tech_pvt->transports[LDL_TPORT_RTP].local_port = switch_rtp_request_port(profile->ip))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "No RTP port available!\n"); - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - tech_pvt->transports[LDL_TPORT_RTP].adv_local_port = tech_pvt->transports[LDL_TPORT_RTP].local_port; - tech_pvt->transports[LDL_TPORT_RTCP].adv_local_port = tech_pvt->transports[LDL_TPORT_RTP].local_port + 1; - - if (!(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port = switch_rtp_request_port(profile->ip))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "No RTP port available!\n"); - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - tech_pvt->transports[LDL_TPORT_VIDEO_RTP].adv_local_port = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port; - tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].adv_local_port = tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_port + 1; - - - - switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); - tech_pvt->recip = switch_core_session_strdup(session, from); - if (!(exten = ldl_session_get_value(dlsession, "dnis"))) { - exten = profile->exten; - /* if it's _auto_ set the extension to match the username portion of the called address */ - if (!strcmp(exten, "_auto_")) { - if ((t = ldl_session_get_callee(dlsession))) { - if ((them = strdup(t))) { - char *a, *b, *p; - if ((p = strchr(them, '/'))) { - *p = '\0'; - } - - if ((a = strchr(them, '+')) && (b = strrchr(them, '+')) && a != b) { - *b++ = '\0'; - switch_channel_set_variable(channel, "dl_user", them); - switch_channel_set_variable(channel, "dl_host", b); - } - exten = them; - } - } - } - } - - if (!(context = ldl_session_get_value(dlsession, "context"))) { - context = profile->context; - } - - if (!(cid_name = ldl_session_get_value(dlsession, "caller_id_name"))) { - cid_name = tech_pvt->recip; - } - - if (!(cid_num = ldl_session_get_value(dlsession, "caller_id_number"))) { - cid_num = tech_pvt->recip; - } - - - if (switch_stristr("voice.google.com", from)) { - char *id = switch_core_session_strdup(session, from); - char *p; - - if ((p = strchr(id, '@'))) { - *p++ = '\0'; - cid_name = "Google Voice"; - cid_num = id; - } - - ldl_session_set_gateway(dlsession); - - do_candidates(tech_pvt, 1); - } - - - - /* context of "_auto_" means set it to the domain */ - if (profile->context && !strcmp(profile->context, "_auto_")) { - context = profile->name; - } - - tech_pvt->them = switch_core_session_strdup(session, ldl_session_get_callee(dlsession)); - - if (tech_pvt->them && (tmp = strdup(tech_pvt->them))) { - char *p, *q; - - if ((p = strchr(tmp, '@'))) { - *p++ = '\0'; - if ((q = strchr(p, '/'))) { - *q = '\0'; - } - switch_channel_set_variable(channel, "dl_to_user", tmp); - switch_channel_set_variable(channel, "dl_to_host", p); - } - - switch_safe_free(tmp); - } - - tech_pvt->us = switch_core_session_strdup(session, ldl_session_get_caller(dlsession)); - - if (tech_pvt->us && (tmp = strdup(tech_pvt->us))) { - char *p, *q; - - if ((p = strchr(tmp, '@'))) { - *p++ = '\0'; - if ((q = strchr(p, '/'))) { - *q = '\0'; - } - switch_channel_set_variable(channel, "dl_from_user", tmp); - switch_channel_set_variable(channel, "dl_from_host", p); - } - - switch_safe_free(tmp); - } - - if (!tech_pvt->caller_profile) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, - "Creating an identity for %s %s <%s> %s\n", ldl_session_get_id(dlsession), cid_name, cid_num, exten); - - if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), - ldl_handle_get_login(profile->handle), - profile->dialplan, - cid_name, - cid_num, - ldl_session_get_ip(dlsession), - ldl_session_get_value(dlsession, "ani"), - ldl_session_get_value(dlsession, "aniii"), - ldl_session_get_value(dlsession, "rdnis"), modname, context, exten)) != 0) { - char name[128]; - switch_snprintf(name, sizeof(name), "dingaling/%s", tech_pvt->caller_profile->destination_number); - switch_channel_set_name(channel, name); - switch_channel_set_caller_profile(channel, tech_pvt->caller_profile); - } - } - - switch_safe_free(them); - - switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n"); - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating a session for %s\n", ldl_session_get_id(dlsession)); - ldl_session_set_private(dlsession, session); - - switch_channel_set_name(channel, "DingaLing/new"); - switch_channel_set_state(channel, CS_INIT); - if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error spawning thread\n"); - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - } else { - status = LDL_STATUS_FALSE; - goto done; - } - - } - - switch (dl_signal) { - case LDL_SIGNAL_MSG: - if (msg) { - if (*msg == '+') { - char *p = msg + 1; - switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) }; - while (p && *p) { - dtmf.digit = *p; - switch_channel_queue_dtmf(channel, &dtmf); - p++; - } - switch_set_flag_locked(tech_pvt, TFLAG_DTMF); - if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { - switch_rtp_set_flag(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, SWITCH_RTP_FLAG_BREAK); - } - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SESSION MSG [%s]\n", msg); - } - - if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - char *hint = NULL, *p, *freeme = NULL; - - hint = from; - if (strchr(from, '/') && (freeme = strdup(from))) { - p = strchr(freeme, '/'); - *p = '\0'; - from = freeme; - } - - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", ldl_handle_get_login(profile->handle)); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", hint); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", subject); - if (msg) { - switch_event_add_body(event, "%s", msg); - } - if (switch_core_session_queue_event(tech_pvt->session, &event) != SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true"); - switch_event_fire(&event); - } - - switch_safe_free(freeme); - } - break; - case LDL_SIGNAL_TRANSPORT_ACCEPT: - switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); - - if (ldl_session_gateway(dlsession)) { - do_candidates(tech_pvt, 1); - } - - break; - case LDL_SIGNAL_INITIATE: - if (dl_signal) { - ldl_payload_t *payloads; - unsigned int len = 0; - - if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (msg && !strcasecmp(msg, "accept")) { - switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); - switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); - if (!do_candidates(tech_pvt, 0)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - } - } - - if (tech_pvt->transports[LDL_TPORT_RTP].codec_index > -1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Already decided on a codec\n"); - break; - } - - - if (!get_codecs(tech_pvt)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - - if (ldl_session_get_payloads(dlsession, &payloads, &len) == LDL_STATUS_SUCCESS) { - status = parse_payloads(dlsession, session, payloads, len); - goto done; - } - - } - - break; - case LDL_SIGNAL_CANDIDATES: - if (dl_signal) { - parse_candidates(dlsession, session, LDL_TPORT_RTP, subject); - parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTP, subject); - parse_candidates(dlsession, session, LDL_TPORT_RTCP, subject); - status = parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTCP, subject); - } - - break; - case LDL_SIGNAL_REJECT: - if (channel) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "reject %s\n", switch_channel_get_name(channel)); - terminate_session(&session, __LINE__, SWITCH_CAUSE_CALL_REJECTED); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "End Call (Rejected)\n"); - goto done; - } - break; - case LDL_SIGNAL_REDIRECT: - do_describe(tech_pvt, 1); - tech_pvt->next_cand = switch_micro_time_now(); - if (channel) switch_channel_mark_ring_ready(channel); - break; - - case LDL_SIGNAL_ERROR: - case LDL_SIGNAL_TERMINATE: - if (channel) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "hungup %s\n", switch_channel_get_name(channel)); - terminate_session(&session, __LINE__, SWITCH_CAUSE_NORMAL_CLEARING); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "End Call\n"); - goto done; - } - break; - - default: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "ERROR\n"); - break; - } - - - done: - - - return status; -} - -static ldl_status handle_response(ldl_handle_t *handle, char *id) -{ - return LDL_STATUS_SUCCESS; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */