[Pkg-ofed-commits] [opensm] 01/15: Imported Upstream version 3.3.17

Ana Beatriz Guerrero López ana at moszumanska.debian.org
Tue Jul 1 08:19:47 UTC 2014


This is an automated email from the git hooks/post-receive script.

ana pushed a commit to branch master
in repository opensm.

commit c42e39af2b9b4b0d6bc6512a742693ba687ab5ec
Author: Ana Guerrero López <ana at ekaia.org>
Date:   Tue Jul 1 10:14:34 2014 +0200

    Imported Upstream version 3.3.17
---
 ChangeLog                                          | 1534 ++++
 Makefile.in                                        |  119 +-
 aclocal.m4                                         | 8668 +-------------------
 complib/Makefile.am                                |    2 +-
 complib/Makefile.in                                |   48 +-
 complib/cl_event_wheel.c                           |   18 +-
 complib/cl_nodenamemap.c                           |   57 +-
 complib/cl_threadpool.c                            |    3 +
 complib/libosmcomp.ver                             |    2 +-
 config/config.guess                                |  245 +-
 config/config.sub                                  |  189 +-
 config/depcomp                                     |   74 +-
 config/install-sh                                  |   29 +-
 aclocal.m4 => config/libtool.m4                    | 3855 ++-------
 config/ltmain.sh                                   | 4027 ++++-----
 config/ltoptions.m4                                |  368 +
 config/ltsugar.m4                                  |  123 +
 config/ltversion.m4                                |   23 +
 config/lt~obsolete.m4                              |   92 +
 config/missing                                     |   53 +-
 config/osmvsel.m4                                  |   14 +
 config/ylwrap                                      |   34 +-
 configure                                          | 2953 +++----
 configure.in                                       |   30 +-
 doc/opensm_release_notes-3.3.txt                   |  345 +-
 doc/partition-config.txt                           |    4 +-
 doc/performance-manager-HOWTO.txt                  |   35 +-
 include/Makefile.in                                |   50 +-
 include/complib/cl_atomic_osd.h                    |    2 +-
 include/complib/cl_event_wheel.h                   |   76 +-
 include/complib/cl_nodenamemap.h                   |    2 +-
 include/complib/cl_packon.h                        |    8 +-
 include/complib/cl_spinlock.h                      |   61 +-
 include/complib/cl_threadpool.h                    |    8 +-
 include/complib/cl_types_osd.h                     |   14 +-
 include/config.h.in                                |    3 +
 include/iba/ib_types.h                             |   92 +-
 include/opensm/osm_base.h                          |    1 +
 include/opensm/osm_congestion_control.h            |    2 +
 include/opensm/osm_db.h                            |    9 +-
 include/opensm/osm_event_plugin.h                  |   21 +
 include/opensm/osm_file_ids.h                      |    1 +
 include/opensm/osm_helper.h                        |    4 +
 include/opensm/osm_inform.h                        |   30 +
 include/opensm/osm_log.h                           |    4 +-
 include/opensm/osm_madw.h                          |    5 +-
 .../cl_types_osd.h => opensm/osm_mcast_mgr.h}      |   53 +-
 include/opensm/osm_multicast.h                     |    3 +-
 include/opensm/osm_node.h                          |   10 +-
 include/opensm/osm_opensm.h                        |  105 +-
 include/opensm/osm_perfmgr.h                       |   20 +
 include/opensm/osm_perfmgr_db.h                    |   11 +-
 include/opensm/osm_pkey.h                          |   43 +-
 include/opensm/osm_port.h                          |   43 +-
 include/opensm/osm_sa.h                            |  115 +-
 include/opensm/osm_sm.h                            |   29 +-
 include/opensm/osm_subnet.h                        |   18 +-
 include/opensm/osm_switch.h                        |    2 +-
 include/opensm/osm_ucast_mgr.h                     |    2 +
 include/opensm/osm_version.h                       |    2 +-
 libvendor/Makefile.am                              |    2 +-
 libvendor/Makefile.in                              |   48 +-
 libvendor/libosmvendor.ver                         |    2 +-
 libvendor/osm_pkt_randomizer.c                     |    3 +-
 libvendor/osm_vendor_ibumad.c                      |  116 +-
 libvendor/osm_vendor_ibumad_sa.c                   |   12 +-
 man/opensm.8                                       |  101 +-
 man/opensm.8.in                                    |  101 +-
 man/osmtest.8                                      |    3 +-
 man/torus-2QoS.8                                   |   31 +-
 man/torus-2QoS.8.in                                |   31 +-
 man/torus-2QoS.conf.5                              |   11 +-
 man/torus-2QoS.conf.5.in                           |   11 +-
 opensm.spec                                        |   29 +-
 opensm.spec.in                                     |   25 +-
 opensm/Makefile.am                                 |    3 +-
 opensm/Makefile.in                                 |   65 +-
 opensm/libopensm.map                               |    1 +
 opensm/libopensm.ver                               |    2 +-
 opensm/main.c                                      |   61 +-
 opensm/osm_congestion_control.c                    |   91 +-
 opensm/osm_console.c                               |  111 +-
 opensm/osm_console_io.c                            |   18 +-
 opensm/osm_db_files.c                              |  117 +-
 opensm/osm_db_pack.c                               |    8 +-
 opensm/osm_drop_mgr.c                              |   93 +-
 opensm/osm_dump.c                                  |   24 +-
 opensm/osm_guid_mgr.c                              |    5 +-
 opensm/osm_helper.c                                |  169 +-
 opensm/osm_inform.c                                |  208 +-
 opensm/osm_lid_mgr.c                               |   56 +-
 opensm/osm_lin_fwd_rcv.c                           |   20 +-
 opensm/osm_link_mgr.c                              |   84 +-
 opensm/osm_log.c                                   |    4 +-
 opensm/osm_mcast_mgr.c                             |   77 +-
 opensm/osm_mtree.c                                 |    2 +-
 opensm/osm_multicast.c                             |   13 +-
 opensm/osm_node.c                                  |    9 +
 opensm/osm_node_desc_rcv.c                         |   10 +-
 opensm/osm_node_info_rcv.c                         |   67 +-
 opensm/osm_opensm.c                                |   50 +-
 opensm/osm_perfmgr.c                               |  879 +-
 opensm/osm_perfmgr_db.c                            |  112 +-
 opensm/osm_pkey.c                                  |  159 +-
 opensm/osm_pkey_mgr.c                              |   74 +-
 opensm/osm_pkey_rcv.c                              |    3 +-
 opensm/osm_port.c                                  |    6 +-
 opensm/osm_port_info_rcv.c                         |  101 +-
 opensm/osm_prtn.c                                  |   21 +-
 opensm/osm_prtn_config.c                           |   21 +-
 opensm/osm_qos.c                                   |   15 +
 opensm/osm_qos_parser_y.c                          |  827 +-
 opensm/osm_qos_parser_y.h                          |    8 +-
 opensm/osm_qos_parser_y.y                          |    6 +-
 opensm/osm_qos_policy.c                            |   56 +-
 opensm/osm_req.c                                   |   53 +-
 opensm/osm_sa.c                                    |   44 +-
 opensm/osm_sa_class_port_info.c                    |    3 +-
 opensm/osm_sa_guidinfo_record.c                    |   49 +-
 opensm/osm_sa_informinfo.c                         |   79 +-
 opensm/osm_sa_lft_record.c                         |   20 +-
 opensm/osm_sa_link_record.c                        |   22 +-
 opensm/osm_sa_mad_ctrl.c                           |    7 +-
 opensm/osm_sa_mcmember_record.c                    |  135 +-
 opensm/osm_sa_mft_record.c                         |   20 +-
 opensm/osm_sa_multipath_record.c                   |  188 +-
 opensm/osm_sa_node_record.c                        |   28 +-
 opensm/osm_sa_path_record.c                        |  127 +-
 opensm/osm_sa_pkey_record.c                        |   28 +-
 opensm/osm_sa_portinfo_record.c                    |   36 +-
 opensm/osm_sa_service_record.c                     |   40 +-
 opensm/osm_sa_slvl_record.c                        |   24 +-
 opensm/osm_sa_sminfo_record.c                      |   24 +-
 opensm/osm_sa_sw_info_record.c                     |   18 +-
 opensm/osm_sa_vlarb_record.c                       |   22 +-
 opensm/osm_sm_mad_ctrl.c                           |    1 +
 opensm/osm_sm_state_mgr.c                          |   87 +-
 opensm/osm_sminfo_rcv.c                            |   44 +-
 opensm/osm_state_mgr.c                             |   65 +-
 opensm/osm_subnet.c                                |   94 +-
 opensm/osm_sw_info_rcv.c                           |   16 +-
 opensm/osm_torus.c                                 |  430 +-
 opensm/osm_trap_rcv.c                              |  129 +-
 opensm/osm_ucast_cache.c                           |   19 +-
 opensm/osm_ucast_dfsssp.c                          | 1005 ++-
 opensm/osm_ucast_file.c                            |   11 +
 opensm/osm_ucast_ftree.c                           |  532 +-
 opensm/osm_ucast_lash.c                            |    1 -
 opensm/osm_ucast_mgr.c                             |   64 +-
 opensm/osm_ucast_updn.c                            |   12 +-
 opensm/osm_vl15intf.c                              |    2 +-
 opensm/st.c                                        |    6 +-
 osmeventplugin/Makefile.am                         |    2 +-
 osmeventplugin/Makefile.in                         |   48 +-
 osmeventplugin/src/osmeventplugin.c                |   18 +-
 osmtest/Makefile.am                                |    2 +-
 osmtest/Makefile.in                                |   38 +-
 osmtest/include/osmtest.h                          |    2 +
 osmtest/main.c                                     |    8 +-
 osmtest/osmt_multicast.c                           |   29 +-
 osmtest/osmt_service.c                             |    6 +-
 osmtest/osmtest.c                                  |  148 +-
 scripts/opensm.init                                |   33 +-
 scripts/opensm.init.in                             |   35 +-
 scripts/redhat-opensm.init                         |    5 +
 scripts/redhat-opensm.init.in                      |    5 +
 166 files changed, 12410 insertions(+), 19429 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2964c5a..479cf89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,1538 @@
 
+** Version: HEAD
+
+Thu Jan 30 21:03:46 2014 +0200 Hal Rosenstock
+650b60c0b77bcbd0d8912c4f241ff774705cd564
+
+	* Update package number for OpenSM to 3.3.17 for release
+
+Thu Jan 30 21:01:54 2014 +0200 Hal Rosenstock
+94d947ce6d21e802d22502c087e3842014a7a81e
+
+	* Update opensm_release_notes-3.3.txt
+
+Thu Jan 30 18:53:58 2014 +0200 Hal Rosenstock
+49132000b9208213a191e8e075f8b99a23a1bef7
+
+	* Update (internal) shared library versions
+
+Wed Jan 29 22:17:48 2014 +0200 Hal Rosenstock
+074ec5a4d2e7c3200aab383cd633e150bb8c1583
+
+	* osm_perfmgr.h: Cosmetic formatting changes
+
+Mon Jan 27 14:39:45 2014 +0200 Alex Netes
+05af77646d156d285d2d3122dd65f8ad9c600991
+
+	* osm_drop_mgr.c: Add missing assert
+
+Sun Jan 26 18:14:27 2014 +0200 Alex Netes
+de254f9901c0a2f8187c56026a7f414bceb58786
+
+	* osm_opensm.c: Add missing ERR number
+
+Mon Jan 13 15:26:35 2014 +0900 Jens Domke
+5b2390eac3ef47a8b6f9330e9a904ad7af6f241a
+
+	* dfsssp: optimization for dedicated compute and IO nodes
+
+Tue Jan 21 23:33:01 2014 -0500 Hal Rosenstock
+b1e58bbf50ca403199a9c1ea49b4b74fdd312c5c
+
+	* osmeventplugin: Fix compile warning
+
+Thu Jan 16 18:15:02 2014 +0200 Hal Rosenstock
+48c9f436d6c85d32d2748ba4c2756e2736bc5e7e
+
+	* osm_prtn_config.c: Some changes to osm_prtn_config_parse_file
+
+Sun May 5 12:20:40 2013 +0300 Alex Netes
+0ff054ae2f6e53e9e908f72f23b35cb40b3aeab4
+
+	* osm_trap_rcv.c: Removed unneeded lock when disabling port
+
+Thu Nov 15 18:09:57 2012 +0200 Hal Rosenstock
+e7c4ec39fff6c6c243ac57434eb8f8bbe6f783f8
+
+	* osm_trap_rcv.c: Minimize time holding RW lock for SystemImageGUID changed trap 145
+
+Thu Oct 18 17:59:04 2012 +0200 Hal Rosenstock
+1418f8a2673162fa888cf42f51ca5c4890dde3e8
+
+	* osm_trap_rcv.c: In trap_rcv_process_request, change locking strategy
+
+Wed Aug 29 19:31:19 2012 +0300 Alex Netes
+280a2ac0ba17b909481ebbd3ed406104629f2a36
+
+	* osm_trap_rcv.c: fix locking in trap_rcv_process_request()
+
+Mon Jan 13 13:45:09 2014 -0500 Vladimir Koushnir
+33f4f174be6f11466c789410946159636ad3a046
+
+	* Add new option for guid_routing_order_no_scatter
+
+Mon Jan 13 13:19:29 2014 -0500 Vladimir Koushnir
+a5f54f1e4bede8e1deef242e9e63f6ebb0ba526a
+
+	* osm_ucast_mgr.c: After applying guid_order options, add nodes sorted by neighbor switch load
+
+Sat Jan 4 12:37:59 2014 -0500 Bernd Schubert
+5a97c782a4b4f968c2d964c371decec5083f8499
+
+	* Try default partition config if parsing partitions.conf fails
+
+Sun Jan 5 17:53:40 2014 +0200 Hal Rosenstock
+6321afa188af556850811739630cfaf854dfec23
+
+	* osm_subnet.c: Cosmetic change to config file output
+
+Sat Jan 4 17:25:11 2014 +0200 Hal Rosenstock
+a45e311710b58ecee0dee74a0b48eabe63c10a6a
+
+	* osm_db_files.c: Minor improvement to fix in previous commit 86cf679666f49f6073c1ddf2b9ff644a41537a57
+
+Sat Jan 4 17:10:51 2014 +0200 Hal Rosenstock
+86cf679666f49f6073c1ddf2b9ff644a41537a57
+
+	* osm_db_files.c: Fix issue introduced in commit aaa7b1e67ec6e5fc2a10accf46d538f9d47c6323
+
+Fri Jan 3 08:40:48 2014 -0500 Ilya Nelkenbaum
+ed7be1a62f30e7e065a5a536e8fec33d158b1326
+
+	* Add client_rereg flag to Port Info context
+
+Mon Dec 30 10:59:54 2013 -0500 Hal Rosenstock
+aaa7b1e67ec6e5fc2a10accf46d538f9d47c6323
+
+	* osm_db_files.c: Some minor fixes/improvements to osm_db_store
+
+Sat Jan 4 16:41:17 2014 +0200 Hal Rosenstock
+3cae07c6390ef8b85d93e90f2dbe1f0a42c57a5e
+
+	* osm_perfmgr.c: Cosmetic formatting changes
+
+Wed Jan 1 08:44:28 2014 -0500 Alex Netes
+07b24a3e1335d3d53e0ea85b162ec901b369a469
+
+	* osm_port_info_rcv.c: Reset client reregister bit only on a response to SET
+
+Mon Dec 30 07:24:57 2013 -0500 Alex Netes
+413e4fa2fbd12c7c9f8018b5ef2b4e67449e5c1f
+
+	* osm_trap_rcv.c: fix race condition during sweep
+
+Mon Dec 30 07:24:48 2013 -0500 Daniel Klein
+84c9832d5ce4b557295bd0cdd540848c3367fc77
+
+	* osm_ucast_ftree.c: replace assert with error return value
+
+Thu Dec 26 08:39:12 2013 -0500 Vladimir Koushnir
+90a7960db7fc078201013faf421bcb554dcf8aef
+
+	* osm_ucast_file.c: Fix crash when port is invalid in LFT file
+
+Sat Dec 21 07:54:48 2013 -0500 Hal Rosenstock
+cc5fa1774f6bc98e1ae22522171a25522d443038
+
+	* Add support for synchronizing in memory files with storage
+
+Wed Dec 11 15:38:18 2013 +0200 Vladimir Koushnir
+0a1c0f0d94ccf10c43b59ee8cf249f2a441f99ae
+
+	* osm_sa_path_record.c: Improve ERR 1F1D to show the pkey specified in PathQuery
+
+Sun Dec 1 18:23:26 2013 +0200 Daniel Klein
+94e99a80e01cb07f3e2d01bdbf69b06dd9ac3b7e
+
+	* osm_mcast_mgr.c: Removed mcast_mgr_purge_tree_node due to code duplication
+
+Tue Dec 10 11:13:38 2013 +0200 Vladimir Koushnir
+929934e881f21efe68f6b099abef7e788b7b8ff0
+
+	* osm_pkey.[h c]: Remove dead function osm_pkey_tbl_clear_accum_pkeys
+
+Mon Dec 2 14:58:03 2013 +0200 Alex Netes
+bf42ec8ccbd2cc4af3fabe3b1926a0595ba16ad4
+
+	* osm_mtree.c: Cosmetic change in osm_mtree_destroy function
+
+Wed Dec 4 14:00:54 2013 +0200 Vladimir Koushnir
+a1ccf88513dba90ef2697f7f512a360d338ea006
+
+	* osm_sa_path_record.c: path_sl may return SL different from requested SL
+
+Thu Dec 5 06:10:19 2013 -0800 Line Holen
+7e96f32172fafea3f0340764286dfb9f53658566
+
+	* osm_sm_state_mgr.c: Fix handling of polling retry number
+
+Tue Dec 3 08:25:06 2013 -0500 Daniel Klein
+8f3f7d04eb9fe16f36529c5da6a85a8ad8495421
+
+	* osm_sm_state_mgr.c: Fix race condition during sm_state_mgr_send_master_sm_info_req
+
+Wed Nov 27 16:27:52 2013 +0200 Daniel Klein
+78d87b9a89641ffc42b36b1bd6c05348fea3a025
+
+	* osm_mcast_mgr.c: fixed missing error message number
+
+Tue Nov 19 16:34:37 2013 +0200 Alex Netes
+b1b1b37b7e4f83804dbc8ae780a067c0641c1097
+
+	* Fix minhop population in fabric with duplicate lids
+
+Tue Nov 19 14:15:20 2013 +0200 Alex Netes
+a1df1d7e1a3930d35ec3876c1c0a4a0fe5040f35
+
+	* osm_state_mgr.c: Fix error print in state_mgr_check_tbl_consistency()
+
+Tue Nov 19 14:10:06 2013 +0200 Alex Netes
+ed9de4c80981a7ff47791e15ad466bd9f948572d
+
+	* osm_mcast_mgr.c: Fix wrong comparison in mcast_mgr_subdivide()
+
+Fri Nov 15 04:53:31 2013 -0800 Line Holen
+1441937446ce61c4c550b1a5034c005187a0a3b4
+
+	* osm_mcast_mgr.c Add block number to error message
+
+Wed Nov 13 14:28:47 2013 +0200 Vladimir Koushnir
+c5d5faa1b10f33ab8c5e06fa9af71eb222643000
+
+	* Only rewrite db files during heavy sweep when there is a real change
+
+Tue Nov 12 17:42:02 2013 +0200 Vladimir Koushnir
+edd5e74562908141ecaf67cf3c20b791923c570e
+
+	* Redundant remove() function call during db file generation
+
+Sun Nov 10 18:09:25 2013 +0200 Vladimir Koushnir
+9853841f369decde551d03ff4c1f21a59afbc23e
+
+	* Implement atomic update operation for sa_db_file
+
+Tue Nov 12 06:18:36 2013 -0500 Vladimir Koushnir
+175455201dc349dfee1253386ae5c0f90e83be33
+
+	* Remove unused lid matrix calculation in Torus_2Qos routing
+
+Tue Nov 12 16:27:42 2013 -0500 Alex Netes
+dcb2df0f0f13aa8b77c5f16bdcc4c27d11dae6df
+
+	* osm_link_mgr.c: Fix uninitialized value (physp0)
+
+Mon Sep 16 10:38:45 2013 +0200 Shlomi Nimrodi
+7160cce6e2ec517fd573364ee271f6380d549b89
+
+	* osm_link_mgr.c: Fix uninitialized value (physp0)
+
+Thu May 9 17:45:19 2013 +0300 Alex Netes
+5aa4ea3a20ba7732460d0040cbed4acd0d09907c
+
+	* osm_link_mgr.c: fix uninitialized variable usage
+
+Wed Nov 6 17:24:12 2013 +0200 Alex Netes
+9aa6dcd284223a782e62534dc099b50828c9155b
+
+	* osm_drop_mgr.c: fix timeouts on Get Pkey from ext switch ports
+
+Tue Nov 5 17:15:26 2013 +0200 Dan Ben Yosef
+361c01435734c9c00bc936e4236668d3e1b6c0ef
+
+	* Fix dropping node after setPkey mad
+
+Mon Nov 4 12:43:08 2013 -0500 Vladimir Koushnir
+2585f585f28f5e3b4cd14ba489d0b6d1f476ceea
+
+	* Improve memory consumption of pkey manager by using cl_map for accum_pkeys
+
+Mon Nov 4 15:11:13 2013 +0200 Vladimir Koushnir
+754bd75336e4a8202d2e0782a29a4cf765ca44a7
+
+	* osm_opensm.c: When exiting, update SADB only in MASTER state
+
+Mon Nov 4 07:52:56 2013 -0500 Dan Ben Yosef
+3cc0a3e642facf7ea21e960b31fd9834df7d3a82
+
+	* Fix timeout handling for pkeyGet for sw port 0
+
+Fri Nov 1 09:17:57 2013 -0400 Dan Ben Yosef
+189a39d748a049f002032abf52c935ed294ca967
+
+	* Fix possible use of lid 0 when sending set PortInfo after failure of the first PortInfo set
+
+Fri Nov 1 08:10:23 2013 -0400 Dan Ben Yosef
+6d1d1a4cbf07a1dda1df016c10aaf3b72ec0342a
+
+	* Fix handling of get P_KeyTable on timeout
+
+Sun Oct 27 16:19:47 2013 +0200 Alex Netes
+df385e88f8a9158cf34ab67eba800463067f4016
+
+	* osm_ucast_cache.c: Fix memory leak in ucast_cache
+
+Mon Oct 28 12:35:04 2013 +0200 Vladimir Koushnir
+79ba8770ef909d94f051c612f1b7180d7b9b726d
+
+	* osm_link_mgr.c: active_transition parameter in PortInfo(Set) context may not be initialized
+
+Wed Oct 23 10:38:17 2013 -0400 Alex Netes
+b44206235abc6a6f144cf5b9395bd62965b1532d
+
+	* Resend trap 144 when detecting remote MASTER SM with lower priority
+
+Thu Oct 17 13:10:46 2013 +0200 Bernd Schubert
+cf014ec7d2188c34f3f66a00efc2db1b2ddcb203
+
+	* reduce log level for missing partition configuration file.
+
+Sun Oct 20 08:30:08 2013 -0400 Daniel Klein
+49ea151795e5a99741bb92d35536ff0b9df7868a
+
+	* osm_pkey.c: Fix find common pkey bug fix
+
+Mon Oct 7 16:35:46 2013 -0400 Hal Rosenstock
+d3aeae83fe7c71bd052376ae155eb2bfd9e2720d
+
+	* osmtest: Handle other than default subnet prefix
+
+Mon Oct 7 16:35:40 2013 -0400 Hal Rosenstock
+de029540feb2882c23fb43abb88583680d6356f4
+
+	* osm_trap_rcv.c: Log DR path to node when trap 128
+
+Mon Oct 7 16:35:36 2013 -0400 Hal Rosenstock
+181c863180df272500ff993abb1e62ca56bd2729
+
+	* osm_vendor_ibumad.c: Improve ERR 5430 log message
+
+Fri Oct 4 00:03:06 2013 +0900 Jens Domke
+e3aa9e8461a15654985d27148db7af2dd33fe797
+
+	* dfsssp: send multicast forwarding tables to switches
+
+Fri Oct 4 00:03:05 2013 +0900 Jens Domke
+4a39fb11387284d60a680ec62a9b50a9415a1461
+
+	* dfsssp: send multicast forwarding tables to switches
+
+Tue Oct 1 12:41:40 2013 +0300 Alex Netes
+d5f6e254c4f34b81ef3962e6c142828e748b1c67
+
+	* osm_sa_mcmember_record.c: Fix incorrect comparison of IPv6 MGID when searching for SNM MLID
+
+Mon Sep 30 17:05:55 2013 +0300 Alex Netes
+908c524296a2f94e5fd11f55a2f0049be404aa40
+
+	* osm_guid_mgr.c: Fix GUIDInfo SET function
+
+Mon Sep 16 07:38:38 2013 -0700 Line Holen
+7321689517078ea643f1275c99674fce935d7cc2
+
+	* osm_state_mgr.c Add info to some error messages
+
+Sat Sep 14 17:08:50 2013 +0300 Hal Rosenstock
+0fc753d342e8487d097d9cfef9493e8e40d4b0d0
+
+	* osm_sa_path_record.c: Eliminate extraneous space in 1F1A log message
+
+Wed Sep 11 09:29:39 2013 -0400 Hal Rosenstock
+18b3be9269ddbb58f02bd06f0a7b8678fc81a646
+
+	* Use trap number defines rather than actual trap numbers
+
+Thu Sep 12 16:41:33 2013 +0300 Hal Rosenstock
+270a7004877308fa80fb68ac64aafb388efa953d
+
+	* osm_db_files.c: Add osm_db_domain_init failure handling into test program
+
+Thu Sep 12 01:14:13 2013 -0700 Line Holen
+2b82c1cd758c395d94c24f6afd9a3c2fb4895d86
+
+	* Handle memory allocation failure in osm_db_domain_init()
+
+Wed Sep 11 12:41:58 2013 +0200 Vladimir Koushnir
+82841323af4cc56535f334a0d0c3af11343e2633
+
+	* Use after free in osm_prtn_delete
+
+Tue Sep 10 03:50:12 2013 -0700 Line Holen
+e8bf592d7bb2f0ca357985ac0c7f2a765b7f50b8
+
+	* Clean up event subscriptions if a port goes away
+
+Thu Sep 5 10:18:38 2013 -0400 Hal Rosenstock
+e186b4a37995405d787b92b89292c20f08f84bfd
+
+	* osm_sa_guidinfo_record.c: False duplicate GUID error messages
+
+Tue Sep 3 04:31:23 2013 -0700 Line Holen
+d95d461bc1a1ac63a84b37bfc2a09ca8aca1e79e
+
+	* osm_sa_informinfo.c Add attribute info to log messages
+
+Wed May 1 18:10:17 2013 +0300 Alex Netes
+7c9afa00b00bc0fe08363dfc1c155bf39a88d3ba
+
+	* Improve m_key lookup
+
+Wed May 1 19:14:34 2013 +0300 Alex Netes
+3e146fa76deae23442b6a9d74b6725e2d7dd0030
+
+	* Add option to disable M_Key lookup
+
+Wed Aug 14 03:26:42 2013 -0700 Line Holen
+94789a85a870752c5e574281e6eb8f7a6f56baa4
+
+	* osm_port_info_rcv.c Issue a log message if we cannot read the MKey of a port
+
+Thu Aug 22 10:31:06 2013 -0400 Alex Netes
+807d9ed630266bd60dd783faf364ea5e7c4358d5
+
+	* osm_trap_rcv.c: Fix locking in aging callback
+
+Thu Aug 22 10:54:09 2013 -0400 Dan Ben Yosef
+b67db2b87f0d460a8bccf9cf2c644cd7197d7e02
+
+	* osm_helper.c: Fix out-of-bounds read
+
+Tue Aug 20 12:31:50 2013 -0400 Dan Ben Yosef
+ef86015aadcf9b90726cc72868be38109f04a4e5
+
+	* osm_db_files.c : Fix resource leak guid2lid parser
+
+Tue Aug 20 10:28:49 2013 -0400 Vladimir Koushnir
+4a2d2d84e8b0fd0754d6a67f0dce4d9398393cff
+
+	* osm_subnet.c: Fix memory leak caused by commit dc0760cb8088fbe079e19682570a884ba01e94ff
+
+Tue Aug 20 17:23:14 2013 +0300 Alex Netes
+168eaeb522bcb34406e12c45eff5fc68fbb4e834
+
+	* osm_db_files.c: Fix memory leak when deleting entries from osm db
+
+Wed Aug 14 17:29:08 2013 +0300 Alex Netes
+eb294d5454d74a54753b95a016a0c478e641d04e
+
+	* osm_lid_mgr.c: Don't configure MTU and LMC for base SP0
+
+Wed Jul 31 17:11:36 2013 +0300 Hal Rosenstock
+edfaddc7b7788297fcce19d9890f0e7191b9e2da
+
+	* osm_ucast_dfsssp.c: Fix some typos
+
+Wed Jul 31 15:04:06 2013 +0900 Jens Domke
+e1804f4fdd148fc9cc45798b8b45e86efd61dee1
+
+	* dfsssp - add missing and change existing return values
+
+Tue Jul 30 11:03:17 2013 +0300 Daniel Klein
+d5ef9afb82dfe1007cf044490387b9e38c65a8e6
+
+	* update man page and usage explanation for --lfts_file
+
+Tue Jul 30 17:08:06 2013 +0300 Hal Rosenstock
+6fdd84495fdf83d2b59ce9f7846ea4edbd1091df
+
+	* osm_sa_path_record.c: Fix rate setting issue in SA PR handling
+
+Mon Jul 29 10:37:36 2013 +0300 Alex Netes
+4d6925caa05a41fa155c8a00d329cc97e7d88b57
+
+	* osm_vendor_ibumad.c: Fix explicit null derefenced issue found by coverity
+
+Tue Nov 27 16:06:25 2012 +0200 Alex Netes
+2d67f3e34c190b3e647e70aa3754bed3d6c062c5
+
+	* opensm/osm_db_pack.c: Removed uneeded asserts
+
+Mon Jul 22 21:19:48 2013 -0400 Eitan Zahavi
+09e1e7ee1399cb4d81cd0b821fda8a4a29f1021e
+
+	* libvendor/osm_pkt_randomizer.c: Fix broken compilation with vendor sim
+
+Thu Jul 18 09:53:34 2013 -0400 Alex Netes
+a47e5d049eb3f2e3ded70e3e61e04608f2451d4e
+
+	* complib/cl_event_wheel.c: Roundup timeout to nearest msec
+
+Tue Jul 9 10:52:53 2013 +0300 Alex Netes
+6ff99aa57af9608945e69e41b1e707b14331d6f1
+
+	* complib/cl_event_wheel.c: Add print of num_regs in cl_event_wheel_dump
+
+Tue Jul 9 10:43:43 2013 +0300 Alex Netes
+a3957f258a8cfd70ccdead1ede1452a65ec809df
+
+	* complib/cl_event_wheel.c: Fix duplicate error codes
+
+Thu Jul 4 14:00:22 2013 +0300 Alex Netes
+ceb4041ff7bc6b6caaccd1c6ca7b68507a9b80ba
+
+	* Fix test scenario in cl_event_wheel
+
+Wed Jul 3 20:06:48 2013 +0300 Hal Rosenstock
+51b187bc4843e741171bbcfad3e9ecd2d929f7dc
+
+	* Add flags to OSM_EVENT_ID_UCAST_ROUTING_DONE
+
+Tue Jul 2 17:55:12 2013 +0300 Hal Rosenstock
+5824714a0892e45038c0620d056f6926710e06c8
+
+	* osmeventplugin/osmeventplugin.c: Add Mellanox copyright
+
+Tue Jul 2 17:46:09 2013 +0300 Hal Rosenstock
+7186965c3a02fea16e63b2815b68a2504606bdef
+
+	* osm_event_plugin.h: Add Mellanox copyright
+
+Tue Jul 2 16:40:38 2013 +0300 Jeff Becker
+c97bd7b5d3f621c10f95ed3d0553c6c57cfe2874
+
+	* Permit toggling log flush from console
+
+Fri Jun 28 01:07:00 2013 -0700 Roland Dreier
+cd3b715107c7499be0c1b632cc2b2bf2aeaaf95e
+
+	* osmtest: Make the "-guid" option's argument mandatory
+
+Wed Apr 3 11:28:12 2013 +0300 Alex Netes
+0154977f90422ce6c1b457e2634d4cbfad075511
+
+	* complib/cl_event_wheel.h: Some cosmetic fixes
+
+Wed Jun 26 01:18:13 2013 -0700 Line Holen
+b78b1d53cf9a9ff6269b658b3a4a8cd15f8894b8
+
+	* osm_sa_mcmember_record.c validate_requested_mgid returning boolean
+
+Mon Jun 24 12:47:39 2013 -0400 Vladimir Koushnir
+58ee065dbdeaa714379466cf864bbf6f306cb21b
+
+	* osm_ucast_mgr.c: Fix extra copy in set_lft_block routine
+
+Sat Jun 22 18:21:51 2013 +0300 Vladimir Koushnir
+2a8c474fd61be844fdb5e1a7202bf45cabcd5c5a
+
+	* complib: Fix memory leak in cl_thread_pool_destroy function
+
+Tue Jun 25 21:46:24 2013 +0300 Vladimir Koushnir
+5bf6e727fd909d1548f88f96e107c2e06920e058
+
+	* osm_ucast_mgr.c: Fix duplicated code for fallback routing engine
+
+Mon Jun 24 08:02:58 2013 +0300 Alex Netes
+1960fbc63acc2bb165ffe0337692838ade932b9d
+
+	* osm_trap_rcv.c: Fix crash in babbling port feature
+
+Sun Jun 9 18:05:01 2013 +0300 Vladimir Koushnir
+96eafa0544ba3a2040dfb43b1df5be5d77f73d95
+
+	* ftree: Allow defining only io_guids file and consider rest of nodes as CN nodes
+
+Thu Jun 20 00:44:02 2013 -0700 Line Holen
+2e5966eaadb64f748462831014660a8f350171b9
+
+	* osm_sm_state_mgr.c Trivial log changes
+
+Wed Jun 5 11:14:59 2013 +0000 Line Holen
+aed167565a9571efed67805634988911de54bb06
+
+	* Log changes related to event subscription and forwarding
+
+Wed Jun 5 14:52:01 2013 +0300 Dan Ben Yosef
+1872d116e9cf27399307e1d3aad5eb54824251e8
+
+	* osm_sa_sminfo_record.c: fix sminfo sa query returns all sminfo records when filtering by LID in osm_smir_rcv_process
+
+Tue Dec 4 16:44:06 2012 +0200 Dan Ben Yosef
+b92f25acc193e870dd8fa47c766a4b1a02bc815e
+
+	* osm_ucast_cache.c : Fix dereference null return value
+
+Sun Apr 28 10:06:00 2013 +0300 Alex Netes
+21765ade61c96c319d157293e57e10f2f0e07846
+
+	* When SM fails to load/parse root_guids file use MinHop heuristics
+
+Mon Jun 3 11:44:01 2013 +0300 Vladimir Koushnir
+7c21c145e228cab52670819a22478fba409efb6c
+
+	* Fix shift pattern support in FTREE routing for native ftree topologies
+
+Sun Dec 2 16:07:49 2012 +0200 Dan Ben Yosef
+35f4419e6f2451f2124e826e8e93b02c733d068c
+
+	* osm_ucast_ftree.c: fix dereferencing null variable
+
+Sun Dec 2 13:48:47 2012 +0200 Dan Ben Yosef
+4d36d6d133c09e45fe394b3519ac9cae5ebbe1c5
+
+	* osm_ucast_ftree.c : fix dereferencing null variable
+
+Thu Aug 16 16:33:55 2012 +0300 Dan Ben Yosef
+49f1a71299e4aa28a8319334c772525f67cbd1ca
+
+	* opensm: fix possible double free in osm_ucast_ftree.c
+
+Sun Apr 29 12:25:41 2012 +0300 Vladimir Koushnir
+269512894d0bbb814707bf0aae56e832228f32f9
+
+	* Fix fat-tree routing for CAs with more than 1 connected port
+
+Tue Jun 11 14:30:41 2013 +0300 Hal Rosenstock
+75bba51121c5545209b15489b9928fe4fd826007
+
+	* Minor log formatting changes
+
+Mon Jun 3 11:40:47 2013 +0000 Line Holen
+16b4dfc9f8c1cf7283590607b7bfd83ab287260e
+
+	* Some log changes
+
+Thu Jun 6 14:35:45 2013 +0000 Line Holen
+51f87eec666f0a3911df301195c63b42bbdf6dc6
+
+	* Add attribute information to SA request error messages
+
+Wed Jun 5 11:14:12 2013 +0000 Line Holen
+42558d6dc04d748ba0c923bf5f3eae065da55c60
+
+	* osm_sm_state_mgr.c Don't clear IS_SM bit when changing state to NOT_ACTIVE
+
+Mon Jun 3 11:39:46 2013 +0000 Line Holen
+abd47ccc7b18d54f7c6caf593dbdf4726a8af5d4
+
+	* osm_sa_mcmember_record.c Reduce number of error messages the for same event
+
+Thu May 30 18:16:43 2013 +0000 Line Holen
+ae9d7e7f4e2f62eabad4cf9d60cd5b68a8295147
+
+	* Add trap details to notice log message
+
+Thu May 30 21:14:00 2013 +0300 Jens Domke
+21a5b5f988c20a9ed024cc039b4cf56198b6aadd
+
+	* DFSSSP - workaround for better VL balancing
+
+Thu May 30 07:38:56 2013 -0700 Line Holen
+b42ae68c0b2341308d66fe07f271a76c16ee9cfc
+
+	* osm_console_io.c Memory leak when closing console
+
+Wed May 29 15:41:41 2013 +0300 Dan Ben Yosef
+bcf00cb2036530de2c2a1b04708a836fb612653f
+
+	* osm_ucast_dfsssp.c: Fix memory leak in dfsssp_do_dijkstra_routing
+
+Tue May 28 04:20:54 2013 -0700 Line Holen
+f42a23223142fe2a984f37b3f3aa71dddef86ec7
+
+	* Fix segfault in osm_mgrp_delete_port()
+
+Sat May 25 18:01:46 2013 +0300 Hal Rosenstock
+886de5d544bfc80c6ded7f424296a7f0afff7043
+
+	* ib_types.h: Fix commentary typo
+
+Wed May 22 17:31:29 2013 +0300 Hal Rosenstock
+234401bda9a5185acad047ab97725b8524afac3b
+
+	* cl_threadpool.h: Remove vestigial mention of cl_thread_pool_construct
+
+Tue May 14 04:26:51 2013 -0700 Line Holen
+e20f37aa46eebaa505bfa87c82556d0139126bed
+
+	* osm_subnet.c Remove empty syslog message
+
+Mon May 13 09:30:43 2013 -0700 Line Holen
+1a94326774821805588de4abf382265d69c95bbe
+
+	* osm_sa_multipath_record.c Use aliasGUIDs when building responses
+
+Mon May 13 20:13:52 2013 +0300 Hal Rosenstock
+898e9a321edae75152d490017846c317ea3f23bb
+
+	* osm_ucast_lash.c: Cosmetic formatting change
+
+Thu May 9 18:48:09 2013 +0300 Alex Netes
+6d0413dfc662bd8749655fbb7a5c2c5bb1962973
+
+	* opensm/osm_ucast_dfsssp.c: Fix unused variable in update_mcft()
+
+Thu May 2 21:15:26 2013 +0900 Jens Domke
+83950842ea845dd2803d80c685ebdad9fabb0622
+
+	* OpenSM: dfsssp - add support for multicast
+
+Tue Apr 23 17:09:19 2013 +0300 Alex Netes
+943a40a5890db9874eceaa63461ecf99eb60ae12
+
+	* opensm: Fix Q_Key, TClass and limited keys parsing warnings in partitions.conf
+
+Thu Apr 11 10:19:35 2013 -0400 Alex Netes
+0fc6e8b996951eff2e1b40599af9b0deefb35009
+
+	* osm_lid_mgr.c: Fix duplicate LID assignment after SM port down
+
+Thu Apr 11 14:19:27 2013 +0000 Ira Weiny
+583d4cf3729f805a15b2260ccf92fe166f4e579f
+
+	* osm_console_io.c: Handle another write-strings issue
+
+Wed Apr 10 14:18:53 2013 +0300 Hal Rosenstock
+becc27ece0815807f39e45ac8016df18dabd9b29
+
+	* osm_sa_mad_ctrl.c: Drop incoming SA queries when shutting down
+
+Wed Apr 10 00:50:01 2013 +0300 Hal Rosenstock
+dbeb7a790227914618e342b1bc04a21f347e9331
+
+	* Change LFT event to be per block/per switch rather than just per switch
+
+Wed Apr 10 00:43:17 2013 +0300 Hal Rosenstock
+25c088aa6256d435b07c0b7dca8b14e907faa112
+
+	* Setup SM port GUID in subnet object as soon as it is known
+
+Wed Apr 10 00:37:14 2013 +0300 Hal Rosenstock
+92c502aeb960edbfbb0c7c13bac3565a485a129f
+
+	* osm_sa_mcmember_record.c: On join and leave, validate subnet prefix in port GID
+
+Wed Apr 10 00:35:07 2013 +0300 Hal Rosenstock
+cbbe385b81744b6caa5d982b03c9156470239edf
+
+	* osm_sa_mcmember_record.c: Improve debug log message in validate_modify
+
+Wed Apr 10 00:32:42 2013 +0300 Hal Rosenstock
+4f835ae9a0450573e76f23805b41bccd26a170c8
+
+	* osm_congestion_control.c: Simplify some code
+
+Wed Apr 10 00:31:19 2013 +0300 Hal Rosenstock
+23ebbe96ce2beca4846726891f5d1c4eacb887c3
+
+	* osm_log.c: Remove unneeded initialization in osm_log
+
+Tue Apr 9 22:50:57 2013 +0300 Hal Rosenstock
+550fdeb2b02abc7b653825ded9f5f9446657ef34
+
+	* osm_lid_mgr.c: Some commentary fixes/updates
+
+Fri Apr 5 15:32:35 2013 -0700 Albert Chu
+1d5084577ae686620df9dc6695087b7fea8c3f4c
+
+	* opensm: Add configure output messages for several configure options
+
+Fri Apr 5 05:31:44 2013 +0300 Hal Rosenstock
+91384edf75306acf70be78f114253efbe9c460f9
+
+	* osm_lid_mgr.c: Fix a couple of commentary typos
+
+Mon Apr 1 16:16:25 2013 +0300 Hal Rosenstock
+a23880018798d6715b179f95e85d7b83bbf8463c
+
+	* ib_types.h: Trap 144 PortInfo:CapabilityMask2 changed bit definition
+
+Mon Mar 25 12:41:35 2013 +0200 Ammar Haj Hamad
+564b6eb858f319e4282c7925ef6ace7c1f9bd74f
+
+	* opensm: fix dfsssp uninitialized value
+
+Mon Mar 18 17:42:11 2013 +0200 Hal Rosenstock
+6cd61141d8442c49d4e5b6bcb29eeeb037384c83
+
+	* opensm: Add support for LFT changed event
+
+Mon Mar 18 17:41:39 2013 +0200 Hal Rosenstock
+c0602edd30b9e2efbd3e2d917a423c120f8dbd4d
+
+	* opensm/osm_port_info_rcv.c: Fix min_sw_data_vls calculation
+
+Thu Mar 14 20:18:20 2013 +0200 Hal Rosenstock
+395157e5de360e02c5e4c827febc21442af3ad67
+
+	* opensm/osm_node.h: Fix some commentary typos
+
+Thu Mar 14 17:42:22 2013 +0200 Hal Rosenstock
+2d8df36729434a8ab68035eec9898b512b918e91
+
+	* opensm/osm_sw_info_rcv.c: Fix double release of lock in osm_si_rcv_process
+
+Thu Mar 14 13:08:39 2013 +0200 Hal Rosenstock
+664494a8157684f2f277fb457556a7c27feae0af
+
+	* opensm: Fix issues causing const warnings for strings
+
+Mon Mar 11 15:35:29 2013 +0200 Hal Rosenstock
+8840f825a7a2800acfa4b9559c111dff30f9b6af
+
+	* opensm/osm_switch.h: Cosmetic change
+
+Sat Mar 9 17:25:38 2013 +0200 Hal Rosenstock
+1a06167c7a2450e110ffcba179c829fa43b6ac9b
+
+	* opensm/man/osmtest.8: Add option for using full world path queries
+
+Fri Mar 8 09:31:10 2013 -0700 Jim Schutt
+eb43f7e5fd768b24148924c2443774525b4f15e0
+
+	* opensm/osm_torus.c: clarify log messages on stale priv pointers
+
+Fri Mar 8 08:59:01 2013 -0700 Jim Schutt
+e7435ef51bd6f07c2d9520e959a731e78e83078e
+
+	* opensm/osm_torus.c: avoid the possibility of following stale ->priv pointers
+
+Fri Mar 8 18:35:29 2013 -0800 Ira Weiny
+1f7ceb8c05fdbe84d75c79d8abb768000ec520ad
+
+	* opensm/osmtest: fix debug build
+
+Thu Mar 7 16:11:08 2013 +0200 Hal Rosenstock
+dc0760cb8088fbe079e19682570a884ba01e94ff
+
+	* opensm/osm_subnet.c: Miscellaneous minor fixes
+
+Mon Mar 4 23:45:10 2013 +0200 Hal Rosenstock
+4924ea7283e2027a49e8a8a7ca33b20f96af2ae7
+
+	* osmtest: Add support for full world path records back as option
+
+Mon Mar 4 22:52:38 2013 +0200 Hal Rosenstock
+6f1a67e966d62040319f093eb61d9c72e2a4390a
+
+	* osmtest/osmtest.c: Minor reordering of code in osmtest_write_all_path_recs
+
+Mon Feb 25 16:02:54 2013 +0200 Dan Ben Yosef
+e9556df81f50ee3653bc10420a7529a81804e331
+
+	* opensm/osmtest.c: half_world_query when creating inventory file
+
+Sat Mar 2 18:02:39 2013 +0200 Hal Rosenstock
+81d3ea3a41af100f8e6b61ea1c68eabfed0b815f
+
+	* opensm/osm_subnet.c: Change default for perfmgr_query_cpi to FALSE
+
+Fri Mar 1 16:39:13 2013 -0800 Albert Chu
+309317deaa08cc3937d2676b43390f85c2c6c7da
+
+	* opensm/osm_ucast_ftree.c: Fix invalid debug output message
+
+Thu Feb 28 17:08:51 2013 -0800 Ira Weiny
+904a555396482fdfdf0253d4dd778093950c64d1
+
+	* opensm/perfmgr: fix access to shared sweep_state variable
+
+Thu Feb 28 17:08:49 2013 -0800 Ira Weiny
+1458263d0646045559a827e7ab40990658b3eeae
+
+	* opensm/perfmgr: don't clear data counters in PortCounters when ExtendedPortCounters is supported
+
+Thu Feb 28 17:08:07 2013 -0800 Ira Weiny
+b73c378e4003e095c6ac41ac2b545c315d1e7fdc
+
+	* opensm/perfmgr; add support for PortCountersExtended NOIETF
+
+Thu Feb 28 17:06:18 2013 -0800 Ira Weiny
+70f58208bcb021774a6d502643ca7cdc26a231e6
+
+	* opensm/perfmgr: Issue PortCountersExtended query when supported
+
+Thu Feb 28 17:05:26 2013 -0800 Ira Weiny
+d0a85322aa6a69d21e9538f03d1f8c30e1ea745a
+
+	* opensm/perfmgr: clean up: break out redirect processing from pc_recv_process
+
+Thu Feb 28 17:05:23 2013 -0800 Ira Weiny
+b6d0001f6918c6557980931c7487a5954559aa12
+
+	* opensm/perfmgr: issue ClassPortInfo as first query to each port.
+
+Thu Feb 28 17:31:19 2013 +0200 Hal Rosenstock
+e1af1ce730a419fe2210b5fa073f2fe84a7c8524
+
+	* opensm/osm_console.c: Use ib_port_info_get_link_speed_ext_enabled
+
+Tue Feb 26 13:54:42 2013 -0800 Albert Chu
+2ba9919a459129a055d97691af7d366e159cb8c2
+
+	* opensm/osm_console.c: Do not perform portstatus checks on down ports
+
+Tue Feb 26 13:54:40 2013 -0800 Albert Chu
+5c45f606fed1c6952863bec0de88215e908aeb6c
+
+	* opensm/osm_console.c: Support portstatus output for unenabled width/speed
+
+Mon Feb 25 08:30:54 2013 -0800 Ira Weiny
+ef32e127a9ea0d08af4133cc13c4002bfa86bcd6
+
+	* opensm: make osm_pr_rcv_get_end_points, osm_pr_rcv_process_pair, osm_pr_rcv_process_half public
+
+Mon Feb 25 08:30:10 2013 -0800 Ira Weiny
+7723c07d86d1ea62594c7d91cea16f78df030d25
+
+	* opensm: make osm_get_path_params public
+
+Mon Feb 25 18:43:54 2013 +0200 Hal Rosenstock
+7ac18bb72b1349e962c81e201bd87be6db81f6c2
+
+	* opensm/osm_perfmgr.c: Cosmetic changes
+
+Sat Feb 23 16:17:41 2013 -0800 Ira Weiny
+fe52571755d64248830dc4abdfb735128f8fd28f
+
+	* opensm/perfmgr: add failed port guid to error message
+
+Fri Feb 22 18:23:57 2013 +0200 Alex Netes
+8b67a1c803eee5a23eb5514510fef4a41f93bdec
+
+	* opensm/osm_req.c: Better implementation of req_determine_mkey
+
+Thu Feb 21 13:44:13 2013 -0800 Ira Weiny
+37eecc80c828ad12a8c346407e0fbd669f80afd7
+
+	* opensm/libibvendor: osm_vendor_get_all_port_attr include sm_sl value in port attribute struct
+
+Tue Feb 12 22:40:05 2013 +0200 Hal Rosenstock
+8ac930e1313a5dda6919d9986bb0ed588a12c45a
+
+	* osmtest/osmt_multicast.c: Fix IPoIB MC group recognition
+
+Thu Feb 21 17:40:47 2013 +0200 Hal Rosenstock
+5a33cc67319b0deab2294d936b014299cb1151b4
+
+	* osmtest/osmt_multicast.c: Fix commentary typo
+
+Tue Feb 12 08:56:39 2013 +0200 Dan Ben Yosef
+19476441c62b5cf5b6841fc6dbedbd3777e60d63
+
+	* opensm/osm_qos_policy.c: fix memory leak when parsing policy file
+
+Wed Feb 20 20:37:38 2013 +0200 Hal Rosenstock
+935816436789b998dcb9387ccc9037f6bce2341d
+
+	* opensm/osm_sa_multipath_record.c: Validate required components are indicated
+
+Wed Feb 20 20:35:15 2013 +0200 Hal Rosenstock
+fbe0d0275c926244bfef3d73c9fe74ebdfee57e6
+
+	* opensm/osm_sa_multipath_record.c: Make sure either none or both ServiceID parameters are supplied
+
+Wed Feb 20 20:31:25 2013 +0200 Hal Rosenstock
+f929ac163eb91fa1064d0b8d86005fd23e0955ae
+
+	* opensm/osm_sa_path_record.c: Make sure either none or both ServiceID parameters are supplied
+
+Wed Feb 20 20:29:20 2013 +0200 Hal Rosenstock
+43efbc20443288f539307147256ccc12365b20f5
+
+	* opensm/osm_sa_multipath_record.c: Fix seg fault in mpr_rcv_get_apm_paths
+
+Wed Feb 20 20:22:55 2013 +0200 Hal Rosenstock
+186a59884c1260286fc7512a134fa102ddf4e7f7
+
+	* opensm/osm_sa_multipath_record.c: Fix commentary typo
+
+Sun Nov 11 15:49:03 2012 +0200 Ilya Nelkenbaum
+4cb3751024ba9a45b2d305c06c907b5e95e38b3b
+
+	* osm_dump.c: Fix typo in dump_lid_matrix
+
+Wed Feb 20 20:04:29 2013 +0200 Hal Rosenstock
+a0deac6cdb3ea10a7970a41a5b3108d8299ba7fc
+
+	* opensm/osm_dump.c: Fix enhanced switch port 0 handling in print_node_report
+
+Wed Feb 20 19:48:14 2013 +0200 Hal Rosenstock
+250802dd5d5706e910c887d832091a962ae7edba
+
+	* opensm/osm_qos_policy.c: Fix source & destination GUID policy check
+
+Wed Feb 20 16:55:02 2013 +0200 Daniel Klein
+9f231a8e55f103db4e9808636afa799ead55e5ef
+
+	* libvendor/osm_vendor_ibumad.c: fix mad validation in case of multipath record response
+
+Wed Feb 20 13:58:27 2013 +0200 Hal Rosenstock
+abbbe8ae825054172614fc016024b019631fbf78
+
+	* opensm/ib_types.h: Add missing IB_MPR_COMPMASK_SERVICEID define
+
+Tue Feb 19 15:06:34 2013 -0800 Ira Weiny
+2be4e201b1c997321d11d8b5d0c5c0975472fa7b
+
+	* opensm/perfmgr: update node name when Node Description is received from node
+
+Wed Feb 13 13:52:03 2013 -0800 Ira Weiny
+f37bf3c615f230577408ad779c1dc6c6080e899f
+
+	* opensm/perfmgr: skip data counters when only printing errors
+
+Wed Feb 13 13:51:23 2013 -0800 Ira Weiny
+8412591dd0b83eb37d371c7b68e04caadd4ca98c
+
+	* opensm/perfmgr: mark/report time of last counter update
+
+Tue Feb 19 19:56:50 2013 +0200 Hal Rosenstock
+505d48b9b54dad9ffeab940dc257e53c0c499432
+
+	* opensm/osm_torus.c: Cosmetic formatting changes
+
+Fri Feb 15 21:21:07 2013 +0200 Hal Rosenstock
+dc44d485710cad711dfab653db2e728fc04a3952
+
+	* opensm/ib_types.h: Add missing IB_PR_COMPMASK_SERVICEID define
+
+** Version: opensm-3.3.16
+
+Tue Feb 5 19:11:07 2013 +0200 Alex Netes
+c7837ce677a7a719aa46565b83c87350ccceb8df
+
+	* opensm: packages versions update
+
+Tue Feb 5 18:12:49 2013 +0200 Alex Netes
+387f554a2867e6a1e2cc85789370e7e27a7c38e9
+
+	* opensm_release_notes-3.3: update
+
+Tue Feb 5 17:57:55 2013 +0200 Alex Netes
+c491dae684a2eb722b58d9f53a2ae4ee61701112
+
+	* opensm: update shared library versions
+
+Mon Jan 28 15:42:05 2013 +0200 Hal Rosenstock
+d7e4da1035ed409d9ac478da8e304eaaf7895856
+
+	* opensm: Use IB_PATH_SELECTOR_EXACTLY rather than harded coded constant
+
+Thu Jan 24 17:16:28 2013 +0200 Hal Rosenstock
+735c86d85ff4e818d9bc0d1202da2fe6fb414e6e
+
+	* opensm/osm_sa_informinfo.c: Fix infr_rcv_respond to only copy InformInfo
+
+Wed Jan 23 13:53:37 2013 +0200 Hal Rosenstock
+f1186689d416198cd84b2899cf619ad57a5df6a3
+
+	* opensm/osm_sa: Improve SA record response handling (osm_sa_respond)
+
+Wed Jul 25 06:40:06 2012 -0400 Hal Rosenstock
+b09ac65a7757711b5eaf56712df6b1c4afa773fb
+
+	* opensm/osm_sa_informinfo.c: Add trusted support for InformInfo/InformInfoRecord
+
+Tue Feb 5 17:29:48 2013 +0200 Alex Netes
+3a87fa2d6a3c81174198629295f9317a34544177
+
+	* opensm/osm_req.c: fix first sweep m_key search algorithm
+
+Tue Jan 29 19:18:50 2013 +0200 Alex Netes
+5fdb0b91601ff2506578b0dd7363ad6050c9e1b2
+
+	* opensm/configure.in: Remove Default-Start from opensmd init script
+
+Mon Feb 4 16:02:01 2013 +0200 Alex Netes
+b9661000fd939cf7ea67261398779626a7d4019a
+
+	* opensm/osm_sm_state_mgr.c: Start sweep immedeately when recieving HANDOVER in DISCOVERING state
+
+Sun Nov 25 18:19:44 2012 +0200 Alex Netes
+4349c07d15df9f59ca5c86228c08c6390e679151
+
+	* opensm: Add physp_p discovery count support
+
+Tue Dec 11 14:12:10 2012 +0200 Alex Netes
+d706cbf2ead6953151400faa7c808050bb8806cf
+
+	* opensm/osm_sm_mad_ctrl.c: Upon receiving trap repress we should decrease qp0_mads_outstanding_on_wire
+
+Thu May 10 09:33:31 2012 +0200 Vincent Ficet
+9cbb8af93ec4b67bfc2f7e20d516ec8172f9870f
+
+	* opensm/osm_ucast_ftree.c: fix opensm segfault in osm_ucast_ftree.c
+
+Mon Feb 4 12:24:39 2013 +0200 Alex Netes
+e1e470681f1beb26b86b73ed6bd7fb2fae386d19
+
+	* opensm: Revert "opensm/osm_ucast_ftree: When roots are not connected, update hop count but not lft"
+
+Wed Dec 19 15:39:01 2012 +0200 Alex Netes
+d2312af6e312dbd5ad10edeb0b7648bf45c21992
+
+	* opensm/osm_link_mgr.c: Fix sending PortInfo(Set) with AM SMSupportExtendedSpeeds bit set for switch base port 0
+
+Wed Dec 19 11:21:11 2012 +0200 Alex Netes
+06ae82c66fcdb50236987c07d13e1af3a2094c53
+
+	* opensm/osm_link_mgr.c: Set AM SMSupportExtendedSpeeds bit if port supports ExtPortInfo
+
+Thu Jan 3 15:33:58 2013 +0200 Shlomi Nimrodi
+b2cd2d7308a84e0c3dde2639c2f74b9127dca4f5
+
+	* opensm/osm_ucast_ftree.c: Fix unranked nodes bug in FTree
+
+Wed Jan 9 17:30:44 2013 +0200 Alex Netes
+7a49366ea2f08fbf01145853536925457bcd3c56
+
+	* opensm: Changed #if to #ifdef when using ENABLE_OSM_PERF_MGR_PROFILE
+
+Tue Jan 15 10:26:30 2013 +0200 Ilya Nelkenbaum
+1cf0bb972094c6e590ad9137a752f9576cd5a5b5
+
+	* opensm/osm_congestion_control.c: fix use-after-free found by coverity
+
+Wed Jan 16 11:06:44 2013 +0200 Shlomi Nimrodi
+edd0552d1d11ffe9d348327c340d2a8ce0102f9c
+
+	* opensm/osm_qos_policy.c: fix segmentation fault on osm_qos_policy_match_rule_destroy (osm_qos_policy.c)
+
+Wed Jan 16 21:54:57 2013 +0200 Hal Rosenstock
+34af1a57b472d76297289b2716a7ce43ee5ef3e2
+
+	* opensm/osm_torus.c: torus routing should fail with VLCap 1 on switch external ports
+
+Mon Jan 14 15:31:42 2013 +0200 Hal Rosenstock
+2b8940ba8c251b9055c4505a5638a295cff19f0f
+
+	* opensm/osm_torus.c: In dump_torus, make sure switch is present before dumping
+
+Fri Nov 9 13:55:24 2012 -0800 Albert Chu
+2364e8e185ab2814cb0c642994f9c490e271cfec
+
+	* opensm: Add better error output when parsing node name maps
+
+Fri Jan 25 08:07:34 2013 -0500 Hal Rosenstock
+7204287ed84bca90a4aebf67a87ddb6f1a2f6a90
+
+	* opensm/osm_sa_mcmember_record.c: Only use scope from MC group in copy_from_create_mc_rec
+
+Thu Jan 24 09:45:48 2013 -0500 Hal Rosenstock
+4eb0f694c7a68b08865e826f092137b5c2011d17
+
+	* opensm/osm_dump.c: Remove incorrect assert
+
+Wed Jan 23 01:42:04 2013 +0900 Jens Domke
+1ddb44b612cd29830e9589a5265801bdddb49cda
+
+	* OpenSM: dfsssp - moved paths from one to another VL might be counted multiple times
+
+Wed Jan 23 01:41:47 2013 +0900 Jens Domke
+a0a9eeafb11bb639696bd84f3fdd213e51b6ee2a
+
+	* OpenSM: DFSSSP does not find LIDs due to wrong byte order (v2)
+
+Wed Jan 23 01:41:31 2013 +0900 Jens Domke
+13fd9522bbc5f98e13b988ffddcf35d784dcbc2d
+
+	* OpenSM: dfsssp - avoid unnecessary nested loop in vltable_print for OSM_LOG_INFO
+
+Wed Jan 23 01:41:07 2013 +0900 Jens Domke
+1cbed64100d6382b08cc4a19ee1422d7bc524d77
+
+	* OpenSM: dfsssp - change the port traversal for sssp
+
+Wed Jan 23 01:40:49 2013 +0900 Jens Domke
+c2f0bb97afd0eef149e70ddf569a2788d43f33de
+
+	* OpenSM: dfsssp - add support for base/enhanced switch port
+
+Wed Jan 23 01:40:29 2013 +0900 Jens Domke
+64873fff7a9b28b1cfebd5872260d41899f7561e
+
+	* OpenSM: dfsssp ignores differences in the lmc value
+
+Wed Jan 23 01:40:07 2013 +0900 Dan Ben Yosef
+ab5af498c76f4dd38b0dbb3a0b469b72987a7c9a
+
+	* opensm/osm_ucast_dfsssp.c : fix dereference before null check
+
+Wed Jan 23 01:39:42 2013 +0900 Dan Ben Yosef
+b6a2f6aefbb1bce1b5365e01a2986c8a6b6e034a
+
+	* opensm/osm_ucast_dfsssp.c : fix dereference null return value
+
+Wed Jan 23 01:39:13 2013 +0900 Dan Ben Yosef
+e9cc52302a2475ab820cb2cf63bba4209fd96b45
+
+	* opensm/osm_ucast_dfsssp.c : Fix resource leak
+
+Wed Jan 23 01:38:18 2013 +0900 Jens Domke
+dec11095c30d082273a126cc73ef33f568aef4a2
+
+	* DFSSSP: fix a memory leak in dfsssp_build_graph
+
+Mon Nov 12 11:51:09 2012 -0800 Ira Weiny
+df66c1fa0783940fee61b2402038a5c755206689
+
+	* opensm: Fix incorrect use of sizeof
+
+Mon Dec 3 10:25:21 2012 -0500 Hal Rosenstock
+162493efd0bed6c3c9cb53bcf106525b2a4d9122
+
+	* opensm/osm_req.c: In req_determine_mkey, use osm_physp APIs
+
+Mon Dec 3 10:25:12 2012 -0500 Hal Rosenstock
+d5fe52812175f9dbbaf7608805142b5620418d62
+
+	* opensm/osm_req.c: In req_determine_mkey, fix DR algorithm
+
+Mon Jan 7 14:50:42 2013 -0500 Hal Rosenstock
+fc53bdc19b548912b4739fb2ab59e9ca5a931fbc
+
+	* opensm/osm_torus.c: Dump torus when OSM_LOG_ROUTING specified
+
+Mon Jan 7 14:50:31 2013 -0500 Hal Rosenstock
+434afa6505f608739be37d3e42c090e8d557297d
+
+	* opensm/torus: Add configuration for max_changes to report
+
+Mon Jan 7 14:50:23 2013 -0500 Hal Rosenstock
+35bcddf6f7ec80de40d850229efd3d4c8bb3088b
+
+	* opensm/osm_torus.c: Consolidate some parsing with parse_unsigned
+
+Wed Dec 19 14:16:47 2012 -0500 Hal Rosenstock
+3f3d26faf686535f0e8091502079c22e37348e46
+
+	* opensm/osm_prtn_config.c: Insert autogenerated pkey into MGID for IPoIB
+
+Mon Dec 17 11:55:31 2012 -0500 Hal Rosenstock
+c58a416ff1fd43cf3b06fc59384cc0973d7b7c6c
+
+	* opensm/osm_dump.c: Fix output port on SL2VL table for non switch nodes
+
+Mon Dec 17 11:55:27 2012 -0500 Hal Rosenstock
+8af5bce91b4692c0b7b2e4f8aff22e4d9de564d5
+
+	* opensm/osm_sa_slvl_record.c: Fix out port for CAs and routers
+
+Mon Dec 17 11:55:21 2012 -0500 Hal Rosenstock
+18a77f9efed31bb15e3a5a1644828d8e464e66c6
+
+	* opensm/osm_torus.c: Fix memory leak
+
+Sun Dec 9 02:54:57 2012 -0800 Garrett Cooper
+4ccbdc1901766509bfac3e4aa5c75065b5892687
+
+	* Fix -Wformat-security warnings with clang
+
+Sun Dec 9 12:14:12 2012 -0800 Garrett Cooper
+c7623891d879b37716d71e06364c872fd1ce09a7
+
+	* Fix -Wtautological-compare warnings with clang
+
+Tue Dec 11 02:09:13 2012 -0800 Garrett Cooper
+9e6dd8fc905917a10d43ec480def4dbec19e6bae
+
+	* Fix linker error with clang with -O < 2
+
+Mon Dec 3 16:26:08 2012 -0500 Hal Rosenstock
+d80ca1e892ef87bf11a410419995cc3433da30b0
+
+	* opensm/osm_port_info_rcv.c: Don't modify subnet minimal values when PortState DOWN
+
+Mon Dec 3 16:25:30 2012 -0500 Hal Rosenstock
+8384156f077c7d09d5864404e72cee547121a83b
+
+	* opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb
+
+Mon Dec 3 10:26:07 2012 -0500 Hal Rosenstock
+f97a2e9873d1a3beb22a7206720ca36d19c3c4ff
+
+	* opensm/osm_ucast_ftree.c: Eliminate unneeded NULL pointer checks prior to calls to free
+
+Mon Dec 3 10:25:57 2012 -0500 Hal Rosenstock
+8a77f23540ff995a3193edceadc82688702b6c6e
+
+	* opensm/osm_ucast_ftree.c: Remove duplicate free in fabric_create_leaf_switch_array
+
+Mon Dec 3 10:25:39 2012 -0500 Hal Rosenstock
+338a67b4f7c3dde3b353f2d7b863e71dfbcec0df
+
+	* opensm/osm_subnet.c: Improve error messages in subn_validate_neighbor
+
+Mon Dec 3 10:25:04 2012 -0500 Hal Rosenstock
+0a1c9bf43745e390d7edf9e254efb932a3299bde
+
+	* opensm/osm_req.c: In req_determine_mkey, add more info when ERR 1107 occurs
+
+Thu Nov 29 14:11:42 2012 -0500 Hal Rosenstock
+b974ca301d960a2de7eb71a844823942eca8b306
+
+	* opensm/osm_torus.c: Improve some misconfiguration error messages
+
+Wed Nov 28 14:03:44 2012 -0500 Hal Rosenstock
+e986d57d58fcb7d58dde0df30cd1006e3fd4b799
+
+	* opensm/osm_torus.c: Minor simplification to check_qos_config
+
+Wed Nov 28 14:03:39 2012 -0500 Hal Rosenstock
+95b6f8345c1ac9aa4eb058dcb11c5960a91944ae
+
+	* opensm: Update doc for changes to torus routing for, endport support
+
+Wed Nov 28 14:03:33 2012 -0500 Hal Rosenstock
+998fb4383dc4c49b595545a2e54f35108e9d4fd7
+
+	* opensm/osm_torus.c: Add copyright
+
+Wed Nov 28 14:03:26 2012 -0500 Hal Rosenstock
+268d327559d5a7bdf235c463c8c4489e32867221
+
+	* opensm/osm_torus.c: Improve QoS configuration
+
+Wed Nov 28 14:03:19 2012 -0500 Hal Rosenstock
+d1d2de57c34997b8d29f069e4631a484ce371ea2
+
+	* opensm: Update doc for changes to torus routing for CA, support
+
+Wed Nov 28 14:03:11 2012 -0500 Hal Rosenstock
+a362b5bae31664b9d1bee8f8cc31276656ae4b3f
+
+	* opensm/osm_torus.c: Require only 2 data VLs supported (PortInfo.VLCap) and use VLs 0-1 on CA links
+
+Wed Nov 28 14:03:01 2012 -0500 Hal Rosenstock
+3f536aea6bb3645545b9c53b7381928b28d0e121
+
+	* opensm: Add routing specific update_vlarb hook routine
+
+Wed Nov 28 14:02:54 2012 -0500 Hal Rosenstock
+27da5eb71981c750ba4eabb0ce246b394597d52f
+
+	* opensm/include/osm_opensm.h: Fix commentary typo
+
+Fri Nov 9 08:36:46 2012 -0500 Hal Rosenstock
+a2415f37a18808ccab18e37c4285a1b972376b34
+
+	* Add Per Module Logging support for Congestion Manager
+
+Tue Jan 15 17:40:09 2013 -0800 Ira Weiny
+a6d36947064d775a0acf137346e75d3c08c86a21
+
+	* opensm: clean up error message, function name is printed by logging code
+
+Fri Jan 11 14:33:56 2013 -0500 Hal Rosenstock
+2cf80781aa91da7d119a6486d01a0656980fee8a
+
+	* opensm/osm_sa_mcmember_record.c: Return proper scope for query with valid SA key
+
+Mon Jan 7 14:50:53 2013 -0500 Hal Rosenstock
+b9067ba9cb90a6817e4929eca97f1a87f045af8b
+
+	* opensm/include/complib/cl_packon.h: Fix some commentary typos
+
+Thu Nov 8 10:32:59 2012 -0800 Albert Chu
+e522f749854d64dc2c95def7d90f6a8bb20b993c
+
+	* opensm/osm_perfmgr_db.c: Fix output error due to possible 32bit int overflow
+
+Thu Nov 8 08:22:37 2012 -0800 Ira Weiny
+c1a206e25351129e6ec014d872451f04c21b4a28
+
+	* opensm: update performance manager documentation
+
+Mon Oct 29 16:45:02 2012 -0700 Albert Chu
+f204e9c9e9843cf0a2ef98a294d506f5f1cead84
+
+	* opensm: Protect against spurious wakeups when calling cl_event_wait_on
+
+Mon Oct 29 16:44:59 2012 -0700 Albert Chu
+6f94c4c7bd0cfb16101c8680bcb515ac99839ff3
+
+	* opensm: Fix signed vs unsigned int comparison
+
+Wed Oct 24 18:26:27 2012 +0200 Alex Netes
+7db5c7521998f6d2f93986bcc245348d9886657d
+
+	* opensm/osm_subnet.c: Only parameters that marked with can_update flag should be updated during conf file rescan
+
+Thu Oct 25 11:59:38 2012 +0200 Bart Van Assche
+282714a6f3e0e48eede83e0922515df3fc9fb497
+
+	* /etc/init.d/opensmd: Improve systemd integration
+
+Wed Oct 24 09:42:24 2012 -0400 Hal Rosenstock
+2ea2cf366beac1592f35374ff2cfac58b7bba7c0
+
+	* opensm/osm_vl15intf.c: Fix commentary typo
+
+Wed Oct 24 09:42:11 2012 -0400 Hal Rosenstock
+8b116d7c67276e682071ab3117e7f4b2c753d54d
+
+	* opensm/osm_trap_rcv.c: Eliminate unneeded trap_rcv_process_response routine
+
+Wed Oct 24 09:42:01 2012 -0400 Hal Rosenstock
+f396936682083f351adc7812f42020106184ce30
+
+	* opensm/complib/cl_atomic_osd.h: Fix long standing bug in cl_atomic_sub
+
+Fri Sep 21 16:46:12 2012 +0200 Bart Van Assche
+4008c2fe8cf50931d69e5618358aa6537e9ddb8e
+
+	* opensm.spec.in: Improve portability
+
+Fri Sep 21 16:43:03 2012 +0200 Bart Van Assche
+01ab74450fd1227cf2dfb9219ffd697d3beb4a45
+
+	* Make it possible to enable opensm with chkconfig
+
+Fri Sep 21 16:42:04 2012 +0200 Bart Van Assche
+c68ae6319211d462734b5e5c88401768d02bddf0
+
+	* Add command-line option --pidfile
+
+Wed Oct 10 19:40:13 2012 -0400 Hal Rosenstock
+ffb9a8227ee2e98c16ca2d19d2c840a32c8dcaef
+
+	* opensm/osm_torus.c: Check fabric minimum data VLs on switch external ports
+
+Wed Oct 10 19:40:09 2012 -0400 Hal Rosenstock
+d0258f3cede60c321077697469bf247820e6087f
+
+	* opensm: Track minimum value in the fabric for data VLs supported on switch external ports
+
+Wed Oct 10 19:40:05 2012 -0400 Hal Rosenstock
+36159c2f925f52eee76cc568f1f11acf0808a3fc
+
+	* opensm/osm_torus.c: Cosmetic formatting change
+
+Wed Oct 3 19:57:54 2012 -0400 Hal Rosenstock
+dba3f9289d4277f67474e75cfe5979a6cc74487c
+
+	* opensm/osm_helper.c: Add some missing new lines to log message output
+
+Wed Oct 3 19:57:46 2012 -0400 Hal Rosenstock
+94468b5462b20f86e0e9e8cc62a7418aef7f5520
+
+	* opensm/osm_ucast_updn.c: Add error codes to a couple of log messages
+
+Thu Sep 20 18:27:57 2012 +0200 Bart Van Assche
+86a203b86dcc64c868f281cb45e5cb67c0fde17a
+
+	* Correct option names in opensm man page
+
+Thu Sep 20 15:01:04 2012 +0300 Yevgeny Kliteynik
+dae214fcb4429c05a50849d7a34f2afaaef3466b
+
+	* opensm/osm_log.h: fix function documentation
+
+Tue Sep 18 14:53:33 2012 -0400 Hal Rosenstock
+34824382bdf7242e95f02ca3647608d99960d3e6
+
+	* opensm/osm_sa.h: Cosmetic commentary change
+
+Tue Sep 18 14:53:28 2012 -0400 Hal Rosenstock
+824e1f0b05740ac80d324a25ab53b48e6a91b2fe
+
+	* opensm/ib_types.h: Commentary and cosmetic formatting change
+
+Tue Sep 18 14:53:21 2012 -0400 Hal Rosenstock
+3711e8a4a42b284cf1c517695526a3bbee026ced
+
+	* opensm/complib/cl_spinlock.h: Remove some unimplemented routines
+
+Tue Sep 18 14:53:10 2012 -0400 Hal Rosenstock
+0c3f57fe921159c88b760231ce8bca48578c4430
+
+	* opensm/osm_torus.c: Add error code to error log message
+
+Tue Sep 11 16:15:53 2012 +0200 Bart Van Assche
+8e6dfbd0b9284fe0083b3f378ec313c3acfb060c
+
+	* opensm: Add .gitignore
+
+Tue Sep 11 18:33:31 2012 +0300 Yevgeny Kliteynik
+62484956a890b81fc0de592e959e156f5067f0d1
+
+	* opensm/osm_port_info_rcv.c: use PF() hint on fatal conditions
+
+Tue Sep 11 18:32:11 2012 +0300 Yevgeny Kliteynik
+dff59276cdf1a6f158e4d2f6c277508cb1efda02
+
+	* opensm/osm_port_info_rcv.c: check received local_port_num
+
+Tue Sep 11 18:29:52 2012 +0300 Yevgeny Kliteynik
+b7b1505ddfae733cfc088d1cd4f49529666d17af
+
+	* opensm/libvendor/osm_vendor_ibumad.c: validate response MAD properties
+
+Tue Sep 11 18:29:07 2012 +0300 Yevgeny Kliteynik
+c215eea1235771ee50b0b9f65d988a9d8d5cdb1b
+
+	* opensm/libvendor/osm_vendor_ibumad.c:rename "mad" to "p_mad" to indicate pointer
+
+Tue Sep 11 18:28:23 2012 +0300 Yevgeny Kliteynik
+e00f67bc9fe79cce4c6c5be9701e284373071194
+
+	* opensm/libvendor/osm_vendor_ibumad_sa.c: use wrapper function instead of direct access
+
+Tue Sep 11 18:26:55 2012 +0300 Yevgeny Kliteynik
+ebc772c89f638c406a5a16915151845c38a0832c
+
+	* opensm/osm_node_info_rcv.c: using "PF" hint for all the fatal conditions
+
+Tue Sep 11 18:25:49 2012 +0300 Yevgeny Kliteynik
+e2f06cdde6a8ed3037c5740a4b0298c7d565589c
+
+	* opensm/complib: define macros for for "if" statements with branch prediction hints
+
+Tue Sep 11 18:24:30 2012 +0300 Yevgeny Kliteynik
+0e33c113f5980133f95cc86b16a18e1eb7ff120a
+
+	* opensm/configure.in: check that compiler supports __builtin_expect()
+
+Wed Sep 5 13:02:23 2012 -0400 Hal Rosenstock
+606157c06fae69dd7b63af36d5eb722ecb827ce9
+
+	* osmtest/osmt_multicast.c: Fix 02BF error
+
+Tue Sep 4 08:18:53 2012 -0400 Hal Rosenstock
+2cb1854f51015b929331c1608a2cc86ab868594b
+
+	* OpenSM: Add new Mellanox OUI
+
+Tue Sep 11 16:19:17 2012 +0200 Bart Van Assche
+8e5fc5770903ba12804831dad3e9bfdcfbd80531
+
+	* opensm: osm_pkey: Remove unused variables
+
+Wed Aug 29 10:40:32 2012 -0700 Albert Chu
+e96a9334c9d14261430b6fd93ce5c282bd21fd65
+
+	* opensm: Manage ports that do not support congestion control
+
+Wed Jul 18 17:07:59 2012 +0300 Daniel Klein
+fbb74cae98063d45473f00f053961ecf872ffac0
+
+	* opensm: improve search common pkeys.
+
+Tue Aug 28 14:10:18 2012 -0400 Hal Rosenstock
+03d55f611025ee933d8ef13f4ad2a57117a5a0dc
+
+	* opensm/osm_sw_info_rcv.c: Fixed locking issue on osm_get_node_by_guid error
+
+Sun Aug 26 15:19:10 2012 +0300 Alex Netes
+21084319505d8bd29f470407efe23961e2ff408c
+
+	* opensm: fix default cc_max_outstanding_mads assignment
+
+Thu Aug 9 02:27:51 2012 -0400 Hal Rosenstock
+db34e30a172de1e2c054b2fa4cca4d6d75e3840f
+
+	* opensm/osm_vendor_ibumad.c: Add management class to error log message
+
+Sun Aug 12 09:44:33 2012 +0300 Alex Netes
+a46b33e33cad38bec99d2faf63a765a9238413e9
+
+	* opensm: fix crash in DFSSSP routing engine on reroute
+
+Tue Jul 17 11:50:41 2012 -0700 Ira Weiny
+ba36f8156df2dc6396231ede9f3ae86c7455afa3
+
+	* opensm/perfmgr/console: add 'pm sweep'
+
 ** Version: opensm-3.3.15
 
 Thu Aug 2 11:56:48 2012 +0300 Alex Netes
diff --git a/Makefile.in b/Makefile.in
index 412454d..6d9caa7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -49,8 +49,12 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	config/depcomp config/install-sh config/ltmain.sh \
 	config/missing config/ylwrap
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
-	$(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+	$(top_srcdir)/config/ltoptions.m4 \
+	$(top_srcdir)/config/ltsugar.m4 \
+	$(top_srcdir)/config/ltversion.m4 \
+	$(top_srcdir)/config/lt~obsolete.m4 \
+	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -93,12 +97,6 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
 man5dir = $(mandir)/man5
 am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"
 man8dir = $(mandir)/man8
@@ -115,11 +113,9 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
 am__remove_distdir = \
-  if test -d "$(distdir)"; then \
-    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
-      && rm -rf "$(distdir)" \
-      || { sleep 5 && rm -rf "$(distdir)"; }; \
-  else :; fi
+  { test ! -d "$(distdir)" \
+    || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr "$(distdir)"; }; }
 am__relativize = \
   dir0=`pwd`; \
   sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@@ -148,8 +144,6 @@ am__relativize = \
 DIST_ARCHIVES = $(distdir).tar.gz
 GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
-am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
-  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -165,9 +159,10 @@ CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
+DEFAULT_START = @DEFAULT_START@
+DEFAULT_STOP = @DEFAULT_STOP@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -194,7 +189,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -221,6 +215,7 @@ PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
+RDMA_SERVICE = @RDMA_SERVICE@
 RELEASE = @RELEASE@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -237,7 +232,6 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -270,6 +264,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -300,7 +295,7 @@ EXTRA_DIST = autogen.sh opensm.spec $(various_scripts) $(man_MANS) $(docs)
 all: all-recursive
 
 .SUFFIXES:
-am--refresh: Makefile
+am--refresh:
 	@:
 $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
@@ -336,8 +331,10 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 
 include/opensm/osm_config.h: include/opensm/stamp-h2
-	@if test ! -f $@; then rm -f include/opensm/stamp-h2; else :; fi
-	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) include/opensm/stamp-h2; else :; fi
+	@if test ! -f $@; then \
+	  rm -f include/opensm/stamp-h2; \
+	  $(MAKE) $(AM_MAKEFLAGS) include/opensm/stamp-h2; \
+	else :; fi
 
 include/opensm/stamp-h2: $(top_srcdir)/include/opensm/osm_config.h.in $(top_builddir)/config.status
 	@rm -f include/opensm/stamp-h2
@@ -409,7 +406,9 @@ uninstall-man5:
 	  sed -n '/\.5[a-z]*$$/p'; \
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
-	dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir)
+	test -z "$$files" || { \
+	  echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \
+	  cd "$(DESTDIR)$(man5dir)" && rm -f $$files; }
 install-man8: $(man_MANS)
 	@$(NORMAL_INSTALL)
 	test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
@@ -445,7 +444,9 @@ uninstall-man8:
 	  sed -n '/\.8[a-z]*$$/p'; \
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
-	dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
+	test -z "$$files" || { \
+	  echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \
+	  cd "$(DESTDIR)$(man8dir)" && rm -f $$files; }
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -670,11 +671,7 @@ dist-gzip: distdir
 	$(am__remove_distdir)
 
 dist-bzip2: distdir
-	tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
-	$(am__remove_distdir)
-
-dist-lzip: distdir
-	tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
 	$(am__remove_distdir)
 
 dist-lzma: distdir
@@ -682,7 +679,7 @@ dist-lzma: distdir
 	$(am__remove_distdir)
 
 dist-xz: distdir
-	tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+	tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
 	$(am__remove_distdir)
 
 dist-tarZ: distdir
@@ -713,8 +710,6 @@ distcheck: dist
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lzma*) \
 	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
-	*.tar.lz*) \
-	  lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
 	*.tar.xz*) \
 	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
 	*.tar.Z*) \
@@ -724,7 +719,7 @@ distcheck: dist
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac
-	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	chmod -R a-w $(distdir); chmod u+w $(distdir)
 	mkdir $(distdir)/_build
 	mkdir $(distdir)/_inst
 	chmod a-w $(distdir)
@@ -734,7 +729,6 @@ distcheck: dist
 	  && am__cwd=`pwd` \
 	  && $(am__cd) $(distdir)/_build \
 	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
-	    $(AM_DISTCHECK_CONFIGURE_FLAGS) \
 	    $(DISTCHECK_CONFIGURE_FLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) \
 	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
@@ -763,16 +757,8 @@ distcheck: dist
 	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
 	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
-	@test -n '$(distuninstallcheck_dir)' || { \
-	  echo 'ERROR: trying to run $@ with an empty' \
-	       '$$(distuninstallcheck_dir)' >&2; \
-	  exit 1; \
-	}; \
-	$(am__cd) '$(distuninstallcheck_dir)' || { \
-	  echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
-	  exit 1; \
-	}; \
-	test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+	@$(am__cd) '$(distuninstallcheck_dir)' \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
 	   || { echo "ERROR: files left after uninstall:" ; \
 	        if test -n "$(DESTDIR)"; then \
 	          echo "  (check DESTDIR support)"; \
@@ -806,15 +792,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
@@ -905,20 +886,20 @@ uninstall-man: uninstall-man5 uninstall-man8
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
 	all all-am am--refresh check check-am clean clean-generic \
 	clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
-	dist-gzip dist-hook dist-lzip dist-lzma dist-shar dist-tarZ \
-	dist-xz dist-zip distcheck distclean distclean-generic \
-	distclean-hdr distclean-libtool distclean-tags distcleancheck \
-	distdir distuninstallcheck dvi dvi-am html html-am info \
-	info-am install install-am install-data install-data-am \
-	install-dvi install-dvi-am install-exec install-exec-am \
-	install-exec-hook install-html install-html-am install-info \
-	install-info-am install-man install-man5 install-man8 \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
-	ps ps-am tags tags-recursive uninstall uninstall-am \
-	uninstall-man uninstall-man5 uninstall-man8
+	dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
+	dist-zip distcheck distclean distclean-generic distclean-hdr \
+	distclean-libtool distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-exec-hook \
+	install-html install-html-am install-info install-info-am \
+	install-man install-man5 install-man8 install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs installdirs-am \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-recursive uninstall uninstall-am uninstall-man \
+	uninstall-man5 uninstall-man8
 
 
 # we should provide a hint for other apps about the build mode of this project
diff --git a/aclocal.m4 b/aclocal.m4
index 53bf10f..9545e03 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
+# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -14,8612 +13,18 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
-# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-#
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-m4_define([_LT_COPYING], [dnl
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-])
-
-# serial 57 LT_INIT
-
-
-# LT_PREREQ(VERSION)
-# ------------------
-# Complain and exit if this libtool version is less that VERSION.
-m4_defun([LT_PREREQ],
-[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
-       [m4_default([$3],
-		   [m4_fatal([Libtool version $1 or higher is required],
-		             63)])],
-       [$2])])
-
-
-# _LT_CHECK_BUILDDIR
-# ------------------
-# Complain if the absolute build directory name contains unusual characters
-m4_defun([_LT_CHECK_BUILDDIR],
-[case `pwd` in
-  *\ * | *\	*)
-    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
-esac
-])
-
-
-# LT_INIT([OPTIONS])
-# ------------------
-AC_DEFUN([LT_INIT],
-[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
-AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
-AC_BEFORE([$0], [LT_LANG])dnl
-AC_BEFORE([$0], [LT_OUTPUT])dnl
-AC_BEFORE([$0], [LTDL_INIT])dnl
-m4_require([_LT_CHECK_BUILDDIR])dnl
-
-dnl Autoconf doesn't catch unexpanded LT_ macros by default:
-m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
-m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
-dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
-dnl unless we require an AC_DEFUNed macro:
-AC_REQUIRE([LTOPTIONS_VERSION])dnl
-AC_REQUIRE([LTSUGAR_VERSION])dnl
-AC_REQUIRE([LTVERSION_VERSION])dnl
-AC_REQUIRE([LTOBSOLETE_VERSION])dnl
-m4_require([_LT_PROG_LTMAIN])dnl
-
-_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
-
-dnl Parse OPTIONS
-_LT_SET_OPTIONS([$0], [$1])
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-_LT_SETUP
-
-# Only expand once:
-m4_define([LT_INIT])
-])# LT_INIT
-
-# Old names:
-AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
-AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
-dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
-
-
-# _LT_CC_BASENAME(CC)
-# -------------------
-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
-m4_defun([_LT_CC_BASENAME],
-[for cc_temp in $1""; do
-  case $cc_temp in
-    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
-    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
-])
-
-
-# _LT_FILEUTILS_DEFAULTS
-# ----------------------
-# It is okay to use these file commands and assume they have been set
-# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
-m4_defun([_LT_FILEUTILS_DEFAULTS],
-[: ${CP="cp -f"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-])# _LT_FILEUTILS_DEFAULTS
-
-
-# _LT_SETUP
-# ---------
-m4_defun([_LT_SETUP],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
-
-_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
-dnl
-_LT_DECL([], [host_alias], [0], [The host system])dnl
-_LT_DECL([], [host], [0])dnl
-_LT_DECL([], [host_os], [0])dnl
-dnl
-_LT_DECL([], [build_alias], [0], [The build system])dnl
-_LT_DECL([], [build], [0])dnl
-_LT_DECL([], [build_os], [0])dnl
-dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-dnl
-AC_REQUIRE([AC_PROG_LN_S])dnl
-test -z "$LN_S" && LN_S="ln -s"
-_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
-dnl
-AC_REQUIRE([LT_CMD_MAX_LEN])dnl
-_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
-_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
-dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
-m4_require([_LT_CMD_RELOAD])dnl
-m4_require([_LT_CHECK_MAGIC_METHOD])dnl
-m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
-m4_require([_LT_CMD_OLD_ARCHIVE])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_WITH_SYSROOT])dnl
-
-_LT_CONFIG_LIBTOOL_INIT([
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-])
-if test -n "${ZSH_VERSION+set}" ; then
-   setopt NO_GLOB_SUBST
-fi
-
-_LT_CHECK_OBJDIR
-
-m4_require([_LT_TAG_COMPILER])dnl
-
-case $host_os in
-aix3*)
-  # AIX sometimes has problems with the GCC collect2 program.  For some
-  # reason, if we set the COLLECT_NAMES environment variable, the problems
-  # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
-    COLLECT_NAMES=
-    export COLLECT_NAMES
-  fi
-  ;;
-esac
-
-# Global variables:
-ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-
-with_gnu_ld="$lt_cv_prog_gnu_ld"
-
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-
-# Set sane defaults for various variables
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$LD" && LD=ld
-test -z "$ac_objext" && ac_objext=o
-
-_LT_CC_BASENAME([$compiler])
-
-# Only perform the check for file, if the check method requires it
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    _LT_PATH_MAGIC
-  fi
-  ;;
-esac
-
-# Use C for the default configuration in the libtool script
-LT_SUPPORTED_TAG([CC])
-_LT_LANG_C_CONFIG
-_LT_LANG_DEFAULT_CONFIG
-_LT_CONFIG_COMMANDS
-])# _LT_SETUP
-
-
-# _LT_PREPARE_SED_QUOTE_VARS
-# --------------------------
-# Define a few sed substitution that help us do robust quoting.
-m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
-[# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-])
-
-# _LT_PROG_LTMAIN
-# ---------------
-# Note that this code is called both from `configure', and `config.status'
-# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
-# `config.status' has no value for ac_aux_dir unless we are using Automake,
-# so we pass a copy along to make sure it has a sensible value anyway.
-m4_defun([_LT_PROG_LTMAIN],
-[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
-_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
-ltmain="$ac_aux_dir/ltmain.sh"
-])# _LT_PROG_LTMAIN
-
-
-
-# So that we can recreate a full libtool script including additional
-# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
-# in macros and then make a single call at the end using the `libtool'
-# label.
-
-
-# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
-# ----------------------------------------
-# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL_INIT],
-[m4_ifval([$1],
-          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
-                     [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_INIT])
-
-
-# _LT_CONFIG_LIBTOOL([COMMANDS])
-# ------------------------------
-# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL],
-[m4_ifval([$1],
-          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
-                     [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
-
-
-# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
-# -----------------------------------------------------
-m4_defun([_LT_CONFIG_SAVE_COMMANDS],
-[_LT_CONFIG_LIBTOOL([$1])
-_LT_CONFIG_LIBTOOL_INIT([$2])
-])
-
-
-# _LT_FORMAT_COMMENT([COMMENT])
-# -----------------------------
-# Add leading comment marks to the start of each line, and a trailing
-# full-stop to the whole comment if one is not present already.
-m4_define([_LT_FORMAT_COMMENT],
-[m4_ifval([$1], [
-m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
-              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
-)])
-
-
-
-
-
-# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
-# -------------------------------------------------------------------
-# CONFIGNAME is the name given to the value in the libtool script.
-# VARNAME is the (base) name used in the configure script.
-# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
-# VARNAME.  Any other value will be used directly.
-m4_define([_LT_DECL],
-[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
-    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
-	[m4_ifval([$1], [$1], [$2])])
-    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
-    m4_ifval([$4],
-	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
-    lt_dict_add_subkey([lt_decl_dict], [$2],
-	[tagged?], [m4_ifval([$5], [yes], [no])])])
-])
-
-
-# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
-# --------------------------------------------------------
-m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
-
-
-# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_tag_varnames],
-[_lt_decl_filter([tagged?], [yes], $@)])
-
-
-# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
-# ---------------------------------------------------------
-m4_define([_lt_decl_filter],
-[m4_case([$#],
-  [0], [m4_fatal([$0: too few arguments: $#])],
-  [1], [m4_fatal([$0: too few arguments: $#: $1])],
-  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
-  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
-  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
-])
-
-
-# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
-# --------------------------------------------------
-m4_define([lt_decl_quote_varnames],
-[_lt_decl_filter([value], [1], $@)])
-
-
-# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_dquote_varnames],
-[_lt_decl_filter([value], [2], $@)])
-
-
-# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_varnames_tagged],
-[m4_assert([$# <= 2])dnl
-_$0(m4_quote(m4_default([$1], [[, ]])),
-    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
-    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
-m4_define([_lt_decl_varnames_tagged],
-[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
-
-
-# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_all_varnames],
-[_$0(m4_quote(m4_default([$1], [[, ]])),
-     m4_if([$2], [],
-	   m4_quote(lt_decl_varnames),
-	m4_quote(m4_shift($@))))[]dnl
-])
-m4_define([_lt_decl_all_varnames],
-[lt_join($@, lt_decl_varnames_tagged([$1],
-			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
-])
-
-
-# _LT_CONFIG_STATUS_DECLARE([VARNAME])
-# ------------------------------------
-# Quote a variable value, and forward it to `config.status' so that its
-# declaration there will have the same value as in `configure'.  VARNAME
-# must have a single quote delimited value for this to work.
-m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
-
-
-# _LT_CONFIG_STATUS_DECLARATIONS
-# ------------------------------
-# We delimit libtool config variables with single quotes, so when
-# we write them to config.status, we have to be sure to quote all
-# embedded single quotes properly.  In configure, this macro expands
-# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
-#
-#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
-m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
-    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAGS
-# ----------------
-# Output comment and list of tags supported by the script
-m4_defun([_LT_LIBTOOL_TAGS],
-[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
-available_tags="_LT_TAGS"dnl
-])
-
-
-# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
-# -----------------------------------
-# Extract the dictionary values for VARNAME (optionally with TAG) and
-# expand to a commented shell variable setting:
-#
-#    # Some comment about what VAR is for.
-#    visible_name=$lt_internal_name
-m4_define([_LT_LIBTOOL_DECLARE],
-[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
-					   [description])))[]dnl
-m4_pushdef([_libtool_name],
-    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
-m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
-    [0], [_libtool_name=[$]$1],
-    [1], [_libtool_name=$lt_[]$1],
-    [2], [_libtool_name=$lt_[]$1],
-    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
-m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
-])
-
-
-# _LT_LIBTOOL_CONFIG_VARS
-# -----------------------
-# Produce commented declarations of non-tagged libtool config variables
-# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
-# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
-# section) are produced by _LT_LIBTOOL_TAG_VARS.
-m4_defun([_LT_LIBTOOL_CONFIG_VARS],
-[m4_foreach([_lt_var],
-    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
-    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAG_VARS(TAG)
-# -------------------------
-m4_define([_LT_LIBTOOL_TAG_VARS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
-    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
-
-
-# _LT_TAGVAR(VARNAME, [TAGNAME])
-# ------------------------------
-m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
-
-
-# _LT_CONFIG_COMMANDS
-# -------------------
-# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
-# variables for single and double quote escaping we saved from calls
-# to _LT_DECL, we can put quote escaped variables declarations
-# into `config.status', and then the shell code to quote escape them in
-# for loops in `config.status'.  Finally, any additional code accumulated
-# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
-m4_defun([_LT_CONFIG_COMMANDS],
-[AC_PROVIDE_IFELSE([LT_OUTPUT],
-	dnl If the libtool generation code has been placed in $CONFIG_LT,
-	dnl instead of duplicating it all over again into config.status,
-	dnl then we will have config.status run $CONFIG_LT later, so it
-	dnl needs to know what name is stored there:
-        [AC_CONFIG_COMMANDS([libtool],
-            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
-    dnl If the libtool generation code is destined for config.status,
-    dnl expand the accumulated commands and init code now:
-    [AC_CONFIG_COMMANDS([libtool],
-        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
-])#_LT_CONFIG_COMMANDS
-
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
-[
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-sed_quote_subst='$sed_quote_subst'
-double_quote_subst='$double_quote_subst'
-delay_variable_subst='$delay_variable_subst'
-_LT_CONFIG_STATUS_DECLARATIONS
-LTCC='$LTCC'
-LTCFLAGS='$LTCFLAGS'
-compiler='$compiler_DEFAULT'
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$[]1
-_LTECHO_EOF'
-}
-
-# Quote evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_quote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
-    *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-# Double-quote double-evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_dquote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
-    *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
-      ;;
-    *)
-      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
-      ;;
-    esac
-done
-
-_LT_OUTPUT_LIBTOOL_INIT
-])
-
-# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
-# ------------------------------------
-# Generate a child script FILE with all initialization necessary to
-# reuse the environment learned by the parent script, and make the
-# file executable.  If COMMENT is supplied, it is inserted after the
-# `#!' sequence but before initialization text begins.  After this
-# macro, additional text can be appended to FILE to form the body of
-# the child script.  The macro ends with non-zero status if the
-# file could not be fully written (such as if the disk is full).
-m4_ifdef([AS_INIT_GENERATED],
-[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
-[m4_defun([_LT_GENERATED_FILE_INIT],
-[m4_require([AS_PREPARE])]dnl
-[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
-[lt_write_fail=0
-cat >$1 <<_ASEOF || lt_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-$2
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$1 <<\_ASEOF || lt_write_fail=1
-AS_SHELL_SANITIZE
-_AS_PREPARE
-exec AS_MESSAGE_FD>&1
-_ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
-m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
-
-# LT_OUTPUT
-# ---------
-# This macro allows early generation of the libtool script (before
-# AC_OUTPUT is called), incase it is used in configure for compilation
-# tests.
-AC_DEFUN([LT_OUTPUT],
-[: ${CONFIG_LT=./config.lt}
-AC_MSG_NOTICE([creating $CONFIG_LT])
-_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
-[# Run this file to recreate a libtool stub with the current configuration.])
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-lt_cl_silent=false
-exec AS_MESSAGE_LOG_FD>>config.log
-{
-  echo
-  AS_BOX([Running $as_me.])
-} >&AS_MESSAGE_LOG_FD
-
-lt_cl_help="\
-\`$as_me' creates a local libtool stub from the current configuration,
-for use in further configure time tests before the real libtool is
-generated.
-
-Usage: $[0] [[OPTIONS]]
-
-  -h, --help      print this help, then exit
-  -V, --version   print version number, then exit
-  -q, --quiet     do not print progress messages
-  -d, --debug     don't remove temporary files
-
-Report bugs to <bug-libtool at gnu.org>."
-
-lt_cl_version="\
-m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
-m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
-configured by $[0], generated by m4_PACKAGE_STRING.
-
-Copyright (C) 2011 Free Software Foundation, Inc.
-This config.lt script is free software; the Free Software Foundation
-gives unlimited permision to copy, distribute and modify it."
-
-while test $[#] != 0
-do
-  case $[1] in
-    --version | --v* | -V )
-      echo "$lt_cl_version"; exit 0 ;;
-    --help | --h* | -h )
-      echo "$lt_cl_help"; exit 0 ;;
-    --debug | --d* | -d )
-      debug=: ;;
-    --quiet | --q* | --silent | --s* | -q )
-      lt_cl_silent=: ;;
-
-    -*) AC_MSG_ERROR([unrecognized option: $[1]
-Try \`$[0] --help' for more information.]) ;;
-
-    *) AC_MSG_ERROR([unrecognized argument: $[1]
-Try \`$[0] --help' for more information.]) ;;
-  esac
-  shift
-done
-
-if $lt_cl_silent; then
-  exec AS_MESSAGE_FD>/dev/null
-fi
-_LTEOF
-
-cat >>"$CONFIG_LT" <<_LTEOF
-_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
-_LTEOF
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-AC_MSG_NOTICE([creating $ofile])
-_LT_OUTPUT_LIBTOOL_COMMANDS
-AS_EXIT(0)
-_LTEOF
-chmod +x "$CONFIG_LT"
-
-# configure is writing to config.log, but config.lt does its own redirection,
-# appending to config.log, which fails on DOS, as config.log is still kept
-# open by configure.  Here we exec the FD to /dev/null, effectively closing
-# config.log, so it can be properly (re)opened and appended to by config.lt.
-lt_cl_success=:
-test "$silent" = yes &&
-  lt_config_lt_args="$lt_config_lt_args --quiet"
-exec AS_MESSAGE_LOG_FD>/dev/null
-$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-exec AS_MESSAGE_LOG_FD>>config.log
-$lt_cl_success || AS_EXIT(1)
-])# LT_OUTPUT
-
-
-# _LT_CONFIG(TAG)
-# ---------------
-# If TAG is the built-in tag, create an initial libtool script with a
-# default configuration from the untagged config vars.  Otherwise add code
-# to config.status for appending the configuration named by TAG from the
-# matching tagged config vars.
-m4_defun([_LT_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_CONFIG_SAVE_COMMANDS([
-  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
-  m4_if(_LT_TAG, [C], [
-    # See if we are running on zsh, and set the options which allow our
-    # commands through without removal of \ escapes.
-    if test -n "${ZSH_VERSION+set}" ; then
-      setopt NO_GLOB_SUBST
-    fi
-
-    cfgfile="${ofile}T"
-    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
-    $RM "$cfgfile"
-
-    cat <<_LT_EOF >> "$cfgfile"
-#! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-_LT_COPYING
-_LT_LIBTOOL_TAGS
-
-# ### BEGIN LIBTOOL CONFIG
-_LT_LIBTOOL_CONFIG_VARS
-_LT_LIBTOOL_TAG_VARS
-# ### END LIBTOOL CONFIG
-
-_LT_EOF
-
-  case $host_os in
-  aix3*)
-    cat <<\_LT_EOF >> "$cfgfile"
-# AIX sometimes has problems with the GCC collect2 program.  For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
-  COLLECT_NAMES=
-  export COLLECT_NAMES
-fi
-_LT_EOF
-    ;;
-  esac
-
-  _LT_PROG_LTMAIN
-
-  # We use sed instead of cat because bash on DJGPP gets confused if
-  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
-  # text mode, it properly converts lines to CR/LF.  This bash problem
-  # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" \
-     || (rm -f "$cfgfile"; exit 1)
-
-  _LT_PROG_REPLACE_SHELLFNS
-
-   mv -f "$cfgfile" "$ofile" ||
-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
-  chmod +x "$ofile"
-],
-[cat <<_LT_EOF >> "$ofile"
-
-dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
-dnl in a comment (ie after a #).
-# ### BEGIN LIBTOOL TAG CONFIG: $1
-_LT_LIBTOOL_TAG_VARS(_LT_TAG)
-# ### END LIBTOOL TAG CONFIG: $1
-_LT_EOF
-])dnl /m4_if
-],
-[m4_if([$1], [], [
-    PACKAGE='$PACKAGE'
-    VERSION='$VERSION'
-    TIMESTAMP='$TIMESTAMP'
-    RM='$RM'
-    ofile='$ofile'], [])
-])dnl /_LT_CONFIG_SAVE_COMMANDS
-])# _LT_CONFIG
-
-
-# LT_SUPPORTED_TAG(TAG)
-# ---------------------
-# Trace this macro to discover what tags are supported by the libtool
-# --tag option, using:
-#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
-AC_DEFUN([LT_SUPPORTED_TAG], [])
-
-
-# C support is built-in for now
-m4_define([_LT_LANG_C_enabled], [])
-m4_define([_LT_TAGS], [])
-
-
-# LT_LANG(LANG)
-# -------------
-# Enable libtool support for the given language if not already enabled.
-AC_DEFUN([LT_LANG],
-[AC_BEFORE([$0], [LT_OUTPUT])dnl
-m4_case([$1],
-  [C],			[_LT_LANG(C)],
-  [C++],		[_LT_LANG(CXX)],
-  [Go],			[_LT_LANG(GO)],
-  [Java],		[_LT_LANG(GCJ)],
-  [Fortran 77],		[_LT_LANG(F77)],
-  [Fortran],		[_LT_LANG(FC)],
-  [Windows Resource],	[_LT_LANG(RC)],
-  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
-    [_LT_LANG($1)],
-    [m4_fatal([$0: unsupported language: "$1"])])])dnl
-])# LT_LANG
-
-
-# _LT_LANG(LANGNAME)
-# ------------------
-m4_defun([_LT_LANG],
-[m4_ifdef([_LT_LANG_]$1[_enabled], [],
-  [LT_SUPPORTED_TAG([$1])dnl
-  m4_append([_LT_TAGS], [$1 ])dnl
-  m4_define([_LT_LANG_]$1[_enabled], [])dnl
-  _LT_LANG_$1_CONFIG($1)])dnl
-])# _LT_LANG
-
-
-m4_ifndef([AC_PROG_GO], [
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-m4_defun([AC_PROG_GO],
-[AC_LANG_PUSH(Go)dnl
-AC_ARG_VAR([GOC],     [Go compiler command])dnl
-AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
-_AC_ARG_VAR_LDFLAGS()dnl
-AC_CHECK_TOOL(GOC, gccgo)
-if test -z "$GOC"; then
-  if test -n "$ac_tool_prefix"; then
-    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
-  fi
-fi
-if test -z "$GOC"; then
-  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
-fi
-])#m4_defun
-])#m4_ifndef
-
-
-# _LT_LANG_DEFAULT_CONFIG
-# -----------------------
-m4_defun([_LT_LANG_DEFAULT_CONFIG],
-[AC_PROVIDE_IFELSE([AC_PROG_CXX],
-  [LT_LANG(CXX)],
-  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_F77],
-  [LT_LANG(F77)],
-  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_FC],
-  [LT_LANG(FC)],
-  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
-
-dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
-dnl pulling things in needlessly.
-AC_PROVIDE_IFELSE([AC_PROG_GCJ],
-  [LT_LANG(GCJ)],
-  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
-    [LT_LANG(GCJ)],
-    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
-      [LT_LANG(GCJ)],
-      [m4_ifdef([AC_PROG_GCJ],
-	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
-       m4_ifdef([A][M_PROG_GCJ],
-	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
-       m4_ifdef([LT_PROG_GCJ],
-	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
-
-AC_PROVIDE_IFELSE([AC_PROG_GO],
-  [LT_LANG(GO)],
-  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
-
-AC_PROVIDE_IFELSE([LT_PROG_RC],
-  [LT_LANG(RC)],
-  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
-])# _LT_LANG_DEFAULT_CONFIG
-
-# Obsolete macros:
-AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
-AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
-AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
-AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
-dnl AC_DEFUN([AC_LIBTOOL_F77], [])
-dnl AC_DEFUN([AC_LIBTOOL_FC], [])
-dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
-dnl AC_DEFUN([AC_LIBTOOL_RC], [])
-
-
-# _LT_TAG_COMPILER
-# ----------------
-m4_defun([_LT_TAG_COMPILER],
-[AC_REQUIRE([AC_PROG_CC])dnl
-
-_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
-_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
-_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
-_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-])# _LT_TAG_COMPILER
-
-
-# _LT_COMPILER_BOILERPLATE
-# ------------------------
-# Check for compiler boilerplate output or warnings with
-# the simple compiler test code.
-m4_defun([_LT_COMPILER_BOILERPLATE],
-[m4_require([_LT_DECL_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$RM conftest*
-])# _LT_COMPILER_BOILERPLATE
-
-
-# _LT_LINKER_BOILERPLATE
-# ----------------------
-# Check for linker boilerplate output or warnings with
-# the simple link test code.
-m4_defun([_LT_LINKER_BOILERPLATE],
-[m4_require([_LT_DECL_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$RM -r conftest*
-])# _LT_LINKER_BOILERPLATE
-
-# _LT_REQUIRED_DARWIN_CHECKS
-# -------------------------
-m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
-  case $host_os in
-    rhapsody* | darwin*)
-    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
-    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
-    AC_CHECK_TOOL([LIPO], [lipo], [:])
-    AC_CHECK_TOOL([OTOOL], [otool], [:])
-    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
-    _LT_DECL([], [DSYMUTIL], [1],
-      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
-    _LT_DECL([], [NMEDIT], [1],
-      [Tool to change global to local symbols on Mac OS X])
-    _LT_DECL([], [LIPO], [1],
-      [Tool to manipulate fat objects and archives on Mac OS X])
-    _LT_DECL([], [OTOOL], [1],
-      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
-    _LT_DECL([], [OTOOL64], [1],
-      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
-
-    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
-      [lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-	# By default we will add the -single_module flag. You can override
-	# by either setting the environment variable LT_MULTI_MODULE
-	# non-empty at configure time, or by adding -multi_module to the
-	# link flags.
-	rm -rf libconftest.dylib*
-	echo "int foo(void){return 1;}" > conftest.c
-	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
-	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
-        _lt_result=$?
-	# If there is a non-empty error log, and "single_module"
-	# appears in it, assume the flag caused a linker warning
-        if test -s conftest.err && $GREP single_module conftest.err; then
-	  cat conftest.err >&AS_MESSAGE_LOG_FD
-	# Otherwise, if the output was created with a 0 exit code from
-	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
-	  lt_cv_apple_cc_single_mod=yes
-	else
-	  cat conftest.err >&AS_MESSAGE_LOG_FD
-	fi
-	rm -rf libconftest.dylib*
-	rm -f conftest.*
-      fi])
-
-    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
-      [lt_cv_ld_exported_symbols_list],
-      [lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-	[lt_cv_ld_exported_symbols_list=yes],
-	[lt_cv_ld_exported_symbols_list=no])
-	LDFLAGS="$save_LDFLAGS"
-    ])
-
-    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
-      [lt_cv_ld_force_load=no
-      cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
-      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
-      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
-      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
-      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
-      cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
-      _lt_result=$?
-      if test -s conftest.err && $GREP force_load conftest.err; then
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
-	lt_cv_ld_force_load=yes
-      else
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      fi
-        rm -f conftest.err libconftest.a conftest conftest.c
-        rm -rf conftest.dSYM
-    ])
-    case $host_os in
-    rhapsody* | darwin1.[[012]])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-	10.[[012]]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-	10.*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
-    fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
-      _lt_dsymutil='~$DSYMUTIL $lib || :'
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
-])
-
-
-# _LT_DARWIN_LINKER_FEATURES([TAG])
-# ---------------------------------
-# Checks for linker and compiler features on darwin
-m4_defun([_LT_DARWIN_LINKER_FEATURES],
-[
-  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
-  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-  _LT_TAGVAR(hardcode_direct, $1)=no
-  _LT_TAGVAR(hardcode_automatic, $1)=yes
-  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
-                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
-  else
-    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
-  fi
-  _LT_TAGVAR(link_all_deplibs, $1)=yes
-  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-  case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
-     *) _lt_dar_can_shared=$GCC ;;
-  esac
-  if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
-    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-    m4_if([$1], [CXX],
-[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
-      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
-    fi
-],[])
-  else
-  _LT_TAGVAR(ld_shlibs, $1)=no
-  fi
-])
-
-# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
-# ----------------------------------
-# Links a minimal program and checks the executable
-# for the system default hardcoded library path. In most cases,
-# this is /usr/lib:/lib, but when the MPI compilers are used
-# the location of the communication and MPI libs are included too.
-# If we don't find anything, use the default library path according
-# to the aix ld manual.
-# Store the results from the different compilers for each TAGNAME.
-# Allow to override them for all tags through lt_cv_aix_libpath.
-m4_defun([_LT_SYS_MODULE_PATH_AIX],
-[m4_require([_LT_DECL_SED])dnl
-if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
-  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
-  lt_aix_libpath_sed='[
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }]'
-  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi],[])
-  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
-  fi
-  ])
-  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
-fi
-])# _LT_SYS_MODULE_PATH_AIX
-
-
-# _LT_SHELL_INIT(ARG)
-# -------------------
-m4_define([_LT_SHELL_INIT],
-[m4_divert_text([M4SH-INIT], [$1
-])])# _LT_SHELL_INIT
-
-
-
-# _LT_PROG_ECHO_BACKSLASH
-# -----------------------
-# Find how we can fake an echo command that does not interpret backslash.
-# In particular, with Autoconf 2.60 or later we add some code to the start
-# of the generated configure script which will find a shell with a builtin
-# printf (which we can use as an echo command).
-m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-AC_MSG_CHECKING([how to print strings])
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
-   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='printf %s\n'
-else
-  # Use this function as a fallback that always works.
-  func_fallback_echo ()
-  {
-    eval 'cat <<_LTECHO_EOF
-$[]1
-_LTECHO_EOF'
-  }
-  ECHO='func_fallback_echo'
-fi
-
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*" 
-}
-
-case "$ECHO" in
-  printf*) AC_MSG_RESULT([printf]) ;;
-  print*) AC_MSG_RESULT([print -r]) ;;
-  *) AC_MSG_RESULT([cat]) ;;
-esac
-
-m4_ifdef([_AS_DETECT_SUGGESTED],
-[_AS_DETECT_SUGGESTED([
-  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
-    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-    PATH=/empty FPATH=/empty; export PATH FPATH
-    test "X`printf %s $ECHO`" = "X$ECHO" \
-      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
-
-_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
-])# _LT_PROG_ECHO_BACKSLASH
-
-
-# _LT_WITH_SYSROOT
-# ----------------
-AC_DEFUN([_LT_WITH_SYSROOT],
-[AC_MSG_CHECKING([for sysroot])
-AC_ARG_WITH([sysroot],
-[  --with-sysroot[=DIR] Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).],
-[], [with_sysroot=no])
-
-dnl lt_sysroot will always be passed unquoted.  We quote it here
-dnl in case the user passed a directory name.
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
-   if test "$GCC" = yes; then
-     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
-   fi
-   ;; #(
- /*)
-   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
-   ;; #(
- no|'')
-   ;; #(
- *)
-   AC_MSG_RESULT([${with_sysroot}])
-   AC_MSG_ERROR([The sysroot must be an absolute path.])
-   ;;
-esac
-
- AC_MSG_RESULT([${lt_sysroot:-no}])
-_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
-[dependent libraries, and in which our libraries should be installed.])])
-
-# _LT_ENABLE_LOCK
-# ---------------
-m4_defun([_LT_ENABLE_LOCK],
-[AC_ARG_ENABLE([libtool-lock],
-  [AS_HELP_STRING([--disable-libtool-lock],
-    [avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.$ac_objext` in
-      *ELF-32*)
-	HPUX_IA64_MODE="32"
-	;;
-      *ELF-64*)
-	HPUX_IA64_MODE="64"
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    if test "$lt_cv_prog_gnu_ld" = yes; then
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -melf32bsmip"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -melf32bmipn32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -melf64bmip"
-	;;
-      esac
-    else
-      case `/usr/bin/file conftest.$ac_objext` in
-	*32-bit*)
-	  LD="${LD-ld} -32"
-	  ;;
-	*N32*)
-	  LD="${LD-ld} -n32"
-	  ;;
-	*64-bit*)
-	  LD="${LD-ld} -64"
-	  ;;
-      esac
-    fi
-  fi
-  rm -rf conftest*
-  ;;
-
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-      *32-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_i386_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_i386"
-	    ;;
-	  ppc64-*linux*|powerpc64-*linux*)
-	    LD="${LD-ld} -m elf32ppclinux"
-	    ;;
-	  s390x-*linux*)
-	    LD="${LD-ld} -m elf_s390"
-	    ;;
-	  sparc64-*linux*)
-	    LD="${LD-ld} -m elf32_sparc"
-	    ;;
-	esac
-	;;
-      *64-bit*)
-	case $host in
-	  x86_64-*kfreebsd*-gnu)
-	    LD="${LD-ld} -m elf_x86_64_fbsd"
-	    ;;
-	  x86_64-*linux*)
-	    LD="${LD-ld} -m elf_x86_64"
-	    ;;
-	  ppc*-*linux*|powerpc*-*linux*)
-	    LD="${LD-ld} -m elf64ppc"
-	    ;;
-	  s390*-*linux*|s390*-*tpf*)
-	    LD="${LD-ld} -m elf64_s390"
-	    ;;
-	  sparc*-*linux*)
-	    LD="${LD-ld} -m elf64_sparc"
-	    ;;
-	esac
-	;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_LANG_PUSH(C)
-     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
-     AC_LANG_POP])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-*-*solaris*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-    *64-bit*)
-      case $lt_cv_prog_gnu_ld in
-      yes*)
-        case $host in
-        i?86-*-solaris*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        sparc*-*-solaris*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-        esac
-        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
-        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
-        fi
-        ;;
-      *)
-	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-esac
-
-need_locks="$enable_libtool_lock"
-])# _LT_ENABLE_LOCK
-
-
-# _LT_PROG_AR
-# -----------
-m4_defun([_LT_PROG_AR],
-[AC_CHECK_TOOLS(AR, [ar], false)
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
-
-AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
-  [lt_cv_ar_at_file=no
-   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
-     [echo conftest.$ac_objext > conftest.lst
-      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
-      AC_TRY_EVAL([lt_ar_try])
-      if test "$ac_status" -eq 0; then
-	# Ensure the archiver fails upon bogus file names.
-	rm -f conftest.$ac_objext libconftest.a
-	AC_TRY_EVAL([lt_ar_try])
-	if test "$ac_status" -ne 0; then
-          lt_cv_ar_at_file=@
-        fi
-      fi
-      rm -f conftest.* libconftest.a
-     ])
-  ])
-
-if test "x$lt_cv_ar_at_file" = xno; then
-  archiver_list_spec=
-else
-  archiver_list_spec=$lt_cv_ar_at_file
-fi
-_LT_DECL([], [archiver_list_spec], [1],
-  [How to feed a file listing to the archiver])
-])# _LT_PROG_AR
-
-
-# _LT_CMD_OLD_ARCHIVE
-# -------------------
-m4_defun([_LT_CMD_OLD_ARCHIVE],
-[_LT_PROG_AR
-
-AC_CHECK_TOOL(STRIP, strip, :)
-test -z "$STRIP" && STRIP=:
-_LT_DECL([], [STRIP], [1], [A symbol stripping program])
-
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-test -z "$RANLIB" && RANLIB=:
-_LT_DECL([], [RANLIB], [1],
-    [Commands used to install an old-style archive])
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
-  case $host_os in
-  openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
-    ;;
-  *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
-    ;;
-  esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
-fi
-
-case $host_os in
-  darwin*)
-    lock_old_archive_extraction=yes ;;
-  *)
-    lock_old_archive_extraction=no ;;
-esac
-_LT_DECL([], [old_postinstall_cmds], [2])
-_LT_DECL([], [old_postuninstall_cmds], [2])
-_LT_TAGDECL([], [old_archive_cmds], [2],
-    [Commands used to build an old-style archive])
-_LT_DECL([], [lock_old_archive_extraction], [0],
-    [Whether to use a lock for old archive extraction])
-])# _LT_CMD_OLD_ARCHIVE
-
-
-# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([_LT_COMPILER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$3"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       $2=yes
-     fi
-   fi
-   $RM conftest*
-])
-
-if test x"[$]$2" = xyes; then
-    m4_if([$5], , :, [$5])
-else
-    m4_if([$6], , :, [$6])
-fi
-])# _LT_COMPILER_OPTION
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
-
-
-# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#                  [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------
-# Check whether the given linker option works
-AC_DEFUN([_LT_LINKER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $3"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         $2=yes
-       fi
-     else
-       $2=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-])
-
-if test x"[$]$2" = xyes; then
-    m4_if([$4], , :, [$4])
-else
-    m4_if([$5], , :, [$5])
-fi
-])# _LT_LINKER_OPTION
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
-
-
-# LT_CMD_MAX_LEN
-#---------------
-AC_DEFUN([LT_CMD_MAX_LEN],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# find the maximum length of command line arguments
-AC_MSG_CHECKING([the maximum length of command line arguments])
-AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
-  i=0
-  teststring="ABCD"
-
-  case $build_os in
-  msdosdjgpp*)
-    # On DJGPP, this test can blow up pretty badly due to problems in libc
-    # (any single argument exceeding 2000 bytes causes a buffer overrun
-    # during glob expansion).  Even if it were fixed, the result of this
-    # check would be larger than it should be.
-    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
-    ;;
-
-  gnu*)
-    # Under GNU Hurd, this test is not required because there is
-    # no limit to the length of command line arguments.
-    # Libtool will interpret -1 as no limit whatsoever
-    lt_cv_sys_max_cmd_len=-1;
-    ;;
-
-  cygwin* | mingw* | cegcc*)
-    # On Win9x/ME, this test blows up -- it succeeds, but takes
-    # about 5 minutes as the teststring grows exponentially.
-    # Worse, since 9x/ME are not pre-emptively multitasking,
-    # you end up with a "frozen" computer, even though with patience
-    # the test eventually succeeds (with a max line length of 256k).
-    # Instead, let's just punt: use the minimum linelength reported by
-    # all of the supported platforms: 8192 (on NT/2K/XP).
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  mint*)
-    # On MiNT this can take a long time and run out of memory.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  amigaos*)
-    # On AmigaOS with pdksh, this test takes hours, literally.
-    # So we just punt and use a minimum line length of 8192.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
-    # This has been around since 386BSD, at least.  Likely further.
-    if test -x /sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
-    elif test -x /usr/sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
-    else
-      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
-    fi
-    # And add a safety zone
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    ;;
-
-  interix*)
-    # We know the value 262144 and hardcode it with a safety zone (like BSD)
-    lt_cv_sys_max_cmd_len=196608
-    ;;
-
-  os2*)
-    # The test takes a long time on OS/2.
-    lt_cv_sys_max_cmd_len=8192
-    ;;
-
-  osf*)
-    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
-    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
-    # nice to cause kernel panics so lets avoid the loop below.
-    # First set a reasonable default.
-    lt_cv_sys_max_cmd_len=16384
-    #
-    if test -x /sbin/sysconfig; then
-      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
-        *1*) lt_cv_sys_max_cmd_len=-1 ;;
-      esac
-    fi
-    ;;
-  sco3.2v5*)
-    lt_cv_sys_max_cmd_len=102400
-    ;;
-  sysv5* | sco5v6* | sysv4.2uw2*)
-    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
-    if test -n "$kargmax"; then
-      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
-    else
-      lt_cv_sys_max_cmd_len=32768
-    fi
-    ;;
-  *)
-    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    else
-      # Make teststring a little bigger before we do anything with it.
-      # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
-        teststring=$teststring$teststring
-      done
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      # If test is not a shell built-in, we'll probably end up computing a
-      # maximum length that is only half of the actual maximum length, but
-      # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
-	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      # Only check the string length outside the loop.
-      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
-      teststring=
-      # Add a significant safety factor because C++ compilers can tack on
-      # massive amounts of additional arguments before passing them to the
-      # linker.  It appears as though 1/2 is a usable value.
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
-    fi
-    ;;
-  esac
-])
-if test -n $lt_cv_sys_max_cmd_len ; then
-  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
-else
-  AC_MSG_RESULT(none)
-fi
-max_cmd_len=$lt_cv_sys_max_cmd_len
-_LT_DECL([], [max_cmd_len], [0],
-    [What is the maximum length of a command?])
-])# LT_CMD_MAX_LEN
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
-
-
-# _LT_HEADER_DLFCN
-# ----------------
-m4_defun([_LT_HEADER_DLFCN],
-[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
-])# _LT_HEADER_DLFCN
-
-
-# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
-# ----------------------------------------------------------------
-m4_defun([_LT_TRY_DLOPEN_SELF],
-[m4_require([_LT_HEADER_DLFCN])dnl
-if test "$cross_compiling" = yes; then :
-  [$4]
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<_LT_EOF
-[#line $LINENO "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
-
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
-
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 42; }
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
-
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else
-        {
-	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
-          else puts (dlerror ());
-	}
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-  return status;
-}]
-_LT_EOF
-  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) $1 ;;
-      x$lt_dlneed_uscore) $2 ;;
-      x$lt_dlunknown|x*) $3 ;;
-    esac
-  else :
-    # compilation failed
-    $3
-  fi
-fi
-rm -fr conftest*
-])# _LT_TRY_DLOPEN_SELF
-
-
-# LT_SYS_DLOPEN_SELF
-# ------------------
-AC_DEFUN([LT_SYS_DLOPEN_SELF],
-[m4_require([_LT_HEADER_DLFCN])dnl
-if test "x$enable_dlopen" != xyes; then
-  enable_dlopen=unknown
-  enable_dlopen_self=unknown
-  enable_dlopen_self_static=unknown
-else
-  lt_cv_dlopen=no
-  lt_cv_dlopen_libs=
-
-  case $host_os in
-  beos*)
-    lt_cv_dlopen="load_add_on"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ;;
-
-  mingw* | pw32* | cegcc*)
-    lt_cv_dlopen="LoadLibrary"
-    lt_cv_dlopen_libs=
-    ;;
-
-  cygwin*)
-    lt_cv_dlopen="dlopen"
-    lt_cv_dlopen_libs=
-    ;;
-
-  darwin*)
-  # if libdl is installed we need to link against it
-    AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
-    lt_cv_dlopen="dyld"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ])
-    ;;
-
-  *)
-    AC_CHECK_FUNC([shl_load],
-	  [lt_cv_dlopen="shl_load"],
-      [AC_CHECK_LIB([dld], [shl_load],
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
-	[AC_CHECK_FUNC([dlopen],
-	      [lt_cv_dlopen="dlopen"],
-	  [AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
-	    [AC_CHECK_LIB([svld], [dlopen],
-		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
-	      [AC_CHECK_LIB([dld], [dld_link],
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
-	      ])
-	    ])
-	  ])
-	])
-      ])
-    ;;
-  esac
-
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
-    enable_dlopen=no
-  fi
-
-  case $lt_cv_dlopen in
-  dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
-
-    save_LDFLAGS="$LDFLAGS"
-    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
-
-    save_LIBS="$LIBS"
-    LIBS="$lt_cv_dlopen_libs $LIBS"
-
-    AC_CACHE_CHECK([whether a program can dlopen itself],
-	  lt_cv_dlopen_self, [dnl
-	  _LT_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
-	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
-    ])
-
-    if test "x$lt_cv_dlopen_self" = xyes; then
-      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
-	  lt_cv_dlopen_self_static, [dnl
-	  _LT_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
-	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
-      ])
-    fi
-
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-    ;;
-  esac
-
-  case $lt_cv_dlopen_self in
-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
-  *) enable_dlopen_self=unknown ;;
-  esac
-
-  case $lt_cv_dlopen_self_static in
-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
-  *) enable_dlopen_self_static=unknown ;;
-  esac
-fi
-_LT_DECL([dlopen_support], [enable_dlopen], [0],
-	 [Whether dlopen is supported])
-_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
-	 [Whether dlopen of programs is supported])
-_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
-	 [Whether dlopen of statically linked programs is supported])
-])# LT_SYS_DLOPEN_SELF
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
-
-
-# _LT_COMPILER_C_O([TAGNAME])
-# ---------------------------
-# Check to see if options -c and -o are simultaneously supported by compiler.
-# This macro does not hard code the compiler like AC_PROG_CC_C_O.
-m4_defun([_LT_COMPILER_C_O],
-[m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
-  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
-  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
-   $RM -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-     fi
-   fi
-   chmod u+w . 2>&AS_MESSAGE_LOG_FD
-   $RM conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
-   $RM out/* && rmdir out
-   cd ..
-   $RM -r conftest
-   $RM conftest*
-])
-_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
-	[Does compiler simultaneously support -c and -o options?])
-])# _LT_COMPILER_C_O
-
-
-# _LT_COMPILER_FILE_LOCKS([TAGNAME])
-# ----------------------------------
-# Check to see if we can do hard links to lock some files if needed
-m4_defun([_LT_COMPILER_FILE_LOCKS],
-[m4_require([_LT_ENABLE_LOCK])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_COMPILER_C_O([$1])
-
-hard_links="nottested"
-if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  AC_MSG_CHECKING([if we can lock with hard links])
-  hard_links=yes
-  $RM conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  AC_MSG_RESULT([$hard_links])
-  if test "$hard_links" = no; then
-    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
-_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
-])# _LT_COMPILER_FILE_LOCKS
-
-
-# _LT_CHECK_OBJDIR
-# ----------------
-m4_defun([_LT_CHECK_OBJDIR],
-[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
-[rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
-  lt_cv_objdir=.libs
-else
-  # MS-DOS does not allow filenames that begin with a dot.
-  lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null])
-objdir=$lt_cv_objdir
-_LT_DECL([], [objdir], [0],
-         [The name of the directory that contains temporary libtool files])dnl
-m4_pattern_allow([LT_OBJDIR])dnl
-AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
-  [Define to the sub-directory in which libtool stores uninstalled libraries.])
-])# _LT_CHECK_OBJDIR
-
-
-# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
-# --------------------------------------
-# Check hardcoding attributes.
-m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
-[AC_MSG_CHECKING([how to hardcode library paths into programs])
-_LT_TAGVAR(hardcode_action, $1)=
-if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
-   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
-   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
-
-  # We can hardcode non-existent directories.
-  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
-     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
-    # Linking always hardcodes the temporary library directory.
-    _LT_TAGVAR(hardcode_action, $1)=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    _LT_TAGVAR(hardcode_action, $1)=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  _LT_TAGVAR(hardcode_action, $1)=unsupported
-fi
-AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
-
-if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
-   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
-_LT_TAGDECL([], [hardcode_action], [0],
-    [How to hardcode a shared library path into an executable])
-])# _LT_LINKER_HARDCODE_LIBPATH
-
-
-# _LT_CMD_STRIPLIB
-# ----------------
-m4_defun([_LT_CMD_STRIPLIB],
-[m4_require([_LT_DECL_EGREP])
-striplib=
-old_striplib=
-AC_MSG_CHECKING([whether stripping libraries is possible])
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  AC_MSG_RESULT([yes])
-else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-  darwin*)
-    if test -n "$STRIP" ; then
-      striplib="$STRIP -x"
-      old_striplib="$STRIP -S"
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_RESULT([no])
-    fi
-    ;;
-  *)
-    AC_MSG_RESULT([no])
-    ;;
-  esac
-fi
-_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
-_LT_DECL([], [striplib], [1])
-])# _LT_CMD_STRIPLIB
-
-
-# _LT_SYS_DYNAMIC_LINKER([TAG])
-# -----------------------------
-# PORTME Fill in your ld.so characteristics
-m4_defun([_LT_SYS_DYNAMIC_LINKER],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_OBJDUMP])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-AC_MSG_CHECKING([dynamic linker characteristics])
-m4_if([$1],
-	[], [
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
-  case $lt_search_path_spec in
-  *\;*)
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
-    ;;
-  *)
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
-    ;;
-  esac
-  # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
-  lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
-  for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
-      test -d "$lt_sys_path" && \
-	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
-    fi
-  done
-  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
-  for (lt_i = NF; lt_i > 0; lt_i--) {
-    if ($lt_i != "" && $lt_i != ".") {
-      if ($lt_i == "..") {
-        lt_count++;
-      } else {
-        if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
-        } else {
-          lt_count--;
-        }
-      }
-    }
-  }
-  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
-  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
-}'`
-  # AWK program above erroneously prepends '/' to C:/dos/paths
-  # for these hosts.
-  case $host_os in
-    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
-  esac
-  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi])
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-need_lib_prefix=unknown
-hardcode_into_libs=no
-
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
-
-case $host_os in
-aix3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
-
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
-
-aix[[4-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
-  else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[[01]] | aix4.[[01]].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
-	:
-      else
-	can_build_shared=no
-      fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
-  fi
-  ;;
-
-amigaos*)
-  case $host_cpu in
-  powerpc)
-    # Since July 2007 AmigaOS4 officially supports .so libraries.
-    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    ;;
-  m68k)
-    library_names_spec='$libname.ixlibrary $libname.a'
-    # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-    ;;
-  esac
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[[45]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
-
-cygwin* | mingw* | pw32* | cegcc*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname~
-      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
-        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
-      fi'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-m4_if([$1], [],[
-      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
-      ;;
-    mingw* | cegcc*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
-      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
-      ;;
-    esac
-
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
-    ;;
-
-  *)
-    # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
-    ;;
-  esac
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
-
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-m4_if([$1], [],[
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
-
-dgux*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[[23]].*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
-  fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2.*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
-  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
-
-gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
-  hardcode_into_libs=yes
-  ;;
-
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  hppa*64*)
-    shrext_cmds='.sl'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-  *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
-  postinstall_cmds='chmod 555 $lib'
-  # or fails outright, so override atomically:
-  install_override_mode=555
-  ;;
-
-interix[[3-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux # correct to gnu/linux during the next big refactor
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
-
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-
-  # Some binutils ld are patched to set DT_RUNPATH
-  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
-    [lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
-	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
-	 [lt_cv_shlibpath_overrides_runpath=yes])])
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-    ])
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
-
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
-
-  # Add ABI-specific directories to the system library path.
-  sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
-
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
-
-  fi
-
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
-
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
-
-newsos6)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
-
-*nto* | *qnx*)
-  version_type=qnx
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='ldqnx.so'
-  ;;
-
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
-    *)				need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[[89]] | openbsd2.[[89]].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
-
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
-
-rdos*)
-  dynamic_linker=no
-  ;;
-
-solaris*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
-
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
-
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux # correct to gnu/linux during the next big refactor
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
-
-tpf*)
-  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  ;;
-
-*)
-  dynamic_linker=no
-  ;;
-esac
-AC_MSG_RESULT([$dynamic_linker])
-test "$dynamic_linker" = no && can_build_shared=no
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-fi
-
-_LT_DECL([], [variables_saved_for_relink], [1],
-    [Variables whose values should be saved in libtool wrapper scripts and
-    restored at link time])
-_LT_DECL([], [need_lib_prefix], [0],
-    [Do we need the "lib" prefix for modules?])
-_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
-_LT_DECL([], [version_type], [0], [Library versioning type])
-_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
-_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
-_LT_DECL([], [shlibpath_overrides_runpath], [0],
-    [Is shlibpath searched before the hard-coded library search path?])
-_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
-_LT_DECL([], [library_names_spec], [1],
-    [[List of archive names.  First name is the real one, the rest are links.
-    The last name is the one that the linker finds with -lNAME]])
-_LT_DECL([], [soname_spec], [1],
-    [[The coded name of the library, if different from the real name]])
-_LT_DECL([], [install_override_mode], [1],
-    [Permission mode override for installation of shared libraries])
-_LT_DECL([], [postinstall_cmds], [2],
-    [Command to use after installation of a shared archive])
-_LT_DECL([], [postuninstall_cmds], [2],
-    [Command to use after uninstallation of a shared archive])
-_LT_DECL([], [finish_cmds], [2],
-    [Commands used to finish a libtool library installation in a directory])
-_LT_DECL([], [finish_eval], [1],
-    [[As "finish_cmds", except a single script fragment to be evaled but
-    not shown]])
-_LT_DECL([], [hardcode_into_libs], [0],
-    [Whether we should hardcode library paths into libraries])
-_LT_DECL([], [sys_lib_search_path_spec], [2],
-    [Compile-time system search path for libraries])
-_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
-    [Run-time system search path for libraries])
-])# _LT_SYS_DYNAMIC_LINKER
-
-
-# _LT_PATH_TOOL_PREFIX(TOOL)
-# --------------------------
-# find a file program which can recognize shared library
-AC_DEFUN([_LT_PATH_TOOL_PREFIX],
-[m4_require([_LT_DECL_EGREP])dnl
-AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
-[case $MAGIC_CMD in
-[[\\/*] |  ?:[\\/]*])
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
-  ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-dnl $ac_dummy forces splitting on constant user-supplied paths.
-dnl POSIX.2 word splitting is done only on the output of word expansions,
-dnl not every word.  This closes a longstanding sh security hole.
-  ac_dummy="m4_if([$2], , $PATH, [$2])"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$1; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<_LT_EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
-
-_LT_EOF
-	  fi ;;
-	esac
-      fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
-  ;;
-esac])
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  AC_MSG_RESULT($MAGIC_CMD)
-else
-  AC_MSG_RESULT(no)
-fi
-_LT_DECL([], [MAGIC_CMD], [0],
-	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
-])# _LT_PATH_TOOL_PREFIX
-
-# Old name:
-AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
-
-
-# _LT_PATH_MAGIC
-# --------------
-# find a file program which can recognize a shared library
-m4_defun([_LT_PATH_MAGIC],
-[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
-if test -z "$lt_cv_path_MAGIC_CMD"; then
-  if test -n "$ac_tool_prefix"; then
-    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
-  else
-    MAGIC_CMD=:
-  fi
-fi
-])# _LT_PATH_MAGIC
-
-
-# LT_PATH_LD
-# ----------
-# find the pathname to the GNU or non-GNU linker
-AC_DEFUN([LT_PATH_LD],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
-
-AC_ARG_WITH([gnu-ld],
-    [AS_HELP_STRING([--with-gnu-ld],
-	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
-    [test "$withval" = no || with_gnu_ld=yes],
-    [with_gnu_ld=no])dnl
-
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  AC_MSG_CHECKING([for ld used by $CC])
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [[\\/]]* | ?:[[\\/]]*)
-      re_direlt='/[[^/]][[^/]]*/\.\./'
-      # Canonicalize the pathname of ld
-      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
-      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  AC_MSG_CHECKING([for GNU ld])
-else
-  AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(lt_cv_path_LD,
-[if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some variants of GNU ld only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  AC_MSG_RESULT($LD)
-else
-  AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-_LT_PATH_LD_GNU
-AC_SUBST([LD])
-
-_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
-])# LT_PATH_LD
-
-# Old names:
-AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
-AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_LD], [])
-dnl AC_DEFUN([AC_PROG_LD], [])
-
-
-# _LT_PATH_LD_GNU
-#- --------------
-m4_defun([_LT_PATH_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac])
-with_gnu_ld=$lt_cv_prog_gnu_ld
-])# _LT_PATH_LD_GNU
-
-
-# _LT_CMD_RELOAD
-# --------------
-# find reload flag for linker
-#   -- PORTME Some linkers may need a different reload flag.
-m4_defun([_LT_CMD_RELOAD],
-[AC_CACHE_CHECK([for $LD option to reload object files],
-  lt_cv_ld_reload_flag,
-  [lt_cv_ld_reload_flag='-r'])
-reload_flag=$lt_cv_ld_reload_flag
-case $reload_flag in
-"" | " "*) ;;
-*) reload_flag=" $reload_flag" ;;
-esac
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
-      reload_cmds=false
-    fi
-    ;;
-  darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
-    else
-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
-    fi
-    ;;
-esac
-_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_TAGDECL([], [reload_cmds], [2])dnl
-])# _LT_CMD_RELOAD
-
-
-# _LT_CHECK_MAGIC_METHOD
-# ----------------------
-# how to check for library dependencies
-#  -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_MAGIC_METHOD],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-AC_CACHE_CHECK([how to recognize dependent libraries],
-lt_cv_deplibs_check_method,
-[lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
-
-case $host_os in
-aix[[4-9]]*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-beos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-bsdi[[45]]*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
-  lt_cv_file_magic_cmd='/usr/bin/file -L'
-  lt_cv_file_magic_test_file=/shlib/libc.so
-  ;;
-
-cygwin*)
-  # func_win32_libid is a shell function defined in ltmain.sh
-  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-  lt_cv_file_magic_cmd='func_win32_libid'
-  ;;
-
-mingw* | pw32*)
-  # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump',
-  # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
-    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-    lt_cv_file_magic_cmd='func_win32_libid'
-  else
-    # Keep this pattern in sync with the one in func_win32_libid.
-    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
-  ;;
-
-cegcc*)
-  # use the weaker test based on 'objdump'. See mingw*.
-  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
-  lt_cv_file_magic_cmd='$OBJDUMP -f'
-  ;;
-
-darwin* | rhapsody*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-freebsd* | dragonfly*)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    case $host_cpu in
-    i*86 )
-      # Not sure whether the presence of OpenBSD here was a mistake.
-      # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
-      lt_cv_file_magic_cmd=/usr/bin/file
-      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
-      ;;
-    esac
-  else
-    lt_cv_deplibs_check_method=pass_all
-  fi
-  ;;
-
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-haiku*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-hpux10.20* | hpux11*)
-  lt_cv_file_magic_cmd=/usr/bin/file
-  case $host_cpu in
-  ia64*)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
-    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
-    ;;
-  hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
-    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
-    ;;
-  *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
-    lt_cv_file_magic_test_file=/usr/lib/libc.sl
-    ;;
-  esac
-  ;;
-
-interix[[3-9]]*)
-  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
-  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $LD in
-  *-32|*"-32 ") libmagic=32-bit;;
-  *-n32|*"-n32 ") libmagic=N32;;
-  *-64|*"-64 ") libmagic=64-bit;;
-  *) libmagic=never-match;;
-  esac
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-netbsd*)
-  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
-  fi
-  ;;
-
-newos6*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
-  lt_cv_file_magic_cmd=/usr/bin/file
-  lt_cv_file_magic_test_file=/usr/lib/libnls.so
-  ;;
-
-*nto* | *qnx*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
-  fi
-  ;;
-
-osf3* | osf4* | osf5*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-rdos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-solaris*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv4 | sysv4.3*)
-  case $host_vendor in
-  motorola)
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
-    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
-    ;;
-  ncr)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  sequent)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
-    ;;
-  sni)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
-    lt_cv_file_magic_test_file=/lib/libc.so
-    ;;
-  siemens)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  pc)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  esac
-  ;;
-
-tpf*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
-])
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
-  case $host_os in
-  mingw* | pw32*)
-    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
-      want_nocaseglob=yes
-    else
-      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
-    fi
-    ;;
-  esac
-fi
-
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-test -z "$deplibs_check_method" && deplibs_check_method=unknown
-
-_LT_DECL([], [deplibs_check_method], [1],
-    [Method to check whether dependent libraries are shared objects])
-_LT_DECL([], [file_magic_cmd], [1],
-    [Command to use when deplibs_check_method = "file_magic"])
-_LT_DECL([], [file_magic_glob], [1],
-    [How to find potential files when deplibs_check_method = "file_magic"])
-_LT_DECL([], [want_nocaseglob], [1],
-    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
-])# _LT_CHECK_MAGIC_METHOD
-
-
-# LT_PATH_NM
-# ----------
-# find the pathname to a BSD- or MS-compatible name lister
-AC_DEFUN([LT_PATH_NM],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
-[if test -n "$NM"; then
-  # Let the user override the test.
-  lt_cv_path_NM="$NM"
-else
-  lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
-  fi
-  for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
-      test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
-	  lt_cv_path_NM="$tmp_nm -B"
-	  break
-	  ;;
-	*)
-	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
-	  */dev/null*)
-	    lt_cv_path_NM="$tmp_nm -p"
-	    break
-	    ;;
-	  *)
-	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-	    continue # so that we can try to find one that supports BSD flags
-	    ;;
-	  esac
-	  ;;
-	esac
-      fi
-    done
-    IFS="$lt_save_ifs"
-  done
-  : ${lt_cv_path_NM=no}
-fi])
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
-else
-  # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$DUMPBIN"; then :
-    # Let the user override the test.
-  else
-    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
-    *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
-      ;;
-    *)
-      DUMPBIN=:
-      ;;
-    esac
-  fi
-  AC_SUBST([DUMPBIN])
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
-  fi
-fi
-test -z "$NM" && NM=nm
-AC_SUBST([NM])
-_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
-
-AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
-  [lt_cv_nm_interface="BSD nm"
-  echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
-  (eval "$ac_compile" 2>conftest.err)
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
-  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
-  cat conftest.out >&AS_MESSAGE_LOG_FD
-  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
-    lt_cv_nm_interface="MS dumpbin"
-  fi
-  rm -f conftest*])
-])# LT_PATH_NM
-
-# Old names:
-AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
-AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_NM], [])
-dnl AC_DEFUN([AC_PROG_NM], [])
-
-# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-# --------------------------------
-# how to determine the name of the shared library
-# associated with a specific link library.
-#  -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-m4_require([_LT_DECL_DLLTOOL])
-AC_CACHE_CHECK([how to associate runtime and link libraries],
-lt_cv_sharedlib_from_linklib_cmd,
-[lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
-  case `$DLLTOOL --help 2>&1` in
-  *--identify-strict*)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
-    ;;
-  *)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
-    ;;
-  esac
-  ;;
-*)
-  # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
-  ;;
-esac
-])
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
-    [Command to associate shared and link libraries])
-])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-
-
-# _LT_PATH_MANIFEST_TOOL
-# ----------------------
-# locate the manifest tool
-m4_defun([_LT_PATH_MANIFEST_TOOL],
-[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
-  [lt_cv_path_mainfest_tool=no
-  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
-  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
-    lt_cv_path_mainfest_tool=yes
-  fi
-  rm -f conftest*])
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
-  MANIFEST_TOOL=:
-fi
-_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
-])# _LT_PATH_MANIFEST_TOOL
-
-
-# LT_LIB_M
-# --------
-# check for math library
-AC_DEFUN([LT_LIB_M],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
-  # These system don't have libm, or don't need it
-  ;;
-*-ncr-sysv4.3*)
-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
-  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
-  ;;
-*)
-  AC_CHECK_LIB(m, cos, LIBM="-lm")
-  ;;
-esac
-AC_SUBST([LIBM])
-])# LT_LIB_M
-
-# Old name:
-AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_CHECK_LIBM], [])
-
-
-# _LT_COMPILER_NO_RTTI([TAGNAME])
-# -------------------------------
-m4_defun([_LT_COMPILER_NO_RTTI],
-[m4_require([_LT_TAG_COMPILER])dnl
-
-_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-
-if test "$GCC" = yes; then
-  case $cc_basename in
-  nvcc*)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
-  *)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
-  esac
-
-  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
-    lt_cv_prog_compiler_rtti_exceptions,
-    [-fno-rtti -fno-exceptions], [],
-    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
-fi
-_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
-	[Compiler flag to turn off builtin functions])
-])# _LT_COMPILER_NO_RTTI
-
-
-# _LT_CMD_GLOBAL_SYMBOLS
-# ----------------------
-m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output from $compiler object])
-AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
-[
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[[BCDEGRST]]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
-
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[[BCDT]]'
-  ;;
-cygwin* | mingw* | pw32* | cegcc*)
-  symcode='[[ABCDGISTW]]'
-  ;;
-hpux*)
-  if test "$host_cpu" = ia64; then
-    symcode='[[ABCDEGRST]]'
-  fi
-  ;;
-irix* | nonstopux*)
-  symcode='[[BCDEGRST]]'
-  ;;
-osf*)
-  symcode='[[BCDEGQRST]]'
-  ;;
-solaris*)
-  symcode='[[BDRT]]'
-  ;;
-sco3.2v5*)
-  symcode='[[DT]]'
-  ;;
-sysv4.2uw2*)
-  symcode='[[DT]]'
-  ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
-  symcode='[[ABDT]]'
-  ;;
-sysv4)
-  symcode='[[DFNSTU]]'
-  ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[[ABCDGIRSTW]]' ;;
-esac
-
-# Transform an extracted symbol line into a proper C declaration.
-# Some systems (esp. on ia64) link data and code symbols differently,
-# so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
-
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $build_os in
-mingw*)
-  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-  ;;
-esac
-
-# Try without a prefix underscore, then with it.
-for ac_symprfx in "" "_"; do
-
-  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
-  symxfrm="\\1 $ac_symprfx\\2 \\2"
-
-  # Write the raw and C identifiers.
-  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
-    # Also find C++ and __fastcall symbols from MSVC++,
-    # which start with @ or ?.
-    lt_cv_sys_global_symbol_pipe="$AWK ['"\
-"     {last_section=section; section=\$ 3};"\
-"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
-"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-"     \$ 0!~/External *\|/{next};"\
-"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-"     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
-"     ' prfx=^$ac_symprfx]"
-  else
-    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-  fi
-  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
-
-  # Check to see that the pipe works correctly.
-  pipe_works=no
-
-  rm -f conftest*
-  cat > conftest.$ac_ext <<_LT_EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(void);
-void nm_test_func(void){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-_LT_EOF
-
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
-	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT@&t at _DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT@&t at _DLSYM_CONST
-#else
-# define LT@&t at _DLSYM_CONST const
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-_LT_EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
-
-	  cat <<_LT_EOF >> conftest.$ac_ext
-
-/* The mapping between symbol names and symbols.  */
-LT@&t at _DLSYM_CONST struct {
-  const char *name;
-  void       *address;
-}
-lt__PROGRAM__LTX_preloaded_symbols[[]] =
-{
-  { "@PROGRAM@", (void *) 0 },
-_LT_EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
-	  cat <<\_LT_EOF >> conftest.$ac_ext
-  {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt__PROGRAM__LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-_LT_EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_globsym_save_LIBS=$LIBS
-	  lt_globsym_save_CFLAGS=$CFLAGS
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
-	    pipe_works=yes
-	  fi
-	  LIBS=$lt_globsym_save_LIBS
-	  CFLAGS=$lt_globsym_save_CFLAGS
-	else
-	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
-      fi
-    else
-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
-    fi
-  else
-    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
-    cat conftest.$ac_ext >&5
-  fi
-  rm -rf conftest* conftst*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    lt_cv_sys_global_symbol_pipe=
-  fi
-done
-])
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
-  lt_cv_sys_global_symbol_to_cdecl=
-fi
-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  AC_MSG_RESULT(failed)
-else
-  AC_MSG_RESULT(ok)
-fi
-
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-  nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
-  nm_file_list_spec='@'
-fi
-
-_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
-    [Take the output of nm and produce a listing of raw symbols and C names])
-_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
-    [Transform the output of nm in a proper C declaration])
-_LT_DECL([global_symbol_to_c_name_address],
-    [lt_cv_sys_global_symbol_to_c_name_address], [1],
-    [Transform the output of nm in a C name address pair])
-_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
-    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
-    [Transform the output of nm in a C name address pair when lib prefix is needed])
-_LT_DECL([], [nm_file_list_spec], [1],
-    [Specify filename containing input files for $NM])
-]) # _LT_CMD_GLOBAL_SYMBOLS
-
-
-# _LT_COMPILER_PIC([TAGNAME])
-# ---------------------------
-m4_defun([_LT_COMPILER_PIC],
-[m4_require([_LT_TAG_COMPILER])dnl
-_LT_TAGVAR(lt_prog_compiler_wl, $1)=
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-_LT_TAGVAR(lt_prog_compiler_static, $1)=
-
-m4_if([$1], [CXX], [
-  # C++ specific cases for pic, static, wl, etc.
-  if test "$GXX" = yes; then
-    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-    aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-    mingw* | cygwin* | os2* | pw32* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-    *djgpp*)
-      # DJGPP does not support shared libraries at all
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-      ;;
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=
-      ;;
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-    *qnx* | *nto*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-    *)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-  else
-    case $host_os in
-      aix[[4-9]]*)
-	# All AIX code is PIC.
-	if test "$host_cpu" = ia64; then
-	  # AIX 5 now supports IA64 processor
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	else
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-	fi
-	;;
-      chorus*)
-	case $cc_basename in
-	cxch68*)
-	  # Green Hills C++ Compiler
-	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
-	  ;;
-	esac
-	;;
-      mingw* | cygwin* | os2* | pw32* | cegcc*)
-	# This hack is so that the source file can tell whether it is being
-	# built for inclusion in a dll (and should export symbols for example).
-	m4_if([$1], [GCJ], [],
-	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-	;;
-      dgux*)
-	case $cc_basename in
-	  ec++*)
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  ghcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      freebsd* | dragonfly*)
-	# FreeBSD uses GNU C++
-	;;
-      hpux9* | hpux10* | hpux11*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    if test "$host_cpu" != ia64; then
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	    fi
-	    ;;
-	  aCC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    case $host_cpu in
-	    hppa*64*|ia64*)
-	      # +Z the default
-	      ;;
-	    *)
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	      ;;
-	    esac
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      interix*)
-	# This is c89, which is MS Visual C++ (no shared libs)
-	# Anyone wants to do a port?
-	;;
-      irix5* | irix6* | nonstopux*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    # CC pic flag -KPIC is the default.
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
-	case $cc_basename in
-	  KCC*)
-	    # KAI C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    ;;
-	  ecpc* )
-	    # old Intel C++ for x86_64 which still supported -KPIC.
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  icpc* )
-	    # Intel C++, used to be incompatible with GCC.
-	    # ICC 10 doesn't accept -KPIC any more.
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  pgCC* | pgcpp*)
-	    # Portland Group C++ compiler
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  cxx*)
-	    # Compaq C++
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
-	    # IBM XL 8.0, 9.0 on PPC and BlueGene
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-      lynxos*)
-	;;
-      m88k*)
-	;;
-      mvs*)
-	case $cc_basename in
-	  cxx*)
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      netbsd*)
-	;;
-      *qnx* | *nto*)
-        # QNX uses GNU C++, but need to define -shared option too, otherwise
-        # it will coredump.
-        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-        ;;
-      osf3* | osf4* | osf5*)
-	case $cc_basename in
-	  KCC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    ;;
-	  RCC*)
-	    # Rational C++ 2.4.1
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  cxx*)
-	    # Digital/Compaq C++
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      psos*)
-	;;
-      solaris*)
-	case $cc_basename in
-	  CC* | sunCC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	    ;;
-	  gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sunos4*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.x
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  lcc*)
-	    # Lucid
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-	case $cc_basename in
-	  CC*)
-	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	esac
-	;;
-      tandem*)
-	case $cc_basename in
-	  NCC*)
-	    # NonStop-UX NCC 3.20
-	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      vxworks*)
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-	;;
-    esac
-  fi
-],
-[
-  if test "$GCC" = yes; then
-    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-        ;;
-      m68k)
-            # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
-            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-        ;;
-      esac
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=
-      ;;
-
-    hpux*)
-      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
-      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
-      # sets the default TLS model and affects inlining.
-      case $host_cpu in
-      hppa*64*)
-	# +Z the default
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      enable_shared=no
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-
-    *)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-
-    case $cc_basename in
-    nvcc*) # Cuda Compiler Driver 2.2
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
-      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
-        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
-      fi
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      else
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-
-    mingw* | cygwin* | pw32* | os2* | cegcc*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      m4_if([$1], [GCJ], [],
-	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC (with -KPIC) is the default.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
-      case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
-      ecc*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      # icc used to be incompatible with GCC.
-      # ICC 10 doesn't accept -KPIC any more.
-      icc* | ifort*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      # Lahey Fortran 8.1.
-      lf95*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
-	;;
-      nagfor*)
-	# NAG Fortran compiler
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-        ;;
-      ccc*)
-        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-        # All Alpha code is PIC.
-        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-        ;;
-      xl* | bgxl* | bgf* | mpixl*)
-	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
-	  ;;
-	*Sun\ F* | *Sun*Fortran*)
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	  ;;
-	*Sun\ C*)
-	  # Sun C 5.9
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  ;;
-        *Intel*\ [[CF]]*Compiler*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	  ;;
-	*Portland\ Group*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  ;;
-	esac
-	;;
-      esac
-      ;;
-
-    newsos6)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *nto* | *qnx*)
-      # QNX uses GNU C++, but need to define -shared option too, otherwise
-      # it will coredump.
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
-      ;;
-
-    osf3* | osf4* | osf5*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # All OSF/1 code is PIC.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    rdos*)
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    solaris*)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
-      *)
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    unicos*)
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-
-    uts4*)
-      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *)
-      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-    esac
-  fi
-])
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
-    ;;
-  *)
-    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
-    ;;
-esac
-
-AC_CACHE_CHECK([for $compiler option to produce PIC],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
-  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
-    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
-    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
-    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
-     "" | " "*) ;;
-     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
-     esac],
-    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
-fi
-_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
-	[Additional compiler flags for building library objects])
-
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
-	[How to pass a linker flag through the compiler])
-#
-# Check to make sure the static flag actually works.
-#
-wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
-_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
-  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
-  $lt_tmp_static_flag,
-  [],
-  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
-_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
-	[Compiler flag to prevent dynamic linking])
-])# _LT_COMPILER_PIC
-
-
-# _LT_LINKER_SHLIBS([TAGNAME])
-# ----------------------------
-# See if the linker supports building shared libraries.
-m4_defun([_LT_LINKER_SHLIBS],
-[AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-m4_if([$1], [CXX], [
-  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-  case $host_os in
-  aix[[4-9]]*)
-    # If we're using GNU nm, then we don't want the "-C" option.
-    # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    # Also, AIX nm treats weak defined symbols like other global defined
-    # symbols, whereas GNU nm marks them as "W".
-    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-    else
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-    fi
-    ;;
-  pw32*)
-    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-    ;;
-  cygwin* | mingw* | cegcc*)
-    case $cc_basename in
-    cl*)
-      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-      ;;
-    *)
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
-      ;;
-    esac
-    ;;
-  *)
-    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-    ;;
-  esac
-], [
-  runpath_var=
-  _LT_TAGVAR(allow_undefined_flag, $1)=
-  _LT_TAGVAR(always_export_symbols, $1)=no
-  _LT_TAGVAR(archive_cmds, $1)=
-  _LT_TAGVAR(archive_expsym_cmds, $1)=
-  _LT_TAGVAR(compiler_needs_object, $1)=no
-  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
-  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  _LT_TAGVAR(hardcode_automatic, $1)=no
-  _LT_TAGVAR(hardcode_direct, $1)=no
-  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
-  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-  _LT_TAGVAR(hardcode_libdir_separator, $1)=
-  _LT_TAGVAR(hardcode_minus_L, $1)=no
-  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_TAGVAR(inherit_rpath, $1)=no
-  _LT_TAGVAR(link_all_deplibs, $1)=unknown
-  _LT_TAGVAR(module_cmds, $1)=
-  _LT_TAGVAR(module_expsym_cmds, $1)=
-  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
-  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
-  _LT_TAGVAR(thread_safe_flag_spec, $1)=
-  _LT_TAGVAR(whole_archive_flag_spec, $1)=
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  _LT_TAGVAR(include_expsyms, $1)=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-dnl Note also adjust exclude_expsyms for C++ above.
-  extract_expsyms_cmds=
-
-  case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
-
-  _LT_TAGVAR(ld_shlibs, $1)=yes
-
-  # On some targets, GNU ld is compatible enough with the native linker
-  # that we're better off using the native interface for both.
-  lt_use_gnu_ld_interface=no
-  if test "$with_gnu_ld" = yes; then
-    case $host_os in
-      aix*)
-	# The AIX port of GNU ld has always aspired to compatibility
-	# with the native linker.  However, as the warning in the GNU ld
-	# block says, versions before 2.19.5* couldn't really create working
-	# shared libraries, regardless of the interface used.
-	case `$LD -v 2>&1` in
-	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
-	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
-	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
-	  *)
-	    lt_use_gnu_ld_interface=yes
-	    ;;
-	esac
-	;;
-      *)
-	lt_use_gnu_ld_interface=yes
-	;;
-    esac
-  fi
-
-  if test "$lt_use_gnu_ld_interface" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
-
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      _LT_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>&1` in
-      *GNU\ gold*) supports_anon_versioning=yes ;;
-      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
-
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[[3-9]]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.19, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
-
-_LT_EOF
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            _LT_TAGVAR(archive_expsym_cmds, $1)=''
-        ;;
-      m68k)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes
-        ;;
-      esac
-      ;;
-
-    beos*)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-      # as there is no search path for DLLs.
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(always_export_symbols, $1)=no
-      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
-
-      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    haiku*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    interix[[3-9]]*)
-      _LT_TAGVAR(hardcode_direct, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
-
-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
-      tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
-	case $cc_basename in
-	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
-	esac
-      fi
-      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
-      then
-	tmp_addflag=' $pic_flag'
-	tmp_sharedflag='-shared'
-	case $cc_basename,$host_cpu in
-        pgcc*)				# Portland Group C compiler
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95* | pgfortran*)
-					# Portland Group f77 and f90 compilers
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	lf95*)				# Lahey Fortran 8.1
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
-	  tmp_sharedflag='--shared' ;;
-	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
-	  tmp_sharedflag='-qmkshrobj'
-	  tmp_addflag= ;;
-	nvcc*)	# Cuda Compiler Driver 2.2
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  _LT_TAGVAR(compiler_needs_object, $1)=yes
-	  ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  _LT_TAGVAR(compiler_needs_object, $1)=yes
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	esac
-	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
-        if test "x$supports_anon_versioning" = xyes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	    echo "local: *; };" >> $output_objdir/$libname.ver~
-	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-        fi
-
-	case $cc_basename in
-	xlf* | bgf* | bgxlf* | mpixlf*)
-	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; then
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
-	  fi
-	  ;;
-	esac
-      else
-        _LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
-
-    solaris*)
-      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-	;;
-	*)
-	  # For security reasons, it is highly recommended that you always
-	  # use absolute paths for naming shared libraries, and exclude the
-	  # DT_RUNPATH tag from executables and libraries.  But doing so
-	  # requires that you compile everything twice, which is a pain.
-	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  else
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	;;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-    esac
-
-    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
-      runpath_var=
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
-      _LT_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(always_export_symbols, $1)=yes
-      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	_LT_TAGVAR(hardcode_direct, $1)=unsupported
-      fi
-      ;;
-
-    aix[[4-9]]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
-	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	else
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
-
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	  for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-	    aix_use_runtimelinking=yes
-	    break
-	  fi
-	  done
-	  ;;
-	esac
-
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
-
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-      _LT_TAGVAR(archive_cmds, $1)=''
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
-
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[[012]]|aix4.[[012]].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" &&
-	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-	  then
-	  # We have reworked collect2
-	  :
-	  else
-	  # We have old collect2
-	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
-
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      _LT_TAGVAR(always_export_symbols, $1)=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
-        # Determine the default libpath from the value encoded in an
-        # empty executable.
-        _LT_SYS_MODULE_PATH_AIX([$1])
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-      else
-	if test "$host_cpu" = ia64; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an
-	 # empty executable.
-	 _LT_SYS_MODULE_PATH_AIX([$1])
-	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  if test "$with_gnu_ld" = yes; then
-	    # We only use this code for GNU lds that support --whole-archive.
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	  else
-	    # Exported symbols can be pulled into shared objects from archives
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	  fi
-	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
-
-    amigaos*)
-      case $host_cpu in
-      powerpc)
-            # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-            _LT_TAGVAR(archive_expsym_cmds, $1)=''
-        ;;
-      m68k)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes
-        ;;
-      esac
-      ;;
-
-    bsdi[[45]]*)
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
-      ;;
-
-    cygwin* | mingw* | pw32* | cegcc*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      case $cc_basename in
-      cl*)
-	# Native MSVC
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	_LT_TAGVAR(always_export_symbols, $1)=yes
-	_LT_TAGVAR(file_list_spec, $1)='@'
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
-	# The linker will not automatically build a static lib if we build a DLL.
-	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-	# Don't use ranlib
-	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
-	;;
-      *)
-	# Assume MSVC wrapper
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
-	# The linker will automatically build a .lib file if we build a DLL.
-	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	# FIXME: Should let the user specify the lib program.
-	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	;;
-      esac
-      ;;
-
-    darwin* | rhapsody*)
-      _LT_DARWIN_LINKER_FEATURES($1)
-      ;;
-
-    dgux*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2.*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    hpux9*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      ;;
-
-    hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
-	_LT_TAGVAR(hardcode_direct, $1)=yes
-	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	_LT_TAGVAR(hardcode_minus_L, $1)=yes
-      fi
-      ;;
-
-    hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	m4_if($1, [], [
-	  # Older versions of the 11.00 compiler do not understand -b yet
-	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
-	  _LT_LINKER_OPTION([if $CC understands -b],
-	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
-	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
-	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
-	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  _LT_TAGVAR(hardcode_direct, $1)=no
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  ;;
-	*)
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
-	  ;;
-	esac
-      fi
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	# Try to use the -exported_symbol ld option, if it does not
-	# work, assume that -exports_file does not work either and
-	# implicitly export all symbols.
-	# This should be the same for all languages, so no per-tag cache variable.
-	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
-	  [lt_cv_irix_exported_symbol],
-	  [save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-	   AC_LINK_IFELSE(
-	     [AC_LANG_SOURCE(
-	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
-			      [C++], [[int foo (void) { return 0; }]],
-			      [Fortran 77], [[
-      subroutine foo
-      end]],
-			      [Fortran], [[
-      subroutine foo
-      end]])])],
-	      [lt_cv_irix_exported_symbol=yes],
-	      [lt_cv_irix_exported_symbol=no])
-           LDFLAGS="$save_LDFLAGS"])
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-	fi
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(inherit_rpath, $1)=yes
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    netbsd*)
-      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    newsos6)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *nto* | *qnx*)
-      ;;
-
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	_LT_TAGVAR(hardcode_direct, $1)=yes
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	     ;;
-	   *)
-	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-	fi
-      else
-	_LT_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    os2*)
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
-
-    osf3*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      else
-	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
-
-	# Both c and cxx compiler support -rpath directly
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-      fi
-      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    solaris*)
-      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-      else
-	case `$CC -V 2>&1` in
-	*"Compilers 5.0"*)
-	  wlarc=''
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
-	  ;;
-	*)
-	  wlarc='${wl}'
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
-	  ;;
-	esac
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      case $host_os in
-      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
-	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4)
-      case $host_vendor in
-	sni)
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
-	  _LT_TAGVAR(hardcode_direct, $1)=no
-        ;;
-	motorola)
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4.3*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	_LT_TAGVAR(ld_shlibs, $1)=yes
-      fi
-      ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
-      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    uts4*)
-      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      _LT_TAGVAR(ld_shlibs, $1)=no
-      ;;
-    esac
-
-    if test x$host_vendor = xsni; then
-      case $host in
-      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
-	;;
-      esac
-    fi
-  fi
-])
-AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
-
-_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
-_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
-_LT_DECL([], [extract_expsyms_cmds], [2],
-    [The commands to extract the exported symbol list from a shared archive])
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
-x|xyes)
-  # Assume -lc should be added
-  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $_LT_TAGVAR(archive_cmds, $1) in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
-	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
-	[$RM conftest*
-	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-	  soname=conftest
-	  lib=conftest
-	  libobjs=conftest.$ac_objext
-	  deplibs=
-	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
-	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
-	  compiler_flags=-v
-	  linker_flags=-v
-	  verstring=
-	  output_objdir=.
-	  libname=conftest
-	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
-	  _LT_TAGVAR(allow_undefined_flag, $1)=
-	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
-	  then
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	  else
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  fi
-	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-	else
-	  cat conftest.err 1>&5
-	fi
-	$RM conftest*
-	])
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
-      ;;
-    esac
-  fi
-  ;;
-esac
-
-_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
-    [Whether or not to add -lc for building shared libraries])
-_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
-    [enable_shared_with_static_runtimes], [0],
-    [Whether or not to disallow shared libs when runtime libs are static])
-_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
-    [Compiler flag to allow reflexive dlopens])
-_LT_TAGDECL([], [whole_archive_flag_spec], [1],
-    [Compiler flag to generate shared objects directly from archives])
-_LT_TAGDECL([], [compiler_needs_object], [1],
-    [Whether the compiler copes with passing no objects directly])
-_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
-    [Create an old-style archive from a shared archive])
-_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
-    [Create a temporary old-style archive to link instead of a shared archive])
-_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
-_LT_TAGDECL([], [archive_expsym_cmds], [2])
-_LT_TAGDECL([], [module_cmds], [2],
-    [Commands used to build a loadable module if different from building
-    a shared archive.])
-_LT_TAGDECL([], [module_expsym_cmds], [2])
-_LT_TAGDECL([], [with_gnu_ld], [1],
-    [Whether we are building with GNU ld or not])
-_LT_TAGDECL([], [allow_undefined_flag], [1],
-    [Flag that allows shared libraries with undefined symbols to be built])
-_LT_TAGDECL([], [no_undefined_flag], [1],
-    [Flag that enforces no undefined symbols])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
-    [Flag to hardcode $libdir into a binary during linking.
-    This must work even if $libdir does not exist])
-_LT_TAGDECL([], [hardcode_libdir_separator], [1],
-    [Whether we need a single "-rpath" flag with a separated argument])
-_LT_TAGDECL([], [hardcode_direct], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-    DIR into the resulting binary])
-_LT_TAGDECL([], [hardcode_direct_absolute], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
-    DIR into the resulting binary and the resulting library dependency is
-    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
-    library is relocated])
-_LT_TAGDECL([], [hardcode_minus_L], [0],
-    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-    into the resulting binary])
-_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
-    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-    into the resulting binary])
-_LT_TAGDECL([], [hardcode_automatic], [0],
-    [Set to "yes" if building a shared library automatically hardcodes DIR
-    into the library and all subsequent libraries and executables linked
-    against it])
-_LT_TAGDECL([], [inherit_rpath], [0],
-    [Set to yes if linker adds runtime paths of dependent libraries
-    to runtime path list])
-_LT_TAGDECL([], [link_all_deplibs], [0],
-    [Whether libtool must link a program against all its dependency libraries])
-_LT_TAGDECL([], [always_export_symbols], [0],
-    [Set to "yes" if exported symbols are required])
-_LT_TAGDECL([], [export_symbols_cmds], [2],
-    [The commands to list exported symbols])
-_LT_TAGDECL([], [exclude_expsyms], [1],
-    [Symbols that should not be listed in the preloaded symbols])
-_LT_TAGDECL([], [include_expsyms], [1],
-    [Symbols that must always be exported])
-_LT_TAGDECL([], [prelink_cmds], [2],
-    [Commands necessary for linking programs (against libraries) with templates])
-_LT_TAGDECL([], [postlink_cmds], [2],
-    [Commands necessary for finishing linking programs])
-_LT_TAGDECL([], [file_list_spec], [1],
-    [Specify filename containing input files])
-dnl FIXME: Not yet implemented
-dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
-dnl    [Compiler flag to generate thread safe objects])
-])# _LT_LINKER_SHLIBS
-
-
-# _LT_LANG_C_CONFIG([TAG])
-# ------------------------
-# Ensure that the configuration variables for a C compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_C_CONFIG],
-[m4_require([_LT_DECL_EGREP])dnl
-lt_save_CC="$CC"
-AC_LANG_PUSH(C)
-
-# Source file extension for C test sources.
-ac_ext=c
-
-# Object file extension for compiled C test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
-
-_LT_TAG_COMPILER
-# Save the default compiler, since it gets overwritten when the other
-# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
-compiler_DEFAULT=$CC
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_SYS_DYNAMIC_LINKER($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-  LT_SYS_DLOPEN_SELF
-  _LT_CMD_STRIPLIB
-
-  # Report which library types will actually be built
-  AC_MSG_CHECKING([if libtool supports shared libraries])
-  AC_MSG_RESULT([$can_build_shared])
-
-  AC_MSG_CHECKING([whether to build shared libraries])
-  test "$can_build_shared" = "no" && enable_shared=no
-
-  # On AIX, shared libraries and static libraries use the same namespace, and
-  # are all built from PIC.
-  case $host_os in
-  aix3*)
-    test "$enable_shared" = yes && enable_static=no
-    if test -n "$RANLIB"; then
-      archive_cmds="$archive_cmds~\$RANLIB \$lib"
-      postinstall_cmds='$RANLIB $lib'
-    fi
-    ;;
-
-  aix[[4-9]]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
-    fi
-    ;;
-  esac
-  AC_MSG_RESULT([$enable_shared])
-
-  AC_MSG_CHECKING([whether to build static libraries])
-  # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
-  AC_MSG_RESULT([$enable_static])
-
-  _LT_CONFIG($1)
-fi
-AC_LANG_POP
-CC="$lt_save_CC"
-])# _LT_LANG_C_CONFIG
-
-
-# _LT_LANG_CXX_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a C++ compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_CXX_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  AC_PROG_CXXCPP
-else
-  _lt_caught_CXX_error=yes
-fi
-
-AC_LANG_PUSH(C++)
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(compiler_needs_object, $1)=no
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# Object file extension for compiled C++ test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the CXX compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_caught_CXX_error" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="int some_variable = 0;"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-  _LT_TAG_COMPILER
-
-  # save warnings/boilerplate of simple test code
-  _LT_COMPILER_BOILERPLATE
-  _LT_LINKER_BOILERPLATE
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC=$CC
-  lt_save_CFLAGS=$CFLAGS
-  lt_save_LD=$LD
-  lt_save_GCC=$GCC
-  GCC=$GXX
-  lt_save_with_gnu_ld=$with_gnu_ld
-  lt_save_path_LD=$lt_cv_path_LD
-  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
-    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
-  else
-    $as_unset lt_cv_prog_gnu_ld
-  fi
-  if test -n "${lt_cv_path_LDCXX+set}"; then
-    lt_cv_path_LD=$lt_cv_path_LDCXX
-  else
-    $as_unset lt_cv_path_LD
-  fi
-  test -z "${LDCXX+set}" || LD=$LDCXX
-  CC=${CXX-"c++"}
-  CFLAGS=$CXXFLAGS
-  compiler=$CC
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-
-  if test -n "$compiler"; then
-    # We don't want -fno-exception when compiling C++ code, so set the
-    # no_builtin_flag separately
-    if test "$GXX" = yes; then
-      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-    else
-      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-    fi
-
-    if test "$GXX" = yes; then
-      # Set up default GNU C++ configuration
-
-      LT_PATH_LD
-
-      # Check if GNU C++ uses GNU ld as the underlying linker, since the
-      # archiving commands below assume that GNU ld is being used.
-      if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-        # If archive_cmds runs LD, not CC, wlarc should be empty
-        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
-        #     investigate it a little bit more. (MM)
-        wlarc='${wl}'
-
-        # ancient GNU ld didn't support --whole-archive et. al.
-        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
-	  $GREP 'no-whole-archive' > /dev/null; then
-          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-        else
-          _LT_TAGVAR(whole_archive_flag_spec, $1)=
-        fi
-      else
-        with_gnu_ld=no
-        wlarc=
-
-        # A generic and very simple default shared library creation
-        # command for GNU C++ for the case where it uses the native
-        # linker, instead of GNU ld.  If possible, this setting should
-        # overridden to take advantage of the native linker features on
-        # the platform it is being used on.
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-      fi
-
-      # Commands to make compiler produce verbose output that lists
-      # what "hidden" libraries, object files and flags are used when
-      # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-
-    else
-      GXX=no
-      with_gnu_ld=no
-      wlarc=
-    fi
-
-    # PORTME: fill in a description of your system's C++ link characteristics
-    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-    _LT_TAGVAR(ld_shlibs, $1)=yes
-    case $host_os in
-      aix3*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-      aix[[4-9]]*)
-        if test "$host_cpu" = ia64; then
-          # On IA64, the linker does run time linking by default, so we don't
-          # have to do anything special.
-          aix_use_runtimelinking=no
-          exp_sym_flag='-Bexport'
-          no_entry_flag=""
-        else
-          aix_use_runtimelinking=no
-
-          # Test if we are trying to use run time linking or normal
-          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-          # need to do runtime linking.
-          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	    for ld_flag in $LDFLAGS; do
-	      case $ld_flag in
-	      *-brtl*)
-	        aix_use_runtimelinking=yes
-	        break
-	        ;;
-	      esac
-	    done
-	    ;;
-          esac
-
-          exp_sym_flag='-bexport'
-          no_entry_flag='-bnoentry'
-        fi
-
-        # When large executables or shared objects are built, AIX ld can
-        # have problems creating the table of contents.  If linking a library
-        # or program results in "error TOC overflow" add -mminimal-toc to
-        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-        _LT_TAGVAR(archive_cmds, $1)=''
-        _LT_TAGVAR(hardcode_direct, $1)=yes
-        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-        _LT_TAGVAR(link_all_deplibs, $1)=yes
-        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
-
-        if test "$GXX" = yes; then
-          case $host_os in aix4.[[012]]|aix4.[[012]].*)
-          # We only want to do this on AIX 4.2 and lower, the check
-          # below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" &&
-	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
-	  then
-	    # We have reworked collect2
-	    :
-	  else
-	    # We have old collect2
-	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
-	    # It fails to find uninstalled libraries when the uninstalled
-	    # path is not listed in the libpath.  Setting hardcode_minus_L
-	    # to unsupported forces relinking
-	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
-	  fi
-          esac
-          shared_flag='-shared'
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag="$shared_flag "'${wl}-G'
-	  fi
-        else
-          # not using gcc
-          if test "$host_cpu" = ia64; then
-	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	  # chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-          else
-	    if test "$aix_use_runtimelinking" = yes; then
-	      shared_flag='${wl}-G'
-	    else
-	      shared_flag='${wl}-bM:SRE'
-	    fi
-          fi
-        fi
-
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
-        # It seems that -bexpall does not export symbols beginning with
-        # underscore (_), so it is better to generate a list of symbols to
-	# export.
-        _LT_TAGVAR(always_export_symbols, $1)=yes
-        if test "$aix_use_runtimelinking" = yes; then
-          # Warning - without using the other runtime loading flags (-brtl),
-          # -berok will link without error, but may produce a broken library.
-          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
-          # Determine the default libpath from the value encoded in an empty
-          # executable.
-          _LT_SYS_MODULE_PATH_AIX([$1])
-          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-        else
-          if test "$host_cpu" = ia64; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-          else
-	    # Determine the default libpath from the value encoded in an
-	    # empty executable.
-	    _LT_SYS_MODULE_PATH_AIX([$1])
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	    # Warning - without using the other run time loading flags,
-	    # -berok will link without error, but may produce a broken library.
-	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	    if test "$with_gnu_ld" = yes; then
-	      # We only use this code for GNU lds that support --whole-archive.
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    else
-	      # Exported symbols can be pulled into shared objects from archives
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	    fi
-	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	    # This is similar to how AIX traditionally builds its shared
-	    # libraries.
-	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-          fi
-        fi
-        ;;
-
-      beos*)
-	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	  # support --undefined.  This deserves some investigation.  FIXME
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	else
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-
-      chorus*)
-        case $cc_basename in
-          *)
-	  # FIXME: insert proper C++ library support
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	  ;;
-        esac
-        ;;
-
-      cygwin* | mingw* | pw32* | cegcc*)
-	case $GXX,$cc_basename in
-	,cl* | no,cl*)
-	  # Native MSVC
-	  # hardcode_libdir_flag_spec is actually meaningless, as there is
-	  # no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=yes
-	  _LT_TAGVAR(file_list_spec, $1)='@'
-	  # Tell ltmain to make .lib files, not .a files.
-	  libext=lib
-	  # Tell ltmain to make .dll files, not .so files.
-	  shrext_cmds=".dll"
-	  # FIXME: Setting linknames here is a bad hack.
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	    else
-	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	    fi~
-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	    linknames='
-	  # The linker will not automatically build a static lib if we build a DLL.
-	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	  # Don't use ranlib
-	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	    lt_tool_outputfile="@TOOL_OUTPUT@"~
-	    case $lt_outputfile in
-	      *.exe|*.EXE) ;;
-	      *)
-		lt_outputfile="$lt_outputfile.exe"
-		lt_tool_outputfile="$lt_tool_outputfile.exe"
-		;;
-	    esac~
-	    func_to_tool_file "$lt_outputfile"~
-	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	      $RM "$lt_outputfile.manifest";
-	    fi'
-	  ;;
-	*)
-	  # g++
-	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-	  # as there is no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=no
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	    # If the export-symbols file already is a .def file (1st line
-	    # is EXPORTS), use it as is; otherwise, prepend...
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      cp $export_symbols $output_objdir/$soname.def;
-	    else
-	      echo EXPORTS > $output_objdir/$soname.def;
-	      cat $export_symbols >> $output_objdir/$soname.def;
-	    fi~
-	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	  else
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	  ;;
-	esac
-	;;
-      darwin* | rhapsody*)
-        _LT_DARWIN_LINKER_FEATURES($1)
-	;;
-
-      dgux*)
-        case $cc_basename in
-          ec++*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          ghcx*)
-	    # Green Hills C++ Compiler
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      freebsd2.*)
-        # C++ shared libraries reported to be fairly broken before
-	# switch to ELF
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      freebsd-elf*)
-        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-        ;;
-
-      freebsd* | dragonfly*)
-        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
-        # conventions
-        _LT_TAGVAR(ld_shlibs, $1)=yes
-        ;;
-
-      gnu*)
-        ;;
-
-      haiku*)
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(link_all_deplibs, $1)=yes
-        ;;
-
-      hpux9*)
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-        _LT_TAGVAR(hardcode_direct, $1)=yes
-        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-				             # but as the default
-				             # location of the library.
-
-        case $cc_basename in
-          CC*)
-            # FIXME: insert proper C++ library support
-            _LT_TAGVAR(ld_shlibs, $1)=no
-            ;;
-          aCC*)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-            # Commands to make compiler produce verbose output that lists
-            # what "hidden" libraries, object files and flags are used when
-            # linking a shared library.
-            #
-            # There doesn't appear to be a way to prevent this compiler from
-            # explicitly linking system object files so we need to strip them
-            # from the output so that they don't get included in the library
-            # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-            ;;
-          *)
-            if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-            else
-              # FIXME: insert proper C++ library support
-              _LT_TAGVAR(ld_shlibs, $1)=no
-            fi
-            ;;
-        esac
-        ;;
-
-      hpux10*|hpux11*)
-        if test $with_gnu_ld = no; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-          case $host_cpu in
-            hppa*64*|ia64*)
-              ;;
-            *)
-	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-              ;;
-          esac
-        fi
-        case $host_cpu in
-          hppa*64*|ia64*)
-            _LT_TAGVAR(hardcode_direct, $1)=no
-            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-            ;;
-          *)
-            _LT_TAGVAR(hardcode_direct, $1)=yes
-            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-					         # but as the default
-					         # location of the library.
-            ;;
-        esac
-
-        case $cc_basename in
-          CC*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          aCC*)
-	    case $host_cpu in
-	      hppa*64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	      ia64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	      *)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	        ;;
-	    esac
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-	    ;;
-          *)
-	    if test "$GXX" = yes; then
-	      if test $with_gnu_ld = no; then
-	        case $host_cpu in
-	          hppa*64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	          ia64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	          *)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	            ;;
-	        esac
-	      fi
-	    else
-	      # FIXME: insert proper C++ library support
-	      _LT_TAGVAR(ld_shlibs, $1)=no
-	    fi
-	    ;;
-        esac
-        ;;
-
-      interix[[3-9]]*)
-	_LT_TAGVAR(hardcode_direct, $1)=no
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-	# Instead, shared libraries are loaded at an image base (0x10000000 by
-	# default) and relocated if they conflict, which is a slow very memory
-	# consuming and fragmenting process.  To avoid this, we pick a random,
-	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-	;;
-      irix5* | irix6*)
-        case $cc_basename in
-          CC*)
-	    # SGI C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-
-	    # Archives containing C++ object files must be created using
-	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
-	    # necessary to make sure instantiated templates are included
-	    # in the archive.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
-	    ;;
-          *)
-	    if test "$GXX" = yes; then
-	      if test "$with_gnu_ld" = no; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	      else
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
-	      fi
-	    fi
-	    _LT_TAGVAR(link_all_deplibs, $1)=yes
-	    ;;
-        esac
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(inherit_rpath, $1)=yes
-        ;;
-
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
-        case $cc_basename in
-          KCC*)
-	    # Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	    # KCC will only create a shared library if the output file
-	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
-	    # to its proper name (with version) after linking.
-	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-	    # Archives containing C++ object files must be created using
-	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
-	    ;;
-	  icpc* | ecpc* )
-	    # Intel C++
-	    with_gnu_ld=yes
-	    # version 8.0 and above of icpc choke on multiply defined symbols
-	    # if we add $predep_objects and $postdep_objects, however 7.1 and
-	    # earlier do not add the objects themselves.
-	    case `$CC -V 2>&1` in
-	      *"Version 7."*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-		;;
-	      *)  # Version 8.0 or newer
-	        tmp_idyn=
-	        case $host_cpu in
-		  ia64*) tmp_idyn=' -i_dynamic';;
-		esac
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-		;;
-	    esac
-	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    ;;
-          pgCC* | pgcpp*)
-            # Portland Group C++ compiler
-	    case `$CC -V` in
-	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
-	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
-	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
-		$RANLIB $oldlib'
-	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-	      ;;
-	    *) # Version 6 and above use weak symbols
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-	      ;;
-	    esac
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-            ;;
-	  cxx*)
-	    # Compaq C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
-
-	    runpath_var=LD_RUN_PATH
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
-	    ;;
-	  xl* | mpixl* | bgxl*)
-	    # IBM XL 8.0 on PPC, with GNU ld
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    if test "x$supports_anon_versioning" = xyes; then
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-		echo "local: *; };" >> $output_objdir/$libname.ver~
-		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	    fi
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	      _LT_TAGVAR(compiler_needs_object, $1)=yes
-
-	      # Not sure whether something based on
-	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
-	      # would be better.
-	      output_verbose_link_cmd='func_echo_all'
-
-	      # Archives containing C++ object files must be created using
-	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	      # necessary to make sure instantiated templates are included
-	      # in the archive.
-	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-
-      lynxos*)
-        # FIXME: insert proper C++ library support
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      m88k*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      mvs*)
-        case $cc_basename in
-          cxx*)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-	  *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-	esac
-	;;
-
-      netbsd*)
-        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
-	  wlarc=
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	fi
-	# Workaround some broken pre-1.5 toolchains
-	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
-	;;
-
-      *nto* | *qnx*)
-        _LT_TAGVAR(ld_shlibs, $1)=yes
-	;;
-
-      openbsd2*)
-        # C++ shared libraries are fairly broken
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      openbsd*)
-	if test -f /usr/libexec/ld.so; then
-	  _LT_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-	  fi
-	  output_verbose_link_cmd=func_echo_all
-	else
-	  _LT_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-
-      osf3* | osf4* | osf5*)
-        case $cc_basename in
-          KCC*)
-	    # Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	    # KCC will only create a shared library if the output file
-	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
-	    # to its proper name (with version) after linking.
-	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Archives containing C++ object files must be created using
-	    # the KAI C++ compiler.
-	    case $host in
-	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
-	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
-	    esac
-	    ;;
-          RCC*)
-	    # Rational C++ 2.4.1
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          cxx*)
-	    case $host in
-	      osf3*)
-	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-		;;
-	      *)
-	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
-	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
-	          $RM $lib.exp'
-	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-		;;
-	    esac
-
-	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    #
-	    # There doesn't appear to be a way to prevent this compiler from
-	    # explicitly linking system object files so we need to strip them
-	    # from the output so that they don't get included in the library
-	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-	    ;;
-	  *)
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	      case $host in
-	        osf3*)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	        *)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-		  ;;
-	      esac
-
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	      # Commands to make compiler produce verbose output that lists
-	      # what "hidden" libraries, object files and flags are used when
-	      # linking a shared library.
-	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-
-	    else
-	      # FIXME: insert proper C++ library support
-	      _LT_TAGVAR(ld_shlibs, $1)=no
-	    fi
-	    ;;
-        esac
-        ;;
-
-      psos*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      sunos4*)
-        case $cc_basename in
-          CC*)
-	    # Sun C++ 4.x
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          lcc*)
-	    # Lucid
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      solaris*)
-        case $cc_basename in
-          CC* | sunCC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
-	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	    case $host_os in
-	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-	      *)
-		# The compiler driver will combine and reorder linker options,
-		# but understands `-z linker_flag'.
-	        # Supported since Solaris 2.6 (maybe 2.5.1?)
-		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	        ;;
-	    esac
-	    _LT_TAGVAR(link_all_deplibs, $1)=yes
-
-	    output_verbose_link_cmd='func_echo_all'
-
-	    # Archives containing C++ object files must be created using
-	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	    # necessary to make sure instantiated templates are included
-	    # in the archive.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	    ;;
-          gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-
-	    # The C++ compiler must be used to create the archive.
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
-	    ;;
-          *)
-	    # GNU C++ compiler with Solaris linker
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
-	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
-	        # Commands to make compiler produce verbose output that lists
-	        # what "hidden" libraries, object files and flags are used when
-	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-	      else
-	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
-	        # platform.
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
-	        # Commands to make compiler produce verbose output that lists
-	        # what "hidden" libraries, object files and flags are used when
-	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-	      fi
-
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
-	      case $host_os in
-		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-		*)
-		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-		  ;;
-	      esac
-	    fi
-	    ;;
-        esac
-        ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      case $cc_basename in
-        CC*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-      esac
-      ;;
-
-      sysv5* | sco3.2v5* | sco5v6*)
-	# Note: We can NOT use -z defs as we might desire, because we do not
-	# link with -lc, and that would cause any symbols used from libc to
-	# always be unresolved, which means just about no library would
-	# ever link correctly.  If we're not using GNU ld we use -z text
-	# though, which does catch some bad symbols but isn't as heavy-handed
-	# as -z defs.
-	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
-	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
-	_LT_TAGVAR(link_all_deplibs, $1)=yes
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-	runpath_var='LD_RUN_PATH'
-
-	case $cc_basename in
-          CC*)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
-	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
-	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
-	      '"$_LT_TAGVAR(reload_cmds, $1)"
-	    ;;
-	  *)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    ;;
-	esac
-      ;;
-
-      tandem*)
-        case $cc_basename in
-          NCC*)
-	    # NonStop-UX NCC 3.20
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-          *)
-	    # FIXME: insert proper C++ library support
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	    ;;
-        esac
-        ;;
-
-      vxworks*)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-
-      *)
-        # FIXME: insert proper C++ library support
-        _LT_TAGVAR(ld_shlibs, $1)=no
-        ;;
-    esac
-
-    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-    _LT_TAGVAR(GCC, $1)="$GXX"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_SYS_HIDDEN_LIBDEPS($1)
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
-  LDCXX=$LD
-  LD=$lt_save_LD
-  GCC=$lt_save_GCC
-  with_gnu_ld=$lt_save_with_gnu_ld
-  lt_cv_path_LDCXX=$lt_cv_path_LD
-  lt_cv_path_LD=$lt_save_path_LD
-  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
-  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-fi # test "$_lt_caught_CXX_error" != yes
-
-AC_LANG_POP
-])# _LT_LANG_CXX_CONFIG
-
-
-# _LT_FUNC_STRIPNAME_CNF
-# ----------------------
-# func_stripname_cnf prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-#
-# This function is identical to the (non-XSI) version of func_stripname,
-# except this one can be used by m4 code that may be executed by configure,
-# rather than the libtool script.
-m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
-AC_REQUIRE([_LT_DECL_SED])
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
-func_stripname_cnf ()
-{
-  case ${2} in
-  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-  esac
-} # func_stripname_cnf
-])# _LT_FUNC_STRIPNAME_CNF
-
-# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
-# ---------------------------------
-# Figure out "hidden" library dependencies from verbose
-# compiler output when linking a shared library.
-# Parse the compiler output and extract the necessary
-# objects, libraries and library flags.
-m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
-# Dependencies to place before and after the object being linked:
-_LT_TAGVAR(predep_objects, $1)=
-_LT_TAGVAR(postdep_objects, $1)=
-_LT_TAGVAR(predeps, $1)=
-_LT_TAGVAR(postdeps, $1)=
-_LT_TAGVAR(compiler_lib_search_path, $1)=
-
-dnl we can't use the lt_simple_compile_test_code here,
-dnl because it contains code intended for an executable,
-dnl not a library.  It's possible we should let each
-dnl tag define a new lt_????_link_test_code variable,
-dnl but it's only used here...
-m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
-int a;
-void foo (void) { a = 0; }
-_LT_EOF
-], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
-class Foo
-{
-public:
-  Foo (void) { a = 0; }
-private:
-  int a;
-};
-_LT_EOF
-], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
-      subroutine foo
-      implicit none
-      integer*4 a
-      a=0
-      return
-      end
-_LT_EOF
-], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
-      subroutine foo
-      implicit none
-      integer a
-      a=0
-      return
-      end
-_LT_EOF
-], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
-public class foo {
-  private int a;
-  public void bar (void) {
-    a = 0;
-  }
-};
-_LT_EOF
-], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
-package foo
-func foo() {
-}
-_LT_EOF
-])
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
-esac
-
-dnl Parse the compiler output and extract the necessary
-dnl objects, libraries and library flags.
-if AC_TRY_EVAL(ac_compile); then
-  # Parse the compiler output and extract the necessary
-  # objects, libraries and library flags.
-
-  # Sentinel used to keep track of whether or not we are before
-  # the conftest object file.
-  pre_test_object_deps_done=no
-
-  for p in `eval "$output_verbose_link_cmd"`; do
-    case ${prev}${p} in
-
-    -L* | -R* | -l*)
-       # Some compilers place space between "-{L,R}" and the path.
-       # Remove the space.
-       if test $p = "-L" ||
-          test $p = "-R"; then
-	 prev=$p
-	 continue
-       fi
-
-       # Expand the sysroot to ease extracting the directories later.
-       if test -z "$prev"; then
-         case $p in
-         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
-         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
-         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
-         esac
-       fi
-       case $p in
-       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
-       esac
-       if test "$pre_test_object_deps_done" = no; then
-	 case ${prev} in
-	 -L | -R)
-	   # Internal compiler library paths should come after those
-	   # provided the user.  The postdeps already come after the
-	   # user supplied libs so there is no need to process them.
-	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
-	   else
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
-	   fi
-	   ;;
-	 # The "-l" case would never come before the object being
-	 # linked, so don't bother handling this case.
-	 esac
-       else
-	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
-	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
-	 else
-	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
-	 fi
-       fi
-       prev=
-       ;;
-
-    *.lto.$objext) ;; # Ignore GCC LTO objects
-    *.$objext)
-       # This assumes that the test object file only shows up
-       # once in the compiler output.
-       if test "$p" = "conftest.$objext"; then
-	 pre_test_object_deps_done=yes
-	 continue
-       fi
-
-       if test "$pre_test_object_deps_done" = no; then
-	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
-	   _LT_TAGVAR(predep_objects, $1)="$p"
-	 else
-	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
-	 fi
-       else
-	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
-	   _LT_TAGVAR(postdep_objects, $1)="$p"
-	 else
-	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
-	 fi
-       fi
-       ;;
-
-    *) ;; # Ignore the rest.
-
-    esac
-  done
-
-  # Clean up.
-  rm -f a.out a.exe
-else
-  echo "libtool.m4: error: problem compiling $1 test program"
-fi
-
-$RM -f confest.$objext
-CFLAGS=$_lt_libdeps_save_CFLAGS
-
-# PORTME: override above test on systems where it is broken
-m4_if([$1], [CXX],
-[case $host_os in
-interix[[3-9]]*)
-  # Interix 3.5 installs completely hosed .la files for C++, so rather than
-  # hack all around it, let's just trust "g++" to DTRT.
-  _LT_TAGVAR(predep_objects,$1)=
-  _LT_TAGVAR(postdep_objects,$1)=
-  _LT_TAGVAR(postdeps,$1)=
-  ;;
-
-linux*)
-  case `$CC -V 2>&1 | sed 5q` in
-  *Sun\ C*)
-    # Sun C++ 5.9
-
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-
-solaris*)
-  case $cc_basename in
-  CC* | sunCC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    # Adding this requires a known-good setup of shared libraries for
-    # Sun compiler versions before 5.6, else PIC objects from an old
-    # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-esac
-])
-
-case " $_LT_TAGVAR(postdeps, $1) " in
-*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
-esac
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=
-if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
-    [The directories searched by this compiler when creating a shared library])
-_LT_TAGDECL([], [predep_objects], [1],
-    [Dependencies to place before and after the objects being linked to
-    create a shared library])
-_LT_TAGDECL([], [postdep_objects], [1])
-_LT_TAGDECL([], [predeps], [1])
-_LT_TAGDECL([], [postdeps], [1])
-_LT_TAGDECL([], [compiler_lib_search_path], [1],
-    [The library search path used internally by the compiler when linking
-    a shared library])
-])# _LT_SYS_HIDDEN_LIBDEPS
-
-
-# _LT_LANG_F77_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a Fortran 77 compiler are
-# suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_F77_CONFIG],
-[AC_LANG_PUSH(Fortran 77)
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the F77 compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_F77" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code="\
-      program t
-      end
-"
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-  _LT_TAG_COMPILER
-
-  # save warnings/boilerplate of simple test code
-  _LT_COMPILER_BOILERPLATE
-  _LT_LINKER_BOILERPLATE
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
-  lt_save_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
-  CC=${F77-"f77"}
-  CFLAGS=$FFLAGS
-  compiler=$CC
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-  GCC=$G77
-  if test -n "$compiler"; then
-    AC_MSG_CHECKING([if libtool supports shared libraries])
-    AC_MSG_RESULT([$can_build_shared])
-
-    AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
-
-    # On AIX, shared libraries and static libraries use the same namespace, and
-    # are all built from PIC.
-    case $host_os in
-      aix3*)
-        test "$enable_shared" = yes && enable_static=no
-        if test -n "$RANLIB"; then
-          archive_cmds="$archive_cmds~\$RANLIB \$lib"
-          postinstall_cmds='$RANLIB $lib'
-        fi
-        ;;
-      aix[[4-9]]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
-	fi
-        ;;
-    esac
-    AC_MSG_RESULT([$enable_shared])
-
-    AC_MSG_CHECKING([whether to build static libraries])
-    # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
-    AC_MSG_RESULT([$enable_static])
-
-    _LT_TAGVAR(GCC, $1)="$G77"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-  CFLAGS="$lt_save_CFLAGS"
-fi # test "$_lt_disable_F77" != yes
-
-AC_LANG_POP
-])# _LT_LANG_F77_CONFIG
-
-
-# _LT_LANG_FC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for a Fortran compiler are
-# suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_FC_CONFIG],
-[AC_LANG_PUSH(Fortran)
-
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for fc test sources.
-ac_ext=${ac_fc_srcext-f}
-
-# Object file extension for compiled fc test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the FC compiler isn't working.  Some variables (like enable_shared)
-# are currently assumed to apply to all compilers on this platform,
-# and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_FC" != yes; then
-  # Code to be used in simple compile tests
-  lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
-
-  # Code to be used in simple link tests
-  lt_simple_link_test_code="\
-      program t
-      end
-"
-
-  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-  _LT_TAG_COMPILER
-
-  # save warnings/boilerplate of simple test code
-  _LT_COMPILER_BOILERPLATE
-  _LT_LINKER_BOILERPLATE
-
-  # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
-  lt_save_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
-  CC=${FC-"f95"}
-  CFLAGS=$FCFLAGS
-  compiler=$CC
-  GCC=$ac_cv_fc_compiler_gnu
-
-  _LT_TAGVAR(compiler, $1)=$CC
-  _LT_CC_BASENAME([$compiler])
-
-  if test -n "$compiler"; then
-    AC_MSG_CHECKING([if libtool supports shared libraries])
-    AC_MSG_RESULT([$can_build_shared])
-
-    AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
-
-    # On AIX, shared libraries and static libraries use the same namespace, and
-    # are all built from PIC.
-    case $host_os in
-      aix3*)
-        test "$enable_shared" = yes && enable_static=no
-        if test -n "$RANLIB"; then
-          archive_cmds="$archive_cmds~\$RANLIB \$lib"
-          postinstall_cmds='$RANLIB $lib'
-        fi
-        ;;
-      aix[[4-9]]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
-	fi
-        ;;
-    esac
-    AC_MSG_RESULT([$enable_shared])
-
-    AC_MSG_CHECKING([whether to build static libraries])
-    # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
-    AC_MSG_RESULT([$enable_static])
-
-    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
-    _LT_TAGVAR(LD, $1)="$LD"
-
-    ## CAVEAT EMPTOR:
-    ## There is no encapsulation within the following macros, do not change
-    ## the running order or otherwise move them around unless you know exactly
-    ## what you are doing...
-    _LT_SYS_HIDDEN_LIBDEPS($1)
-    _LT_COMPILER_PIC($1)
-    _LT_COMPILER_C_O($1)
-    _LT_COMPILER_FILE_LOCKS($1)
-    _LT_LINKER_SHLIBS($1)
-    _LT_SYS_DYNAMIC_LINKER($1)
-    _LT_LINKER_HARDCODE_LIBPATH($1)
-
-    _LT_CONFIG($1)
-  fi # test -n "$compiler"
-
-  GCC=$lt_save_GCC
-  CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
-fi # test "$_lt_disable_FC" != yes
-
-AC_LANG_POP
-])# _LT_LANG_FC_CONFIG
-
-
-# _LT_LANG_GCJ_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Java Compiler compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GCJ_CONFIG],
-[AC_REQUIRE([LT_PROG_GCJ])dnl
-AC_LANG_SAVE
-
-# Source file extension for Java test sources.
-ac_ext=java
-
-# Object file extension for compiled Java test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=yes
-CC=${GCJ-"gcj"}
-CFLAGS=$GCJFLAGS
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
-_LT_CC_BASENAME([$compiler])
-
-# GCJ did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-
-  _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GCJ_CONFIG
-
-
-# _LT_LANG_GO_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Go compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GO_CONFIG],
-[AC_REQUIRE([LT_PROG_GO])dnl
-AC_LANG_SAVE
-
-# Source file extension for Go test sources.
-ac_ext=go
-
-# Object file extension for compiled Go test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="package main; func main() { }"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='package main; func main() { }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=yes
-CC=${GOC-"gccgo"}
-CFLAGS=$GOFLAGS
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
-_LT_CC_BASENAME([$compiler])
-
-# Go did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-
-if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-
-  _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GO_CONFIG
-
-
-# _LT_LANG_RC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for the Windows resource compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_RC_CONFIG],
-[AC_REQUIRE([LT_PROG_RC])dnl
-AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=
-CC=${RC-"windres"}
-CFLAGS=
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-if test -n "$compiler"; then
-  :
-  _LT_CONFIG($1)
-fi
-
-GCC=$lt_save_GCC
-AC_LANG_RESTORE
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_RC_CONFIG
-
-
-# LT_PROG_GCJ
-# -----------
-AC_DEFUN([LT_PROG_GCJ],
-[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
-  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
-    [AC_CHECK_TOOL(GCJ, gcj,)
-      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
-      AC_SUBST(GCJFLAGS)])])[]dnl
-])
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
-
-
-# LT_PROG_GO
-# ----------
-AC_DEFUN([LT_PROG_GO],
-[AC_CHECK_TOOL(GOC, gccgo,)
-])
-
-
-# LT_PROG_RC
-# ----------
-AC_DEFUN([LT_PROG_RC],
-[AC_CHECK_TOOL(RC, windres,)
-])
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_RC], [])
-
-
-# _LT_DECL_EGREP
-# --------------
-# If we don't have a new enough Autoconf to choose the best grep
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_EGREP],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_REQUIRE([AC_PROG_FGREP])dnl
-test -z "$GREP" && GREP=grep
-_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
-_LT_DECL([], [EGREP], [1], [An ERE matcher])
-_LT_DECL([], [FGREP], [1], [A literal string matcher])
-dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
-AC_SUBST([GREP])
-])
-
-
-# _LT_DECL_OBJDUMP
-# --------------
-# If we don't have a new enough Autoconf to choose the best objdump
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_OBJDUMP],
-[AC_CHECK_TOOL(OBJDUMP, objdump, false)
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
-AC_SUBST([OBJDUMP])
-])
-
-# _LT_DECL_DLLTOOL
-# ----------------
-# Ensure DLLTOOL variable is set.
-m4_defun([_LT_DECL_DLLTOOL],
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
-AC_SUBST([DLLTOOL])
-])
-
-# _LT_DECL_SED
-# ------------
-# Check for a fully-functional sed program, that truncates
-# as few characters as possible.  Prefer GNU sed if found.
-m4_defun([_LT_DECL_SED],
-[AC_PROG_SED
-test -z "$SED" && SED=sed
-Xsed="$SED -e 1s/^X//"
-_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
-_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
-    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
-])# _LT_DECL_SED
-
-m4_ifndef([AC_PROG_SED], [
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-
-m4_defun([AC_PROG_SED],
-[AC_MSG_CHECKING([for a sed that does not truncate output])
-AC_CACHE_VAL(lt_cv_path_SED,
-[# Loop through the user's path and test for sed and gsed.
-# Then use that list of sed's as ones to test for truncation.
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for lt_ac_prog in sed gsed; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
-        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
-      fi
-    done
-  done
-done
-IFS=$as_save_IFS
-lt_ac_max=0
-lt_ac_count=0
-# Add /usr/xpg4/bin/sed as it is typically found on Solaris
-# along with /bin/sed that truncates output.
-for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && continue
-  cat /dev/null > conftest.in
-  lt_ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
-  # Check for GNU sed and select it if it is found.
-  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
-    lt_cv_path_SED=$lt_ac_sed
-    break
-  fi
-  while true; do
-    cat conftest.in conftest.in >conftest.tmp
-    mv conftest.tmp conftest.in
-    cp conftest.in conftest.nl
-    echo >>conftest.nl
-    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
-    cmp -s conftest.out conftest.nl || break
-    # 10000 chars as input seems more than enough
-    test $lt_ac_count -gt 10 && break
-    lt_ac_count=`expr $lt_ac_count + 1`
-    if test $lt_ac_count -gt $lt_ac_max; then
-      lt_ac_max=$lt_ac_count
-      lt_cv_path_SED=$lt_ac_sed
-    fi
-  done
-done
-])
-SED=$lt_cv_path_SED
-AC_SUBST([SED])
-AC_MSG_RESULT([$SED])
-])#AC_PROG_SED
-])#m4_ifndef
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_SED], [])
-
-
-# _LT_CHECK_SHELL_FEATURES
-# ------------------------
-# Find out whether the shell is Bourne or XSI compatible,
-# or has some other useful features.
-m4_defun([_LT_CHECK_SHELL_FEATURES],
-[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-AC_MSG_RESULT([$xsi_shell])
-_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
-
-AC_MSG_CHECKING([whether the shell understands "+="])
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-AC_MSG_RESULT([$lt_shell_append])
-_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  lt_unset=unset
-else
-  lt_unset=false
-fi
-_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
-
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
-    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
-  lt_SP2NL='tr \040 \012'
-  lt_NL2SP='tr \015\012 \040\040'
-  ;;
- *) # EBCDIC based system
-  lt_SP2NL='tr \100 \n'
-  lt_NL2SP='tr \r\n \100\100'
-  ;;
-esac
-_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
-_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
-])# _LT_CHECK_SHELL_FEATURES
-
-
-# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
-# ------------------------------------------------------
-# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
-# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
-m4_defun([_LT_PROG_FUNCTION_REPLACE],
-[dnl {
-sed -e '/^$1 ()$/,/^} # $1 /c\
-$1 ()\
-{\
-m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
-} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-])
-
-
-# _LT_PROG_REPLACE_SHELLFNS
-# -------------------------
-# Replace existing portable implementations of several shell functions with
-# equivalent extended shell implementations where those features are available..
-m4_defun([_LT_PROG_REPLACE_SHELLFNS],
-[if test x"$xsi_shell" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
-    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-    # positional parameters, so assign one to ordinary parameter first.
-    func_stripname_result=${3}
-    func_stripname_result=${func_stripname_result#"${1}"}
-    func_stripname_result=${func_stripname_result%"${2}"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
-    func_split_long_opt_name=${1%%=*}
-    func_split_long_opt_arg=${1#*=}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
-    func_split_short_opt_arg=${1#??}
-    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
-    case ${1} in
-      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-      *)    func_lo2o_result=${1} ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
-
-  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
-
-  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
-    func_quote_for_eval "${2}"
-dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
-    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
-fi
-])
-
-# _LT_PATH_CONVERSION_FUNCTIONS
-# -----------------------------
-# Determine which file name conversion functions should be used by
-# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
-# for certain cross-compile configurations and native mingw.
-m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_MSG_CHECKING([how to convert $build file names to $host format])
-AC_CACHE_VAL(lt_cv_to_host_file_cmd,
-[case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
-        ;;
-    esac
-    ;;
-  *-*-cygwin* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_noop
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
-        ;;
-    esac
-    ;;
-  * ) # unhandled hosts (and "normal" native builds)
-    lt_cv_to_host_file_cmd=func_convert_file_noop
-    ;;
-esac
-])
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
-_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
-         [0], [convert $build file names to $host format])dnl
-
-AC_MSG_CHECKING([how to convert $build file names to toolchain format])
-AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
-[#assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
-        ;;
-    esac
-    ;;
-esac
-])
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
-_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
-         [0], [convert $build files to toolchain format])dnl
-])# _LT_PATH_CONVERSION_FUNCTIONS
-
-# Helper functions for option handling.                    -*- Autoconf -*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-#   Inc.
-#   Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 7 ltoptions.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
-
-
-# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
-# ------------------------------------------
-m4_define([_LT_MANGLE_OPTION],
-[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
-
-
-# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
-# ---------------------------------------
-# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
-# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
-# saved as a flag.
-m4_define([_LT_SET_OPTION],
-[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
-m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
-        _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
-])
-
-
-# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
-# ------------------------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-m4_define([_LT_IF_OPTION],
-[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
-
-
-# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
-# -------------------------------------------------------
-# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
-# are set.
-m4_define([_LT_UNLESS_OPTIONS],
-[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
-		      [m4_define([$0_found])])])[]dnl
-m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
-])[]dnl
-])
-
-
-# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
-# ----------------------------------------
-# OPTION-LIST is a space-separated list of Libtool options associated
-# with MACRO-NAME.  If any OPTION has a matching handler declared with
-# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
-# the unknown option and exit.
-m4_defun([_LT_SET_OPTIONS],
-[# Set options
-m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-    [_LT_SET_OPTION([$1], _LT_Option)])
-
-m4_if([$1],[LT_INIT],[
-  dnl
-  dnl Simply set some default values (i.e off) if boolean options were not
-  dnl specified:
-  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
-  ])
-  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
-  ])
-  dnl
-  dnl If no reference was made to various pairs of opposing options, then
-  dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
-  dnl archives by default:
-  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
-  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-  		   [_LT_ENABLE_FAST_INSTALL])
-  ])
-])# _LT_SET_OPTIONS
-
-
-
-# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
-# -----------------------------------------
-m4_define([_LT_MANGLE_DEFUN],
-[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
-
-
-# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
-# -----------------------------------------------
-m4_define([LT_OPTION_DEFINE],
-[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
-])# LT_OPTION_DEFINE
-
-
-# dlopen
-# ------
-LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
-])
-
-AU_DEFUN([AC_LIBTOOL_DLOPEN],
-[_LT_SET_OPTION([LT_INIT], [dlopen])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
-
-
-# win32-dll
-# ---------
-# Declare package support for building win32 dll's.
-LT_OPTION_DEFINE([LT_INIT], [win32-dll],
-[enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-esac
-
-test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [1], [Assembler program])dnl
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
-])# win32-dll
-
-AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-_LT_SET_OPTION([LT_INIT], [win32-dll])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
-
-
-# _LT_ENABLE_SHARED([DEFAULT])
-# ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_SHARED],
-[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([shared],
-    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
-	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
-
-    _LT_DECL([build_libtool_libs], [enable_shared], [0],
-	[Whether or not to build shared libraries])
-])# _LT_ENABLE_SHARED
-
-LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
-])
-
-AC_DEFUN([AC_DISABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], [disable-shared])
-])
-
-AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_SHARED], [])
-dnl AC_DEFUN([AM_DISABLE_SHARED], [])
-
-
-
-# _LT_ENABLE_STATIC([DEFAULT])
-# ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_STATIC],
-[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([static],
-    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
-	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
-
-    _LT_DECL([build_old_libs], [enable_static], [0],
-	[Whether or not to build static libraries])
-])# _LT_ENABLE_STATIC
-
-LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
-])
-
-AC_DEFUN([AC_DISABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], [disable-static])
-])
-
-AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_STATIC], [])
-dnl AC_DEFUN([AM_DISABLE_STATIC], [])
-
-
-
-# _LT_ENABLE_FAST_INSTALL([DEFAULT])
-# ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_FAST_INSTALL],
-[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([fast-install],
-    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
-    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
-
-_LT_DECL([fast_install], [enable_fast_install], [0],
-	 [Whether or not to optimize for fast installation])dnl
-])# _LT_ENABLE_FAST_INSTALL
-
-LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
-
-# Old names:
-AU_DEFUN([AC_ENABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
-])
-
-AU_DEFUN([AC_DISABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
-dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
-
-
-# _LT_WITH_PIC([MODE])
-# --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
-# LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
-m4_define([_LT_WITH_PIC],
-[AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
-	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [lt_p=${PACKAGE-default}
-    case $withval in
-    yes|no) pic_mode=$withval ;;
-    *)
-      pic_mode=default
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
-	if test "X$lt_pkg" = "X$lt_p"; then
-	  pic_mode=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
-
-_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
-])# _LT_WITH_PIC
-
-LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
-
-# Old name:
-AU_DEFUN([AC_LIBTOOL_PICMODE],
-[_LT_SET_OPTION([LT_INIT], [pic-only])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
-
-
-m4_define([_LTDL_MODE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
-		 [m4_define([_LTDL_MODE], [nonrecursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [recursive],
-		 [m4_define([_LTDL_MODE], [recursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [subproject],
-		 [m4_define([_LTDL_MODE], [subproject])])
-
-m4_define([_LTDL_TYPE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [installable],
-		 [m4_define([_LTDL_TYPE], [installable])])
-LT_OPTION_DEFINE([LTDL_INIT], [convenience],
-		 [m4_define([_LTDL_TYPE], [convenience])])
-
-# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
-#
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-# Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 6 ltsugar.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
-
-
-# lt_join(SEP, ARG1, [ARG2...])
-# -----------------------------
-# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
-# associated separator.
-# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
-# versions in m4sugar had bugs.
-m4_define([lt_join],
-[m4_if([$#], [1], [],
-       [$#], [2], [[$2]],
-       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
-m4_define([_lt_join],
-[m4_if([$#$2], [2], [],
-       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
-
-
-# lt_car(LIST)
-# lt_cdr(LIST)
-# ------------
-# Manipulate m4 lists.
-# These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
-m4_define([lt_car], [[$1]])
-m4_define([lt_cdr],
-[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
-       [$#], 1, [],
-       [m4_dquote(m4_shift($@))])])
-m4_define([lt_unquote], $1)
-
-
-# lt_append(MACRO-NAME, STRING, [SEPARATOR])
-# ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
-# Note that neither SEPARATOR nor STRING are expanded; they are appended
-# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
-# No SEPARATOR is output if MACRO-NAME was previously undefined (different
-# than defined and empty).
-#
-# This macro is needed until we can rely on Autoconf 2.62, since earlier
-# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
-m4_define([lt_append],
-[m4_define([$1],
-	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
-
-
-
-# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
-# ----------------------------------------------------------
-# Produce a SEP delimited list of all paired combinations of elements of
-# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
-# has the form PREFIXmINFIXSUFFIXn.
-# Needed until we can rely on m4_combine added in Autoconf 2.62.
-m4_define([lt_combine],
-[m4_if(m4_eval([$# > 3]), [1],
-       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
-[[m4_foreach([_Lt_prefix], [$2],
-	     [m4_foreach([_Lt_suffix],
-		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
-	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
-
-
-# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
-# -----------------------------------------------------------------------
-# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
-# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
-m4_define([lt_if_append_uniq],
-[m4_ifdef([$1],
-	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
-		 [lt_append([$1], [$2], [$3])$4],
-		 [$5])],
-	  [lt_append([$1], [$2], [$3])$4])])
-
-
-# lt_dict_add(DICT, KEY, VALUE)
-# -----------------------------
-m4_define([lt_dict_add],
-[m4_define([$1($2)], [$3])])
-
-
-# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
-# --------------------------------------------
-m4_define([lt_dict_add_subkey],
-[m4_define([$1($2:$3)], [$4])])
-
-
-# lt_dict_fetch(DICT, KEY, [SUBKEY])
-# ----------------------------------
-m4_define([lt_dict_fetch],
-[m4_ifval([$3],
-	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
-    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
-
-
-# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
-# -----------------------------------------------------------------
-m4_define([lt_if_dict_fetch],
-[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
-	[$5],
-    [$6])])
-
-
-# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
-# --------------------------------------------------------------
-m4_define([lt_dict_filter],
-[m4_if([$5], [], [],
-  [lt_join(m4_quote(m4_default([$4], [[, ]])),
-           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
-		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
-])
-
-# ltversion.m4 -- version numbers			-*- Autoconf -*-
-#
-#   Copyright (C) 2004 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# @configure_input@
-
-# serial 3337 ltversion.m4
-# This file is part of GNU Libtool
-
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
-
-AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
-_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
-_LT_DECL(, macro_revision, 0)
-])
-
-# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004.
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 5 lt~obsolete.m4
-
-# These exist entirely to fool aclocal when bootstrapping libtool.
-#
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
-# which have later been changed to m4_define as they aren't part of the
-# exported API, or moved to Autoconf or Automake where they belong.
-#
-# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
-# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
-# using a macro with the same name in our local m4/libtool.m4 it'll
-# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
-# and doesn't know about Autoconf macros at all.)
-#
-# So we provide this file, which has a silly filename so it's always
-# included after everything else.  This provides aclocal with the
-# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
-# because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
-#
-# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
-# Yes, that means every name once taken will need to remain here until
-# we give up compatibility with versions before 1.7, at which point
-# we need to keep only those names which we still refer to.
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
-
-m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
-m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
-m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
-m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
-m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
-m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
-m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
-m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
-m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
-m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
-m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
-m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
-m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
-m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
-m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
-m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
-m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
-m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
-m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
-m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
-m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
-m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
-m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
-m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
-m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
-m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
-m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
-m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
-m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
-m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
-m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
-m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
-m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
-m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
-m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
-m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
-m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
-m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
-m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
-m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
-m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
-m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
-m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
-m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
-m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
-m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
-m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
-m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
-m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
-m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
-
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
@@ -8629,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.3], [],
+m4_if([$1], [1.11.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -8645,21 +50,19 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.3])dnl
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@@ -8741,14 +144,14 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+# Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 12
+# serial 10
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -8788,7 +191,6 @@ AC_CACHE_CHECK([dependency style of $depcc],
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
-  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -8853,7 +255,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
 	break
       fi
       ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+    msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -8918,13 +320,10 @@ AC_DEFUN([AM_DEP_TRACK],
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
-  am__nodep='_no'
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
 AC_SUBST([AMDEPBACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
-AC_SUBST([am__nodep])dnl
-_AM_SUBST_NOTMAKE([am__nodep])dnl
 ])
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
@@ -9146,15 +545,12 @@ for _am_header in $config_headers :; do
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
@@ -9286,15 +682,12 @@ else
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_PROG_MKDIR_P
 # ---------------
 # Check for `mkdir -p'.
@@ -9317,14 +710,13 @@ esac
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# serial 4
 
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
@@ -9332,13 +724,13 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
 
 # _AM_SET_OPTION(NAME)
-# --------------------
+# ------------------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
 
 # _AM_SET_OPTIONS(OPTIONS)
-# ------------------------
+# ----------------------------------
 # OPTIONS is a space-separated list of Automake options.
 AC_DEFUN([_AM_SET_OPTIONS],
 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@@ -9414,14 +806,12 @@ Check your system clock])
 fi
 AC_MSG_RESULT(yes)])
 
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
-
 # AM_PROG_INSTALL_STRIP
 # ---------------------
 # One issue with vendor `install' (even GNU) is that you can't
@@ -9444,13 +834,13 @@ fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 3
+# serial 2
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
@@ -9459,13 +849,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
 # AM_SUBST_NOTMAKE(VARIABLE)
-# --------------------------
+# ---------------------------
 # Public sister of _AM_SUBST_NOTMAKE.
 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -9487,11 +877,10 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
 AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.  Yes, it's still used
-# in the wild :-(  We should find a proper way to deprecate it ...
-AC_SUBST([AMTAR], ['$${TAR-tar}'])
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
 m4_if([$1], [v7],
-     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
      [m4_case([$1], [ustar],, [pax],,
               [m4_fatal([Unknown tar format])])
 AC_MSG_CHECKING([how to create a $1 tar archive])
@@ -9560,4 +949,9 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([config/libtool.m4])
+m4_include([config/ltoptions.m4])
+m4_include([config/ltsugar.m4])
+m4_include([config/ltversion.m4])
+m4_include([config/lt~obsolete.m4])
 m4_include([config/osmvsel.m4])
diff --git a/complib/Makefile.am b/complib/Makefile.am
index 3ee90e8..360deab 100644
--- a/complib/Makefile.am
+++ b/complib/Makefile.am
@@ -9,7 +9,7 @@ else
 DBGFLAGS = -g
 endif
 
-libosmcomp_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
+libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
 
 if HAVE_LD_VERSION_SCRIPT
     libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
diff --git a/complib/Makefile.in b/complib/Makefile.in
index 5bb147a..0ead0ef 100644
--- a/complib/Makefile.in
+++ b/complib/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -39,8 +39,12 @@ subdir = complib
 DIST_COMMON = $(libosmcompinclude_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in ChangeLog
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
-	$(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+	$(top_srcdir)/config/ltoptions.m4 \
+	$(top_srcdir)/config/ltsugar.m4 \
+	$(top_srcdir)/config/ltversion.m4 \
+	$(top_srcdir)/config/lt~obsolete.m4 \
+	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -69,12 +73,6 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
 am__installdirs = "$(DESTDIR)$(libdir)" \
 	"$(DESTDIR)$(libosmcompincludedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
@@ -125,9 +123,10 @@ CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
+DEFAULT_START = @DEFAULT_START@
+DEFAULT_STOP = @DEFAULT_STOP@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -154,7 +153,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -181,6 +179,7 @@ PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
+RDMA_SERVICE = @RDMA_SERVICE@
 RELEASE = @RELEASE@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -197,7 +196,6 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -230,6 +228,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -249,7 +248,7 @@ INCLUDES = -I$(srcdir)/../include
 lib_LTLIBRARIES = libosmcomp.la
 @DEBUG_FALSE at DBGFLAGS = -g
 @DEBUG_TRUE at DBGFLAGS = -ggdb -D_DEBUG_
-libosmcomp_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
+libosmcomp_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
 @HAVE_LD_VERSION_SCRIPT_FALSE at libosmcomp_version_script = 
 @HAVE_LD_VERSION_SCRIPT_TRUE at libosmcomp_version_script = -Wl,--version-script=$(srcdir)/libosmcomp.map
 complib_api_version = $(shell grep LIBVERSION= $(srcdir)/libosmcomp.ver | sed 's/LIBVERSION=//')
@@ -373,7 +372,7 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libosmcomp.la: $(libosmcomp_la_OBJECTS) $(libosmcomp_la_DEPENDENCIES) $(EXTRA_libosmcomp_la_DEPENDENCIES) 
+libosmcomp.la: $(libosmcomp_la_OBJECTS) $(libosmcomp_la_DEPENDENCIES) 
 	$(libosmcomp_la_LINK) -rpath $(libdir) $(libosmcomp_la_OBJECTS) $(libosmcomp_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -562,7 +561,9 @@ uninstall-libosmcompincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(libosmcompinclude_HEADERS)'; test -n "$(libosmcompincludedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(libosmcompincludedir)'; $(am__uninstall_files_from_dir)
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(libosmcompincludedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(libosmcompincludedir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -663,15 +664,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/complib/cl_event_wheel.c b/complib/cl_event_wheel.c
index 2557c40..27443f6 100644
--- a/complib/cl_event_wheel.c
+++ b/complib/cl_event_wheel.c
@@ -167,13 +167,12 @@ static void __cl_event_wheel_callback(IN void *context)
 
 		/* start the timer to the timeout [msec] */
 		new_timeout =
-		    (uint32_t) (((p_event->aging_time - current_time) / 1000) +
-				0.5);
+		    (uint32_t) ((p_event->aging_time - current_time + 500) / 1000);
 		CL_DBG("__cl_event_wheel_callback: Restart timer in: "
 		       "%u [msec]\n", new_timeout);
 		cl_status = cl_timer_start(&p_event_wheel->timer, new_timeout);
 		if (cl_status != CL_SUCCESS) {
-			CL_DBG("__cl_event_wheel_callback : ERR 6100: "
+			CL_DBG("__cl_event_wheel_callback : ERR 6200: "
 			       "Failed to start timer\n");
 		}
 	}
@@ -238,8 +237,8 @@ void cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel)
 		    PARENT_STRUCT(p_list_item, cl_event_wheel_reg_info_t,
 				  list_item);
 		CL_DBG("cl_event_wheel_dump: Found event key:<0x%"
-		       PRIx64 ">, aging time:%" PRIu64 "\n",
-		       p_event->key, p_event->aging_time);
+		       PRIx64 ">, num_regs:%d, aging time:%" PRIu64 "\n",
+		       p_event->key, p_event->num_regs, p_event->aging_time);
 		p_list_item = cl_qlist_next(p_list_item);
 	}
 }
@@ -371,7 +370,7 @@ cl_status_t cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel,
 		/* start the timer to the timeout [msec] */
 		cl_status = cl_timer_start(&p_event_wheel->timer, to);
 		if (cl_status != CL_SUCCESS) {
-			CL_DBG("cl_event_wheel_reg : ERR 6103: "
+			CL_DBG("cl_event_wheel_reg : ERR 6203: "
 			       "Failed to start timer\n");
 			goto Exit;
 		}
@@ -503,7 +502,7 @@ void __cl_event_wheel_dump(IN cl_event_wheel_t * const p_event_wheel)
 
 /* The callback for aging event */
 /* We assume we pass a text context */
-void __test_event_aging(uint64_t key, void *context)
+static uint64_t __test_event_aging(uint64_t key, uint32_t num_regs, void *context)
 {
 	printf("*****************************************************\n");
 	printf("Aged key: 0x%" PRIx64 " Context:%s\n", key, (char *)context);
@@ -514,6 +513,9 @@ int main()
 	cl_event_wheel_t event_wheel;
 	/*  uint64_t key; */
 
+	/* init complib */
+	complib_init();
+
 	/* construct */
 	cl_event_wheel_construct(&event_wheel);
 
@@ -560,6 +562,8 @@ int main()
 	/* destroy */
 	cl_event_wheel_destroy(&event_wheel);
 
+	complib_exit();
+
 	return (0);
 }
 
diff --git a/complib/cl_nodenamemap.c b/complib/cl_nodenamemap.c
index a99d46d..8ac88cd 100644
--- a/complib/cl_nodenamemap.c
+++ b/complib/cl_nodenamemap.c
@@ -43,8 +43,18 @@
 #include <unistd.h>
 #include <ctype.h>
 #include <config.h>
+#include <errno.h>
 
 #include <complib/cl_nodenamemap.h>
+#include <complib/cl_math.h>
+
+#define PARSE_NODE_MAP_BUFLEN  256
+
+static int parse_node_map_wrap(const char *file_name,
+			       int (*create)(void *, uint64_t, char *),
+			       void *cxt,
+			       char *linebuf,
+			       unsigned int linebuflen);
 
 static int map_name(void *cxt, uint64_t guid, char *p)
 {
@@ -64,9 +74,10 @@ static int map_name(void *cxt, uint64_t guid, char *p)
 	return 0;
 }
 
-nn_map_t *open_node_name_map(char *node_name_map)
+nn_map_t *open_node_name_map(const char *node_name_map)
 {
 	nn_map_t *map;
+	char linebuf[PARSE_NODE_MAP_BUFLEN + 1];
 
 	if (!node_name_map) {
 #ifdef HAVE_DEFAULT_NODENAME_MAP
@@ -84,10 +95,23 @@ nn_map_t *open_node_name_map(char *node_name_map)
 		return NULL;
 	cl_qmap_init(map);
 
-	if (parse_node_map(node_name_map, map_name, map)) {
-		fprintf(stderr,
-			"WARNING failed to open node name map \"%s\" (%s)\n",
-			node_name_map, strerror(errno));
+	memset(linebuf, '\0', PARSE_NODE_MAP_BUFLEN + 1);
+	if (parse_node_map_wrap(node_name_map, map_name, map,
+				linebuf, PARSE_NODE_MAP_BUFLEN)) {
+		if (errno == EIO) {
+			fprintf(stderr,
+				"WARNING failed to parse node name map "
+				"\"%s\"\n",
+				node_name_map);
+			fprintf(stderr,
+				"WARNING failed line: \"%s\"\n",
+				linebuf);
+		}
+		else
+			fprintf(stderr,
+				"WARNING failed to open node name map "
+				"\"%s\" (%s)\n",
+				node_name_map, strerror(errno));
 		close_node_name_map(map);
 		return NULL;
 	}
@@ -144,10 +168,13 @@ char *clean_nodedesc(char *nodedesc)
 	return (nodedesc);
 }
 
-int parse_node_map(const char *file_name,
-		   int (*create) (void *, uint64_t, char *), void *cxt)
+static int parse_node_map_wrap(const char *file_name,
+			       int (*create) (void *, uint64_t, char *),
+			       void *cxt,
+			       char *linebuf,
+			       unsigned int linebuflen)
 {
-	char line[256];
+	char line[PARSE_NODE_MAP_BUFLEN];
 	FILE *f;
 
 	if (!(f = fopen(file_name, "r")))
@@ -166,6 +193,14 @@ int parse_node_map(const char *file_name,
 		guid = strtoull(p, &e, 0);
 		if (e == p || (!isspace(*e) && *e != '#' && *e != '\0')) {
 			fclose(f);
+			errno = EIO;
+			if (linebuf) {
+				memcpy(linebuf, line,
+				       MIN(PARSE_NODE_MAP_BUFLEN, linebuflen));
+				e = strpbrk(linebuf, "\n");
+				if (e)
+					*e = '\0';
+			}
 			return -1;
 		}
 
@@ -186,3 +221,9 @@ int parse_node_map(const char *file_name,
 	fclose(f);
 	return 0;
 }
+
+int parse_node_map(const char *file_name,
+		   int (*create) (void *, uint64_t, char *), void *cxt)
+{
+	return parse_node_map_wrap(file_name, create, cxt, NULL, 0);
+}
diff --git a/complib/cl_threadpool.c b/complib/cl_threadpool.c
index 0f6498b..11abfbb 100644
--- a/complib/cl_threadpool.c
+++ b/complib/cl_threadpool.c
@@ -129,6 +129,9 @@ void cl_thread_pool_destroy(IN cl_thread_pool_t * const p_thread_pool)
 			pthread_join(p_thread_pool->tid[i], NULL);
 
 	p_thread_pool->running_count = 0;
+
+	free(p_thread_pool->tid);
+
 	pthread_cond_destroy(&p_thread_pool->cond);
 	pthread_mutex_destroy(&p_thread_pool->mutex);
 
diff --git a/complib/libosmcomp.ver b/complib/libosmcomp.ver
index 59a0860..552d0cd 100644
--- a/complib/libosmcomp.ver
+++ b/complib/libosmcomp.ver
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=3:6:0
+LIBVERSION=3:8:0
diff --git a/config/config.guess b/config/config.guess
index 49ba16f..dc84c68 100755
--- a/config/config.guess
+++ b/config/config.guess
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   Free Software Foundation, Inc.
 
-timestamp='2012-01-01'
+timestamp='2009-11-20'
 
 # 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
@@ -56,9 +56,8 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -145,7 +144,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 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*,
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
@@ -181,7 +180,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		fi
 		;;
 	    *)
-		os=netbsd
+	        os=netbsd
 		;;
 	esac
 	# The OS release
@@ -224,7 +223,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		;;
 	*5.*)
-		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
 		;;
 	esac
 	# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -270,10 +269,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# 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 ;;
+	exit ;;
     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
@@ -299,7 +295,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	echo s390-ibm-zvmoe
 	exit ;;
     *:OS400:*:*)
-	echo powerpc-ibm-os400
+        echo powerpc-ibm-os400
 	exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
 	echo arm-acorn-riscix${UNAME_RELEASE}
@@ -398,23 +394,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # 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}
+        echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
 	echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
+        exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
+        echo m68k-atari-mint${UNAME_RELEASE}
 	exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-	echo m68k-milan-mint${UNAME_RELEASE}
-	exit ;;
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-	echo m68k-hades-mint${UNAME_RELEASE}
-	exit ;;
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-	echo m68k-unknown-mint${UNAME_RELEASE}
-	exit ;;
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
     m68k:machten:*:*)
 	echo m68k-apple-machten${UNAME_RELEASE}
 	exit ;;
@@ -484,8 +480,8 @@ EOF
 	echo m88k-motorola-sysv3
 	exit ;;
     AViiON:dgux:*:*)
-	# DG/UX returns AViiON for all architectures
-	UNAME_PROCESSOR=`/usr/bin/uname -p`
+        # 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 ] || \
@@ -498,7 +494,7 @@ EOF
 	else
 	    echo i586-dg-dgux${UNAME_RELEASE}
 	fi
-	exit ;;
+ 	exit ;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
 	echo m88k-dolphin-sysv3
 	exit ;;
@@ -555,7 +551,7 @@ EOF
 		echo rs6000-ibm-aix3.2
 	fi
 	exit ;;
-    *:AIX:*:[4567])
+    *:AIX:*:[456])
 	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
@@ -598,52 +594,52 @@ EOF
 	    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" ;;
+                    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
+                        esac ;;
+                    esac
 		fi
 		if [ "${HP_ARCH}" = "" ]; then
 		    eval $set_cc_for_build
-		    sed 's/^		//' << EOF >$dummy.c
+		    sed 's/^              //' << EOF >$dummy.c
 
-		#define _HPUX_SOURCE
-		#include <stdlib.h>
-		#include <unistd.h>
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
 
-		int main ()
-		{
-		#if defined(_SC_KERNEL_BITS)
-		    long bits = sysconf(_SC_KERNEL_BITS);
-		#endif
-		    long cpu  = sysconf (_SC_CPU_VERSION);
+              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);
-		}
+                  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
@@ -734,22 +730,22 @@ EOF
 	exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
-	exit ;;
+        exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
 	else echo c2-convex-bsd
 	fi
-	exit ;;
+        exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
 	echo c34-convex-bsd
-	exit ;;
+        exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
 	echo c38-convex-bsd
-	exit ;;
+        exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
-	exit ;;
+        exit ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit ;;
@@ -773,14 +769,14 @@ EOF
 	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 ;;
+        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}"
+        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}
@@ -792,12 +788,13 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit ;;
     *:FreeBSD:*:*)
-	UNAME_PROCESSOR=`/usr/bin/uname -p`
-	case ${UNAME_PROCESSOR} in
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    amd64)
 		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
-		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
 	exit ;;
     i*:CYGWIN*:*)
@@ -806,18 +803,15 @@ EOF
     *:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
-    i*:MSYS*:*)
-	echo ${UNAME_MACHINE}-pc-msys
-	exit ;;
     i*:windows32*:*)
-	# uname -m includes "-pc" on this system.
-	echo ${UNAME_MACHINE}-mingw32
+    	# 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
+    	case ${UNAME_MACHINE} in
 	    x86)
 		echo i586-pc-interix${UNAME_RELEASE}
 		exit ;;
@@ -872,7 +866,7 @@ EOF
 	  EV6)   UNAME_MACHINE=alphaev6 ;;
 	  EV67)  UNAME_MACHINE=alphaev67 ;;
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
-	esac
+        esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
 	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
@@ -884,29 +878,20 @@ EOF
 	then
 	    echo ${UNAME_MACHINE}-unknown-linux-gnu
 	else
-	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
-		| grep -q __ARM_PCS_VFP
-	    then
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
-	    else
-		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
-	    fi
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
 	fi
 	exit ;;
     avr32*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     cris:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-gnu
+	echo cris-axis-linux-gnu
 	exit ;;
     crisv32:Linux:*:*)
-	echo ${UNAME_MACHINE}-axis-linux-gnu
+	echo crisv32-axis-linux-gnu
 	exit ;;
     frv:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    hexagon:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+    	echo frv-unknown-linux-gnu
 	exit ;;
     i*86:Linux:*:*)
 	LIBC=gnu
@@ -948,7 +933,7 @@ EOF
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
     or32:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo or32-unknown-linux-gnu
 	exit ;;
     padre:Linux:*:*)
 	echo sparc-unknown-linux-gnu
@@ -974,7 +959,7 @@ EOF
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
     sh64*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     sh*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -982,17 +967,14 @@ EOF
     sparc:Linux:*:* | sparc64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    tile*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
     vax:Linux:*:*)
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo x86_64-unknown-linux-gnu
 	exit ;;
     xtensa*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1001,11 +983,11 @@ EOF
 	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,
+        # 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.
+        # Use sysv4.2uw... so that sysv4* matches it.
 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
 	exit ;;
     i*86:OS/2:*:*)
@@ -1037,7 +1019,7 @@ EOF
 	fi
 	exit ;;
     i*86:*:5:[678]*)
-	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
 	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
@@ -1065,13 +1047,13 @@ EOF
 	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.
+        # 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 ;;
+        exit ;;
     Intel:Mach:3*:*)
 	echo i386-pc-mach3
 	exit ;;
@@ -1106,8 +1088,8 @@ EOF
 	/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; } ;;
+        /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 \
@@ -1150,10 +1132,10 @@ EOF
 		echo ns32k-sni-sysv
 	fi
 	exit ;;
-    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-			# says <Richard.M.Bartel at ccMail.Census.GOV>
-	echo i586-unisys-sysv4
-	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel at ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes at openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
@@ -1179,11 +1161,11 @@ EOF
 	exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if [ -d /usr/nec ]; then
-		echo mips-nec-sysv${UNAME_RELEASE}
+	        echo mips-nec-sysv${UNAME_RELEASE}
 	else
-		echo mips-unknown-sysv${UNAME_RELEASE}
+	        echo mips-unknown-sysv${UNAME_RELEASE}
 	fi
-	exit ;;
+        exit ;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
 	echo powerpc-be-beos
 	exit ;;
@@ -1248,9 +1230,6 @@ EOF
     *: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 ;;
@@ -1296,13 +1275,13 @@ EOF
 	echo pdp10-unknown-its
 	exit ;;
     SEI:*:*:SEIUX)
-	echo mips-sei-seiux${UNAME_RELEASE}
+        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`
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
 	case "${UNAME_MACHINE}" in
 	    A*) echo alpha-dec-vms ; exit ;;
 	    I*) echo ia64-dec-vms ; exit ;;
@@ -1342,11 +1321,11 @@ main ()
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-	"4"
+          "4"
 #else
-	""
+	  ""
 #endif
-	); exit (0);
+         ); exit (0);
 #endif
 #endif
 
diff --git a/config/config.sub b/config/config.sub
index d6b6b3c..2a55a50 100755
--- a/config/config.sub
+++ b/config/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-#   2011, 2012 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   Free Software Foundation, Inc.
 
-timestamp='2012-01-01'
+timestamp='2009-11-20'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -75,9 +75,8 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -124,9 +123,8 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
-  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
@@ -158,8 +156,8 @@ case $os in
 		os=
 		basic_machine=$1
 		;;
-	-bluegene*)
-		os=-cnk
+        -bluegene*)
+	        os=-cnk
 		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
@@ -175,10 +173,10 @@ case $os in
 		os=-chorusos
 		basic_machine=$1
 		;;
-	-chorusrdb)
-		os=-chorusrdb
+ 	-chorusrdb)
+ 		os=-chorusrdb
 		basic_machine=$1
-		;;
+ 		;;
 	-hiux*)
 		os=-hiuxwe2
 		;;
@@ -251,17 +249,13 @@ case $basic_machine in
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
-        | be32 | be64 \
 	| bfin \
 	| c4x | 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 \
-	| le32 | le64 \
 	| lm32 \
 	| m32c | m32r | m32rle | m68000 | m68k | m88k \
 	| maxq | mb | microblaze | mcore | mep | metag \
@@ -287,39 +281,29 @@ case $basic_machine in
 	| moxie \
 	| mt \
 	| msp430 \
-	| nds32 | nds32le | nds32be \
 	| nios | nios2 \
 	| ns16k | ns32k \
-	| open8 \
 	| or32 \
 	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| rl78 | rx \
+	| 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 \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
 	| ubicom32 \
-	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| v850 | v850e \
 	| we32k \
-	| x86 | xc16x | xstormy16 | xtensa \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	c54x)
-		basic_machine=tic54x-unknown
-		;;
-	c55x)
-		basic_machine=tic55x-unknown
-		;;
-	c6x)
-		basic_machine=tic6x-unknown
-		;;
 	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
 		;;
@@ -329,18 +313,6 @@ case $basic_machine in
 		basic_machine=mt-unknown
 		;;
 
-	strongarm | thumb | xscale)
-		basic_machine=arm-unknown
-		;;
-
-	xscaleeb)
-		basic_machine=armeb-unknown
-		;;
-
-	xscaleel)
-		basic_machine=armel-unknown
-		;;
-
 	# We use `pc' rather than `unknown'
 	# because (1) that's what they normally are, and
 	# (2) the word "unknown" tends to confuse beginning users.
@@ -360,19 +332,16 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
-	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| 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-* \
-	| le32-* | le64-* \
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
@@ -398,29 +367,25 @@ case $basic_machine in
 	| mmix-* \
 	| mt-* \
 	| msp430-* \
-	| nds32-* | nds32le-* | nds32be-* \
 	| nios-* | nios2-* \
 	| none-* | np1-* | ns16k-* | ns32k-* \
-	| open8-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
-	| rl78-* | romp-* | rs6000-* | rx-* \
+	| 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*-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
 	| tron-* \
 	| ubicom32-* \
-	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
-	| vax-* \
+	| v850-* | v850e-* | vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
 	| xstormy16-* | xtensa*-* \
 	| ymp-* \
 	| z8k-* | z80-*)
@@ -445,7 +410,7 @@ case $basic_machine in
 		basic_machine=a29k-amd
 		os=-udi
 		;;
-	abacus)
+    	abacus)
 		basic_machine=abacus-unknown
 		;;
 	adobe68k)
@@ -515,20 +480,11 @@ case $basic_machine in
 		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)
+        cegcc)
 		basic_machine=arm-unknown
 		os=-cegcc
 		;;
@@ -560,7 +516,7 @@ case $basic_machine in
 		basic_machine=craynv-cray
 		os=-unicosmp
 		;;
-	cr16 | cr16-*)
+	cr16)
 		basic_machine=cr16-unknown
 		os=-elf
 		;;
@@ -718,6 +674,7 @@ case $basic_machine in
 	i370-ibm* | ibm*)
 		basic_machine=i370-ibm
 		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
 	i*86v32)
 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
 		os=-sysv32
@@ -775,7 +732,7 @@ case $basic_machine in
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
-	microblaze)
+        microblaze)
 		basic_machine=microblaze-xilinx
 		;;
 	mingw32)
@@ -814,18 +771,10 @@ case $basic_machine in
 	ms1-*)
 		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 		;;
-	msys)
-		basic_machine=i386-pc
-		os=-msys
-		;;
 	mvs)
 		basic_machine=i370-ibm
 		os=-mvs
 		;;
-	nacl)
-		basic_machine=le32-unknown
-		os=-nacl
-		;;
 	ncr3000)
 		basic_machine=i486-ncr
 		os=-sysv4
@@ -890,12 +839,6 @@ case $basic_machine in
 	np1)
 		basic_machine=np1-gould
 		;;
-	neo-tandem)
-		basic_machine=neo-tandem
-		;;
-	nse-tandem)
-		basic_machine=nse-tandem
-		;;
 	nsr-tandem)
 		basic_machine=nsr-tandem
 		;;
@@ -978,10 +921,9 @@ case $basic_machine in
 		;;
 	power)	basic_machine=power-ibm
 		;;
-	ppc | ppcbe)	basic_machine=powerpc-unknown
+	ppc)	basic_machine=powerpc-unknown
 		;;
-	ppc-* | ppcbe-*)
-		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
@@ -1075,9 +1017,6 @@ case $basic_machine in
 		basic_machine=i860-stratus
 		os=-sysv4
 		;;
-	strongarm-* | thumb-*)
-		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
 	sun2)
 		basic_machine=m68000-sun
 		;;
@@ -1134,8 +1073,20 @@ case $basic_machine in
 		basic_machine=t90-cray
 		os=-unicos
 		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
 	tile*)
-		basic_machine=$basic_machine-unknown
+		basic_machine=tile-unknown
 		os=-linux-gnu
 		;;
 	tx39)
@@ -1205,9 +1156,6 @@ case $basic_machine in
 	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
@@ -1305,11 +1253,11 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-	# First match some system type aliases
-	# that might get confused with valid system types.
+        # 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
+        -auroraux)
+	        os=-auroraux
 		;;
 	-solaris1 | -solaris1.*)
 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
@@ -1345,9 +1293,8 @@ case $os in
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -chorusos* | -chorusrdb* | -cegcc* \
-	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -linux-android* \
-	      | -linux-newlib* | -linux-uclibc* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
 	      | -uxpv* | -beos* | -mpeix* | -udk* \
 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1394,7 +1341,7 @@ case $os in
 	-opened*)
 		os=-openedition
 		;;
-	-os400*)
+        -os400*)
 		os=-os400
 		;;
 	-wince*)
@@ -1443,7 +1390,7 @@ case $os in
 	-sinix*)
 		os=-sysv4
 		;;
-	-tpf*)
+        -tpf*)
 		os=-tpf
 		;;
 	-triton*)
@@ -1488,8 +1435,6 @@ case $os in
 	-dicos*)
 		os=-dicos
 		;;
-	-nacl*)
-		;;
 	-none)
 		;;
 	*)
@@ -1512,10 +1457,10 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
-	score-*)
+        score-*)
 		os=-elf
 		;;
-	spu-*)
+        spu-*)
 		os=-elf
 		;;
 	*-acorn)
@@ -1527,17 +1472,8 @@ case $basic_machine in
 	arm*-semi)
 		os=-aout
 		;;
-	c4x-* | tic4x-*)
-		os=-coff
-		;;
-	tic54x-*)
-		os=-coff
-		;;
-	tic55x-*)
-		os=-coff
-		;;
-	tic6x-*)
-		os=-coff
+        c4x-* | tic4x-*)
+        	os=-coff
 		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
@@ -1557,11 +1493,14 @@ case $basic_machine in
 		;;
 	m68000-sun)
 		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
 		;;
 	m68*-cisco)
 		os=-aout
 		;;
-	mep-*)
+        mep-*)
 		os=-elf
 		;;
 	mips*-cisco)
@@ -1588,7 +1527,7 @@ case $basic_machine in
 	*-ibm)
 		os=-aix
 		;;
-	*-knuth)
+    	*-knuth)
 		os=-mmixware
 		;;
 	*-wec)
diff --git a/config/depcomp b/config/depcomp
index bd0ac08..df8eea7 100755
--- a/config/depcomp
+++ b/config/depcomp
@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2011-12-04.11; # UTC
+scriptversion=2009-04-28.21; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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
@@ -44,7 +44,7 @@ Environment variables:
   object      Object file output by `PROGRAMS ARGS'.
   DEPDIR      directory where to store dependencies.
   depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputting dependencies.
+  tmpdepfile  Temporary file to use when outputing dependencies.
   libtool     Whether libtool is used (yes/no).
 
 Report bugs to <bug-automake at gnu.org>.
@@ -90,18 +90,10 @@ if test "$depmode" = msvcmsys; then
    # This is just like msvisualcpp but w/o cygpath translation.
    # Just convert the backslash-escaped backslashes to single forward
    # slashes to satisfy depend.m4
-   cygpath_u='sed s,\\\\,/,g'
+   cygpath_u="sed s,\\\\\\\\,/,g"
    depmode=msvisualcpp
 fi
 
-if test "$depmode" = msvc7msys; then
-   # This is just like msvc7 but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u='sed s,\\\\,/,g'
-   depmode=msvc7
-fi
-
 case "$depmode" in
 gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
@@ -166,12 +158,10 @@ gcc)
 ' < "$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.  hp depmode also adds that space, but also prefixes the VPATH
-## to the object.  Take care to not repeat it in the output.
+## 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 "s|.*$object$||" -e '/:$/d' \
-      | sed -e 's/$/ :/' >> "$depfile"
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
@@ -415,52 +405,6 @@ tru64)
    rm -f "$tmpdepfile"
    ;;
 
-msvc7)
-  if test "$libtool" = yes; then
-    showIncludes=-Wc,-showIncludes
-  else
-    showIncludes=-showIncludes
-  fi
-  "$@" $showIncludes > "$tmpdepfile"
-  stat=$?
-  grep -v '^Note: including file: ' "$tmpdepfile"
-  if test "$stat" = 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  # The first sed program below extracts the file names and escapes
-  # backslashes for cygpath.  The second sed program outputs the file
-  # name when reading, but also accumulates all include files in the
-  # hold buffer in order to output them again at the end.  This only
-  # works with sed implementations that can handle large buffers.
-  sed < "$tmpdepfile" -n '
-/^Note: including file:  *\(.*\)/ {
-  s//\1/
-  s/\\/\\\\/g
-  p
-}' | $cygpath_u | sort -u | sed -n '
-s/ /\\ /g
-s/\(.*\)/	\1 \\/p
-s/.\(.*\) \\/\1:/
-H
-$ {
-  s/.*/	/
-  G
-  p
-}' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-msvc7msys)
-  # 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
-  ;;
-
 #nosideeffect)
   # This comment above is used by automake to tell side-effect
   # dependency tracking mechanisms from slower ones.
@@ -559,9 +503,7 @@ makedepend)
   touch "$tmpdepfile"
   ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
   rm -f "$depfile"
-  # makedepend may prepend the VPATH from the source file name to the object.
-  # No need to regex-escape $object, excess matching of '.' is harmless.
-  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
   sed '1,2d' "$tmpdepfile" | tr ' ' '
 ' | \
 ## Some versions of the HPUX 10.20 sed can't process this invocation
diff --git a/config/install-sh b/config/install-sh
index a9244eb..6781b98 100755
--- a/config/install-sh
+++ b/config/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2011-01-19.21; # UTC
+scriptversion=2009-04-28.21; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -156,10 +156,6 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
-	# Protect names problematic for `test' and other utilities.
-	case $dst_arg in
-	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
-	esac
 	shift;;
 
     -T) no_target_directory=true;;
@@ -190,10 +186,6 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
-    # Protect names problematic for `test' and other utilities.
-    case $dst_arg in
-      -* | [=\(\)!]) dst_arg=./$dst_arg;;
-    esac
   done
 fi
 
@@ -208,11 +200,7 @@ if test $# -eq 0; then
 fi
 
 if test -z "$dir_arg"; then
-  do_exit='(exit $ret); exit $ret'
-  trap "ret=129; $do_exit" 1
-  trap "ret=130; $do_exit" 2
-  trap "ret=141; $do_exit" 13
-  trap "ret=143; $do_exit" 15
+  trap '(exit $?); exit' 1 2 13 15
 
   # Set umask so as not to create temps with too-generous modes.
   # However, 'strip' requires both read and write access to temps.
@@ -240,9 +228,9 @@ fi
 
 for src
 do
-  # Protect names problematic for `test' and other utilities.
+  # Protect names starting with `-'.
   case $src in
-    -* | [=\(\)!]) src=./$src;;
+    -*) src=./$src;;
   esac
 
   if test -n "$dir_arg"; then
@@ -264,7 +252,12 @@ do
       echo "$0: no destination specified." >&2
       exit 1
     fi
+
     dst=$dst_arg
+    # 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.
@@ -392,7 +385,7 @@ do
 
       case $dstdir in
 	/*) prefix='/';;
-	[-=\(\)!]*) prefix='./';;
+	-*) prefix='./';;
 	*)  prefix='';;
       esac
 
@@ -410,7 +403,7 @@ do
 
       for d
       do
-	test X"$d" = X && continue
+	test -z "$d" && continue
 
 	prefix=$prefix$d
 	if test -d "$prefix"; then
diff --git a/aclocal.m4 b/config/libtool.m4
similarity index 65%
copy from aclocal.m4
copy to config/libtool.m4
index 53bf10f..671cde1 100644
--- a/aclocal.m4
+++ b/config/libtool.m4
@@ -1,30 +1,7 @@
-# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
-[m4_warning([this file was generated for autoconf 2.68.
-You have another version of autoconf.  It may work, but is not guaranteed to.
-If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
-
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -33,8 +10,7 @@ To do so, use the procedure documented by the package, typically `autoreconf'.])
 
 m4_define([_LT_COPYING], [dnl
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -61,7 +37,7 @@ m4_define([_LT_COPYING], [dnl
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 ])
 
-# serial 57 LT_INIT
+# serial 56 LT_INIT
 
 
 # LT_PREREQ(VERSION)
@@ -90,7 +66,6 @@ esac
 # ------------------
 AC_DEFUN([LT_INIT],
 [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
-AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
 AC_BEFORE([$0], [LTDL_INIT])dnl
@@ -107,8 +82,6 @@ AC_REQUIRE([LTVERSION_VERSION])dnl
 AC_REQUIRE([LTOBSOLETE_VERSION])dnl
 m4_require([_LT_PROG_LTMAIN])dnl
 
-_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
-
 dnl Parse OPTIONS
 _LT_SET_OPTIONS([$0], [$1])
 
@@ -145,7 +118,7 @@ m4_defun([_LT_CC_BASENAME],
     *) break;;
   esac
 done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 ])
 
 
@@ -165,11 +138,6 @@ m4_defun([_LT_FILEUTILS_DEFAULTS],
 m4_defun([_LT_SETUP],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
-
-_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
-dnl
 _LT_DECL([], [host_alias], [0], [The host system])dnl
 _LT_DECL([], [host], [0])dnl
 _LT_DECL([], [host_os], [0])dnl
@@ -192,13 +160,10 @@ _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
 dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
 m4_require([_LT_CMD_RELOAD])dnl
 m4_require([_LT_CHECK_MAGIC_METHOD])dnl
-m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_WITH_SYSROOT])dnl
 
 _LT_CONFIG_LIBTOOL_INIT([
 # See if we are running on zsh, and set the options which allow our
@@ -214,6 +179,7 @@ fi
 _LT_CHECK_OBJDIR
 
 m4_require([_LT_TAG_COMPILER])dnl
+_LT_PROG_ECHO_BACKSLASH
 
 case $host_os in
 aix3*)
@@ -227,6 +193,23 @@ aix3*)
   ;;
 esac
 
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -267,28 +250,6 @@ _LT_CONFIG_COMMANDS
 ])# _LT_SETUP
 
 
-# _LT_PREPARE_SED_QUOTE_VARS
-# --------------------------
-# Define a few sed substitution that help us do robust quoting.
-m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
-[# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-])
-
 # _LT_PROG_LTMAIN
 # ---------------
 # Note that this code is called both from `configure', and `config.status'
@@ -302,6 +263,9 @@ ltmain="$ac_aux_dir/ltmain.sh"
 ])# _LT_PROG_LTMAIN
 
 
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
 
 # So that we can recreate a full libtool script including additional
 # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
@@ -355,6 +319,9 @@ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
 
 
 
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
 
 
 # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
@@ -441,7 +408,7 @@ m4_define([_lt_decl_all_varnames],
 # declaration there will have the same value as in `configure'.  VARNAME
 # must have a single quote delimited value for this to work.
 m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
 
 
 # _LT_CONFIG_STATUS_DECLARATIONS
@@ -451,7 +418,7 @@ m4_define([_LT_CONFIG_STATUS_DECLARE],
 # embedded single quotes properly.  In configure, this macro expands
 # each variable declared with _LT_DECL (and _LT_TAGDECL) into:
 #
-#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+#    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
 m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
 [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
     [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
@@ -550,20 +517,12 @@ LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$[]1
-_LTECHO_EOF'
-}
-
 # Quote evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_quote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -574,9 +533,9 @@ done
 # Double-quote double-evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_dquote_varnames); do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -584,38 +543,16 @@ for var in lt_decl_all_varnames([[ \
     esac
 done
 
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\[$]0 --fallback-echo"')dnl "
+  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
+  ;;
+esac
+
 _LT_OUTPUT_LIBTOOL_INIT
 ])
 
-# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
-# ------------------------------------
-# Generate a child script FILE with all initialization necessary to
-# reuse the environment learned by the parent script, and make the
-# file executable.  If COMMENT is supplied, it is inserted after the
-# `#!' sequence but before initialization text begins.  After this
-# macro, additional text can be appended to FILE to form the body of
-# the child script.  The macro ends with non-zero status if the
-# file could not be fully written (such as if the disk is full).
-m4_ifdef([AS_INIT_GENERATED],
-[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
-[m4_defun([_LT_GENERATED_FILE_INIT],
-[m4_require([AS_PREPARE])]dnl
-[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
-[lt_write_fail=0
-cat >$1 <<_ASEOF || lt_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-$2
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$1 <<\_ASEOF || lt_write_fail=1
-AS_SHELL_SANITIZE
-_AS_PREPARE
-exec AS_MESSAGE_FD>&1
-_ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
-m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 
 # LT_OUTPUT
 # ---------
@@ -625,11 +562,20 @@ m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 AC_DEFUN([LT_OUTPUT],
 [: ${CONFIG_LT=./config.lt}
 AC_MSG_NOTICE([creating $CONFIG_LT])
-_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
-[# Run this file to recreate a libtool stub with the current configuration.])
+cat >"$CONFIG_LT" <<_LTEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
 
-cat >>"$CONFIG_LT" <<\_LTEOF
 lt_cl_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AS_SHELL_SANITIZE
+_AS_PREPARE
+
+exec AS_MESSAGE_FD>&1
 exec AS_MESSAGE_LOG_FD>>config.log
 {
   echo
@@ -655,7 +601,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2011 Free Software Foundation, Inc.
+Copyright (C) 2008 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -700,13 +646,15 @@ chmod +x "$CONFIG_LT"
 # appending to config.log, which fails on DOS, as config.log is still kept
 # open by configure.  Here we exec the FD to /dev/null, effectively closing
 # config.log, so it can be properly (re)opened and appended to by config.lt.
-lt_cl_success=:
-test "$silent" = yes &&
-  lt_config_lt_args="$lt_config_lt_args --quiet"
-exec AS_MESSAGE_LOG_FD>/dev/null
-$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-exec AS_MESSAGE_LOG_FD>>config.log
-$lt_cl_success || AS_EXIT(1)
+if test "$no_create" != yes; then
+  lt_cl_success=:
+  test "$silent" = yes &&
+    lt_config_lt_args="$lt_config_lt_args --quiet"
+  exec AS_MESSAGE_LOG_FD>/dev/null
+  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+  exec AS_MESSAGE_LOG_FD>>config.log
+  $lt_cl_success || AS_EXIT(1)
+fi
 ])# LT_OUTPUT
 
 
@@ -769,12 +717,15 @@ _LT_EOF
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" \
-     || (rm -f "$cfgfile"; exit 1)
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
 
-  _LT_PROG_REPLACE_SHELLFNS
+  _LT_PROG_XSI_SHELLFNS
 
-   mv -f "$cfgfile" "$ofile" ||
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 ],
@@ -819,7 +770,6 @@ AC_DEFUN([LT_LANG],
 m4_case([$1],
   [C],			[_LT_LANG(C)],
   [C++],		[_LT_LANG(CXX)],
-  [Go],			[_LT_LANG(GO)],
   [Java],		[_LT_LANG(GCJ)],
   [Fortran 77],		[_LT_LANG(F77)],
   [Fortran],		[_LT_LANG(FC)],
@@ -841,29 +791,6 @@ m4_defun([_LT_LANG],
 ])# _LT_LANG
 
 
-m4_ifndef([AC_PROG_GO], [
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_GO.  When it is available in    #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-m4_defun([AC_PROG_GO],
-[AC_LANG_PUSH(Go)dnl
-AC_ARG_VAR([GOC],     [Go compiler command])dnl
-AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
-_AC_ARG_VAR_LDFLAGS()dnl
-AC_CHECK_TOOL(GOC, gccgo)
-if test -z "$GOC"; then
-  if test -n "$ac_tool_prefix"; then
-    AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
-  fi
-fi
-if test -z "$GOC"; then
-  AC_CHECK_PROG(GOC, gccgo, gccgo, false)
-fi
-])#m4_defun
-])#m4_ifndef
-
-
 # _LT_LANG_DEFAULT_CONFIG
 # -----------------------
 m4_defun([_LT_LANG_DEFAULT_CONFIG],
@@ -894,10 +821,6 @@ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
        m4_ifdef([LT_PROG_GCJ],
 	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
 
-AC_PROVIDE_IFELSE([AC_PROG_GO],
-  [LT_LANG(GO)],
-  [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
-
 AC_PROVIDE_IFELSE([LT_PROG_RC],
   [LT_LANG(RC)],
   [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
@@ -908,13 +831,11 @@ AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
 AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
 AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
 AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
 dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
 dnl AC_DEFUN([AC_LIBTOOL_F77], [])
 dnl AC_DEFUN([AC_LIBTOOL_FC], [])
 dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
-dnl AC_DEFUN([AC_LIBTOOL_RC], [])
 
 
 # _LT_TAG_COMPILER
@@ -1000,13 +921,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	# If there is a non-empty error log, and "single_module"
-	# appears in it, assume the flag caused a linker warning
-        if test -s conftest.err && $GREP single_module conftest.err; then
-	  cat conftest.err >&AS_MESSAGE_LOG_FD
-	# Otherwise, if the output was created with a 0 exit code from
-	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1014,7 +929,6 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	rm -rf libconftest.dylib*
 	rm -f conftest.*
       fi])
-
     AC_CACHE_CHECK([for -exported_symbols_list linker flag],
       [lt_cv_ld_exported_symbols_list],
       [lt_cv_ld_exported_symbols_list=no
@@ -1026,34 +940,6 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	[lt_cv_ld_exported_symbols_list=no])
 	LDFLAGS="$save_LDFLAGS"
     ])
-
-    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
-      [lt_cv_ld_force_load=no
-      cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
-      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
-      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
-      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
-      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
-      cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
-      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
-      _lt_result=$?
-      if test -s conftest.err && $GREP force_load conftest.err; then
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
-	lt_cv_ld_force_load=yes
-      else
-	cat conftest.err >&AS_MESSAGE_LOG_FD
-      fi
-        rm -f conftest.err libconftest.a conftest conftest.c
-        rm -rf conftest.dSYM
-    ])
     case $host_os in
     rhapsody* | darwin1.[[012]])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -1081,7 +967,7 @@ _LT_EOF
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+    if test "$DSYMUTIL" != ":"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -1091,8 +977,8 @@ _LT_EOF
 ])
 
 
-# _LT_DARWIN_LINKER_FEATURES([TAG])
-# ---------------------------------
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
 # Checks for linker and compiler features on darwin
 m4_defun([_LT_DARWIN_LINKER_FEATURES],
 [
@@ -1101,13 +987,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_automatic, $1)=yes
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-    m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
-                  [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
-  else
-    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
-  fi
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=''
   _LT_TAGVAR(link_all_deplibs, $1)=yes
   _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -1115,7 +995,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
+    output_verbose_link_cmd=echo
     _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -1131,141 +1011,202 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   fi
 ])
 
-# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
-# ----------------------------------
+# _LT_SYS_MODULE_PATH_AIX
+# -----------------------
 # Links a minimal program and checks the executable
 # for the system default hardcoded library path. In most cases,
 # this is /usr/lib:/lib, but when the MPI compilers are used
 # the location of the communication and MPI libs are included too.
 # If we don't find anything, use the default library path according
 # to the aix ld manual.
-# Store the results from the different compilers for each TAGNAME.
-# Allow to override them for all tags through lt_cv_aix_libpath.
 m4_defun([_LT_SYS_MODULE_PATH_AIX],
 [m4_require([_LT_DECL_SED])dnl
-if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
-  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
-  lt_aix_libpath_sed='[
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }]'
-  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi],[])
-  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
-  fi
-  ])
-  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
-fi
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 ])# _LT_SYS_MODULE_PATH_AIX
 
 
 # _LT_SHELL_INIT(ARG)
 # -------------------
 m4_define([_LT_SHELL_INIT],
-[m4_divert_text([M4SH-INIT], [$1
-])])# _LT_SHELL_INIT
-
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_SHELL_INIT
 
 
 # _LT_PROG_ECHO_BACKSLASH
 # -----------------------
-# Find how we can fake an echo command that does not interpret backslash.
-# In particular, with Autoconf 2.60 or later we add some code to the start
-# of the generated configure script which will find a shell with a builtin
-# printf (which we can use as an echo command).
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
 m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-AC_MSG_CHECKING([how to print strings])
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
-   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='printf %s\n'
+[_LT_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $ECHO works!
+  :
 else
-  # Use this function as a fallback that always works.
-  func_fallback_echo ()
-  {
-    eval 'cat <<_LTECHO_EOF
-$[]1
-_LTECHO_EOF'
-  }
-  ECHO='func_fallback_echo'
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
 fi
 
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*" 
-}
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<_LT_EOF
+[$]*
+_LT_EOF
+  exit 0
+fi
 
-case "$ECHO" in
-  printf*) AC_MSG_RESULT([printf]) ;;
-  print*) AC_MSG_RESULT([print -r]) ;;
-  *) AC_MSG_RESULT([cat]) ;;
-esac
+# 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
 
-m4_ifdef([_AS_DETECT_SUGGESTED],
-[_AS_DETECT_SUGGESTED([
-  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
-    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-    PATH=/empty FPATH=/empty; export PATH FPATH
-    test "X`printf %s $ECHO`" = "X$ECHO" \
-      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+if test -z "$lt_ECHO"; then
+  if test "X${echo_test_string+set}" != Xset; then
+    # find a string as large as possible, as long as the shell can cope with it
+    for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+      then
+        break
+      fi
+    done
+  fi
 
-_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
-])# _LT_PROG_ECHO_BACKSLASH
+  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+     test "X$echo_testing_string" = "X$echo_test_string"; then
+    :
+  else
+    # The Solaris, AIX, and Digital Unix default echo programs unquote
+    # backslashes.  This makes it impossible to quote backslashes using
+    #   echo "$something" | sed 's/\\/\\\\/g'
+    #
+    # So, first we look for a working echo in the user's PATH.
 
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for dir in $PATH /usr/ucb; do
+      IFS="$lt_save_ifs"
+      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        ECHO="$dir/echo"
+        break
+      fi
+    done
+    IFS="$lt_save_ifs"
 
-# _LT_WITH_SYSROOT
-# ----------------
-AC_DEFUN([_LT_WITH_SYSROOT],
-[AC_MSG_CHECKING([for sysroot])
-AC_ARG_WITH([sysroot],
-[  --with-sysroot[=DIR] Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).],
-[], [with_sysroot=no])
-
-dnl lt_sysroot will always be passed unquoted.  We quote it here
-dnl in case the user passed a directory name.
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
-   if test "$GCC" = yes; then
-     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
-   fi
-   ;; #(
- /*)
-   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
-   ;; #(
- no|'')
-   ;; #(
- *)
-   AC_MSG_RESULT([${with_sysroot}])
-   AC_MSG_ERROR([The sysroot must be an absolute path.])
-   ;;
-esac
+    if test "X$ECHO" = Xecho; then
+      # We didn't find a better echo, so look for alternatives.
+      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        # This shell has a builtin print -r that does the trick.
+        ECHO='print -r'
+      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+	   test "X$CONFIG_SHELL" != X/bin/ksh; then
+        # If we have ksh, try running configure again with it.
+        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+        export ORIGINAL_CONFIG_SHELL
+        CONFIG_SHELL=/bin/ksh
+        export CONFIG_SHELL
+        exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+      else
+        # Try using printf.
+        ECHO='printf %s\n'
+        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	  # Cool, printf works
+	  :
+        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	  export CONFIG_SHELL
+	  SHELL="$CONFIG_SHELL"
+	  export SHELL
+	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        else
+	  # maybe with a smaller string...
+	  prev=:
+
+	  for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+	    then
+	      break
+	    fi
+	    prev="$cmd"
+	  done
+
+	  if test "$prev" != 'sed 50q "[$]0"'; then
+	    echo_test_string=`eval $prev`
+	    export echo_test_string
+	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	  else
+	    # Oops.  We lost completely, so just stick with echo.
+	    ECHO=echo
+	  fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(lt_ECHO)
+])
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1],
+    [An echo program that does not interpret backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
 
- AC_MSG_RESULT([${lt_sysroot:-no}])
-_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
-[dependent libraries, and in which our libraries should be installed.])])
 
 # _LT_ENABLE_LOCK
 # ---------------
@@ -1295,7 +1236,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     if test "$lt_cv_prog_gnu_ld" = yes; then
       case `/usr/bin/file conftest.$ac_objext` in
@@ -1388,27 +1329,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-*-*solaris*)
+sparc*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*)
-        case $host in
-        i?86-*-solaris*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        sparc*-*-solaris*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-        esac
-        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
-        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
-        fi
-        ;;
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -1426,47 +1354,14 @@ need_locks="$enable_libtool_lock"
 ])# _LT_ENABLE_LOCK
 
 
-# _LT_PROG_AR
-# -----------
-m4_defun([_LT_PROG_AR],
-[AC_CHECK_TOOLS(AR, [ar], false)
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
-
-AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
-  [lt_cv_ar_at_file=no
-   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
-     [echo conftest.$ac_objext > conftest.lst
-      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
-      AC_TRY_EVAL([lt_ar_try])
-      if test "$ac_status" -eq 0; then
-	# Ensure the archiver fails upon bogus file names.
-	rm -f conftest.$ac_objext libconftest.a
-	AC_TRY_EVAL([lt_ar_try])
-	if test "$ac_status" -ne 0; then
-          lt_cv_ar_at_file=@
-        fi
-      fi
-      rm -f conftest.* libconftest.a
-     ])
-  ])
-
-if test "x$lt_cv_ar_at_file" = xno; then
-  archiver_list_spec=
-else
-  archiver_list_spec=$lt_cv_ar_at_file
-fi
-_LT_DECL([], [archiver_list_spec], [1],
-  [How to feed a file listing to the archiver])
-])# _LT_PROG_AR
-
-
 # _LT_CMD_OLD_ARCHIVE
 # -------------------
 m4_defun([_LT_CMD_OLD_ARCHIVE],
-[_LT_PROG_AR
+[AC_CHECK_TOOL(AR, ar, false)
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1])
 
 AC_CHECK_TOOL(STRIP, strip, :)
 test -z "$STRIP" && STRIP=:
@@ -1485,27 +1380,18 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
-
-case $host_os in
-  darwin*)
-    lock_old_archive_extraction=yes ;;
-  *)
-    lock_old_archive_extraction=no ;;
-esac
 _LT_DECL([], [old_postinstall_cmds], [2])
 _LT_DECL([], [old_postuninstall_cmds], [2])
 _LT_TAGDECL([], [old_archive_cmds], [2],
     [Commands used to build an old-style archive])
-_LT_DECL([], [lock_old_archive_extraction], [0],
-    [Whether to use a lock for old archive extraction])
 ])# _LT_CMD_OLD_ARCHIVE
 
 
@@ -1530,15 +1416,15 @@ AC_CACHE_CHECK([$1], [$2],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        $2=yes
@@ -1578,7 +1464,7 @@ AC_CACHE_CHECK([$1], [$2],
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          $2=yes
@@ -1641,11 +1527,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  mint*)
-    # On MiNT this can take a long time and run out of memory.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -1671,11 +1552,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=196608
     ;;
 
-  os2*)
-    # The test takes a long time on OS/2.
-    lt_cv_sys_max_cmd_len=8192
-    ;;
-
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -1715,8 +1591,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
-	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -1767,7 +1643,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-[#line $LINENO "configure"
+[#line __oline__ "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -1808,13 +1684,7 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 42; }
+void fnord() { int i=42;}
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -1823,11 +1693,7 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else
-        {
-	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
-          else puts (dlerror ());
-	}
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
       /* dlclose (self); */
     }
   else
@@ -2003,16 +1869,16 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
@@ -2171,7 +2037,6 @@ m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_OBJDUMP])dnl
 m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
 	[], [
@@ -2180,23 +2045,16 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
-  case $lt_search_path_spec in
-  *\;*)
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
-    ;;
-  *)
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
-    ;;
-  esac
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -2209,7 +2067,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -2229,13 +2087,7 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[[lt_foo]]++; }
   if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
 }'`
-  # AWK program above erroneously prepends '/' to C:/dos/paths
-  # for these hosts.
-  case $host_os in
-    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
-  esac
-  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi])
@@ -2261,7 +2113,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -2270,7 +2122,7 @@ aix3*)
   ;;
 
 aix[[4-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -2323,7 +2175,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -2335,7 +2187,7 @@ beos*)
   ;;
 
 bsdi[[45]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -2354,9 +2206,8 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -2377,83 +2228,36 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-m4_if([$1], [],[
-      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
       if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH.
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
       else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
       fi
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
-
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
-    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
     ;;
   esac
+  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -2474,7 +2278,7 @@ m4_if([$1], [],[
   ;;
 
 dgux*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -2482,6 +2286,10 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -2489,7 +2297,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[[23]].*) objformat=aout ;;
+    freebsd[[123]]*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -2507,7 +2315,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2.*)
+  freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[[01]]* | freebsdelf3.[[01]]*)
@@ -2527,26 +2335,12 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -2592,14 +2386,12 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
   postinstall_cmds='chmod 555 $lib'
-  # or fails outright, so override atomically:
-  install_override_mode=555
   ;;
 
 interix[[3-9]]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -2615,7 +2407,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux # correct to gnu/linux during the next big refactor
+		version_type=linux
 	else
 		version_type=irix
 	fi ;;
@@ -2652,9 +2444,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux # correct to gnu/linux during the next big refactor
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2662,21 +2454,16 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
-
   # Some binutils ld are patched to set DT_RUNPATH
-  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
-    [lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
-	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
-    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
-	 [lt_cv_shlibpath_overrides_runpath=yes])])
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-    ])
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+       [shlibpath_overrides_runpath=yes])])
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -2688,9 +2475,8 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
-
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -2721,7 +2507,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -2790,7 +2576,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2815,7 +2601,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -2839,7 +2625,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux # correct to gnu/linux during the next big refactor
+    version_type=linux
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -2870,7 +2656,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2880,7 +2666,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -2922,8 +2708,6 @@ _LT_DECL([], [library_names_spec], [1],
     The last name is the one that the linker finds with -lNAME]])
 _LT_DECL([], [soname_spec], [1],
     [[The coded name of the library, if different from the real name]])
-_LT_DECL([], [install_override_mode], [1],
-    [Permission mode override for installation of shared libraries])
 _LT_DECL([], [postinstall_cmds], [2],
     [Command to use after installation of a shared archive])
 _LT_DECL([], [postuninstall_cmds], [2],
@@ -3036,7 +2820,6 @@ AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 m4_require([_LT_DECL_SED])dnl
 m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
 
 AC_ARG_WITH([gnu-ld],
     [AS_HELP_STRING([--with-gnu-ld],
@@ -3158,11 +2941,6 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
-      reload_cmds=false
-    fi
-    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -3171,8 +2949,8 @@ case $host_os in
     fi
     ;;
 esac
-_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_TAGDECL([], [reload_cmds], [2])dnl
+_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_DECL([], [reload_cmds], [2])dnl
 ])# _LT_CMD_RELOAD
 
 
@@ -3224,18 +3002,16 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+  if ( file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    # Keep this pattern in sync with the one in func_win32_libid.
-    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc*)
+cegcc)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -3265,10 +3041,6 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-haiku*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -3277,11 +3049,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -3302,8 +3074,8 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -3381,21 +3153,6 @@ tpf*)
   ;;
 esac
 ])
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
-  case $host_os in
-  mingw* | pw32*)
-    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
-      want_nocaseglob=yes
-    else
-      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
-    fi
-    ;;
-  esac
-fi
-
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -3403,11 +3160,7 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 _LT_DECL([], [deplibs_check_method], [1],
     [Method to check whether dependent libraries are shared objects])
 _LT_DECL([], [file_magic_cmd], [1],
-    [Command to use when deplibs_check_method = "file_magic"])
-_LT_DECL([], [file_magic_glob], [1],
-    [How to find potential files when deplibs_check_method = "file_magic"])
-_LT_DECL([], [want_nocaseglob], [1],
-    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+    [Command to use when deplibs_check_method == "file_magic"])
 ])# _LT_CHECK_MAGIC_METHOD
 
 
@@ -3464,19 +3217,7 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$DUMPBIN"; then :
-    # Let the user override the test.
-  else
-    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
-    *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
-      ;;
-    *)
-      DUMPBIN=:
-      ;;
-    esac
-  fi
+  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
   AC_SUBST([DUMPBIN])
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -3489,13 +3230,13 @@ _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
 AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
   [lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
   cat conftest.out >&AS_MESSAGE_LOG_FD
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -3510,67 +3251,6 @@ dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AM_PROG_NM], [])
 dnl AC_DEFUN([AC_PROG_NM], [])
 
-# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-# --------------------------------
-# how to determine the name of the shared library
-# associated with a specific link library.
-#  -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-m4_require([_LT_DECL_DLLTOOL])
-AC_CACHE_CHECK([how to associate runtime and link libraries],
-lt_cv_sharedlib_from_linklib_cmd,
-[lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
-  case `$DLLTOOL --help 2>&1` in
-  *--identify-strict*)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
-    ;;
-  *)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
-    ;;
-  esac
-  ;;
-*)
-  # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
-  ;;
-esac
-])
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
-    [Command to associate shared and link libraries])
-])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-
-
-# _LT_PATH_MANIFEST_TOOL
-# ----------------------
-# locate the manifest tool
-m4_defun([_LT_PATH_MANIFEST_TOOL],
-[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
-  [lt_cv_path_mainfest_tool=no
-  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
-  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
-  cat conftest.err >&AS_MESSAGE_LOG_FD
-  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
-    lt_cv_path_mainfest_tool=yes
-  fi
-  rm -f conftest*])
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
-  MANIFEST_TOOL=:
-fi
-_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
-])# _LT_PATH_MANIFEST_TOOL
-
 
 # LT_LIB_M
 # --------
@@ -3579,7 +3259,7 @@ AC_DEFUN([LT_LIB_M],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
 case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
   # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
@@ -3607,12 +3287,7 @@ m4_defun([_LT_COMPILER_NO_RTTI],
 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
 
 if test "$GCC" = yes; then
-  case $cc_basename in
-  nvcc*)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
-  *)
-    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
-  esac
+  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
 
   _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
     lt_cv_prog_compiler_rtti_exceptions,
@@ -3629,7 +3304,6 @@ _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
 m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([LT_PATH_NM])dnl
 AC_REQUIRE([LT_PATH_LD])dnl
 m4_require([_LT_DECL_SED])dnl
@@ -3697,8 +3371,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -3722,7 +3396,6 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK ['"\
 "     {last_section=section; section=\$ 3};"\
-"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -3735,7 +3408,6 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
-  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -3757,7 +3429,7 @@ _LT_EOF
   if AC_TRY_EVAL(ac_compile); then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
 	mv -f "$nlist"T "$nlist"
@@ -3769,18 +3441,6 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT@&t at _DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT@&t at _DLSYM_CONST
-#else
-# define LT@&t at _DLSYM_CONST const
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -3792,7 +3452,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-LT@&t at _DLSYM_CONST struct {
+const struct {
   const char *name;
   void       *address;
 }
@@ -3818,15 +3478,15 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_globsym_save_LIBS=$LIBS
-	  lt_globsym_save_CFLAGS=$CFLAGS
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
 	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS=$lt_globsym_save_LIBS
-	  CFLAGS=$lt_globsym_save_CFLAGS
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
 	else
 	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
 	fi
@@ -3859,13 +3519,6 @@ else
   AC_MSG_RESULT(ok)
 fi
 
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-  nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
-  nm_file_list_spec='@'
-fi
-
 _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
     [Take the output of nm and produce a listing of raw symbols and C names])
 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
@@ -3876,8 +3529,6 @@ _LT_DECL([global_symbol_to_c_name_address],
 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
     [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
     [Transform the output of nm in a C name address pair when lib prefix is needed])
-_LT_DECL([], [nm_file_list_spec], [1],
-    [Specify filename containing input files for $NM])
 ]) # _LT_CMD_GLOBAL_SYMBOLS
 
 
@@ -3889,6 +3540,7 @@ _LT_TAGVAR(lt_prog_compiler_wl, $1)=
 _LT_TAGVAR(lt_prog_compiler_pic, $1)=
 _LT_TAGVAR(lt_prog_compiler_static, $1)=
 
+AC_MSG_CHECKING([for $compiler option to produce PIC])
 m4_if([$1], [CXX], [
   # C++ specific cases for pic, static, wl, etc.
   if test "$GXX" = yes; then
@@ -3939,11 +3591,6 @@ m4_if([$1], [CXX], [
       # DJGPP does not support shared libraries at all
       _LT_TAGVAR(lt_prog_compiler_pic, $1)=
       ;;
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=
-      ;;
     interix[[3-9]]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
@@ -3993,12 +3640,6 @@ m4_if([$1], [CXX], [
 	  ;;
 	esac
 	;;
-      mingw* | cygwin* | os2* | pw32* | cegcc*)
-	# This hack is so that the source file can tell whether it is being
-	# built for inclusion in a dll (and should export symbols for example).
-	m4_if([$1], [GCJ], [],
-	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-	;;
       dgux*)
 	case $cc_basename in
 	  ec++*)
@@ -4055,7 +3696,7 @@ m4_if([$1], [CXX], [
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -4088,8 +3729,8 @@ m4_if([$1], [CXX], [
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
 	    ;;
-	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
-	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	  xlc* | xlC*)
+	    # IBM XL 8.0 on PPC
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
@@ -4151,7 +3792,7 @@ m4_if([$1], [CXX], [
 	;;
       solaris*)
 	case $cc_basename in
-	  CC* | sunCC*)
+	  CC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -4255,12 +3896,6 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
       ;;
 
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      _LT_TAGVAR(lt_prog_compiler_static, $1)=
-      ;;
-
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -4303,15 +3938,6 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
     esac
-
-    case $cc_basename in
-    nvcc*) # Cuda Compiler Driver 2.2
-      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
-      if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
-        _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
-      fi
-      ;;
-    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -4354,7 +3980,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    linux* | k*bsd*-gnu)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -4375,13 +4001,7 @@ m4_if([$1], [CXX], [
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
 	;;
-      nagfor*)
-	# NAG Fortran compiler
-	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
-	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+      pgcc* | pgf77* | pgf90* | pgf95*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -4393,40 +4013,25 @@ m4_if([$1], [CXX], [
         # All Alpha code is PIC.
         _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
         ;;
-      xl* | bgxl* | bgf* | mpixl*)
-	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+      xl*)
+	# IBM XL C 8.0/Fortran 10.1 on PPC
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
-	  ;;
-	*Sun\ F* | *Sun*Fortran*)
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	  ;;
-        *Intel*\ [[CF]]*Compiler*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	  ;;
-	*Portland\ Group*)
-	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
 	  ;;
 	esac
 	;;
@@ -4458,7 +4063,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+      f77* | f90* | f95*)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
       *)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
@@ -4515,11 +4120,9 @@ case $host_os in
     _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
     ;;
 esac
-
-AC_CACHE_CHECK([for $compiler option to produce PIC],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
-  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
 
 #
 # Check to make sure the PIC flag actually works.
@@ -4538,8 +4141,6 @@ fi
 _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
 	[Additional compiler flags for building library objects])
 
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
-	[How to pass a linker flag through the compiler])
 #
 # Check to make sure the static flag actually works.
 #
@@ -4560,7 +4161,6 @@ _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
 m4_defun([_LT_LINKER_SHLIBS],
 [AC_REQUIRE([LT_PATH_LD])dnl
 AC_REQUIRE([LT_PATH_NM])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_DECL_SED])dnl
@@ -4569,37 +4169,27 @@ m4_require([_LT_TAG_COMPILER])dnl
 AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
 m4_if([$1], [CXX], [
   _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
   case $host_os in
   aix[[4-9]]*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    # Also, AIX nm treats weak defined symbols like other global defined
-    # symbols, whereas GNU nm marks them as "W".
     if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     else
       _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     fi
     ;;
   pw32*)
     _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-    ;;
+  ;;
   cygwin* | mingw* | cegcc*)
-    case $cc_basename in
-    cl*)
-      _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-      ;;
-    *)
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
-      ;;
-    esac
-    ;;
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
   *)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-    ;;
+  ;;
   esac
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
 ], [
   runpath_var=
   _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -4614,6 +4204,7 @@ m4_if([$1], [CXX], [
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_direct_absolute, $1)=no
   _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
   _LT_TAGVAR(hardcode_libdir_separator, $1)=
   _LT_TAGVAR(hardcode_minus_L, $1)=no
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -4661,33 +4252,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
-
-  # On some targets, GNU ld is compatible enough with the native linker
-  # that we're better off using the native interface for both.
-  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
-    case $host_os in
-      aix*)
-	# The AIX port of GNU ld has always aspired to compatibility
-	# with the native linker.  However, as the warning in the GNU ld
-	# block says, versions before 2.19.5* couldn't really create working
-	# shared libraries, regardless of the interface used.
-	case `$LD -v 2>&1` in
-	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
-	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
-	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
-	  *)
-	    lt_use_gnu_ld_interface=yes
-	    ;;
-	esac
-	;;
-      *)
-	lt_use_gnu_ld_interface=yes
-	;;
-    esac
-  fi
-
-  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -4705,7 +4270,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
     fi
     supports_anon_versioning=no
     case `$LD -v 2>&1` in
-      *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
       *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
@@ -4721,12 +4285,11 @@ dnl Note also adjust exclude_expsyms for C++ above.
 	_LT_TAGVAR(ld_shlibs, $1)=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
 
 _LT_EOF
       fi
@@ -4762,12 +4325,10 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_TAGVAR(always_export_symbols, $1)=no
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
-      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -4785,11 +4346,6 @@ _LT_EOF
       fi
       ;;
 
-    haiku*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      _LT_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
     interix[[3-9]]*)
       _LT_TAGVAR(hardcode_direct, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -4805,7 +4361,7 @@ _LT_EOF
       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
 	case $cc_basename in
@@ -4815,16 +4371,15 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=' $pic_flag'
+	tmp_addflag=
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95* | pgfortran*)
-					# Portland Group f77 and f90 compilers
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -4835,17 +4390,13 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
 	  tmp_sharedflag='--shared' ;;
-	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[[cC]]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
-	nvcc*)	# Cuda Compiler Driver 2.2
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  _LT_TAGVAR(compiler_needs_object, $1)=yes
-	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  _LT_TAGVAR(compiler_needs_object, $1)=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -4861,16 +4412,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf* | bgf* | bgxlf* | mpixlf*)
+	xlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -4884,8 +4436,8 @@ _LT_EOF
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -4903,8 +4455,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4950,8 +4502,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4991,10 +4543,8 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -5081,9 +4631,9 @@ _LT_EOF
 	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_SYS_MODULE_PATH_AIX
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -5092,19 +4642,14 @@ _LT_EOF
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 _LT_SYS_MODULE_PATH_AIX([$1])
+	 _LT_SYS_MODULE_PATH_AIX
 	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
 	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  if test "$with_gnu_ld" = yes; then
-	    # We only use this code for GNU lds that support --whole-archive.
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	  else
-	    # Exported symbols can be pulled into shared objects from archives
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	  fi
+	  # Exported symbols can be pulled into shared objects from archives
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
 	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -5136,64 +4681,20 @@ _LT_EOF
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      case $cc_basename in
-      cl*)
-	# Native MSVC
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	_LT_TAGVAR(always_export_symbols, $1)=yes
-	_LT_TAGVAR(file_list_spec, $1)='@'
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
-	# The linker will not automatically build a static lib if we build a DLL.
-	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	_LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-	# Don't use ranlib
-	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
-	;;
-      *)
-	# Assume MSVC wrapper
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
-	# The linker will automatically build a .lib file if we build a DLL.
-	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	# FIXME: Should let the user specify the lib program.
-	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	;;
-      esac
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
       ;;
 
     darwin* | rhapsody*)
@@ -5206,6 +4707,10 @@ _LT_EOF
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
 
+    freebsd1*)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -5218,7 +4723,7 @@ _LT_EOF
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2.*)
+    freebsd2*)
       _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       _LT_TAGVAR(hardcode_direct, $1)=yes
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
@@ -5227,7 +4732,7 @@ _LT_EOF
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
       _LT_TAGVAR(hardcode_direct, $1)=yes
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -5235,7 +4740,7 @@ _LT_EOF
 
     hpux9*)
       if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -5250,13 +4755,14 @@ _LT_EOF
       ;;
 
     hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
       if test "$with_gnu_ld" = no; then
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
 	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
 	_LT_TAGVAR(hardcode_direct, $1)=yes
 	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
@@ -5268,16 +4774,16 @@ _LT_EOF
       ;;
 
     hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -5289,14 +4795,7 @@ _LT_EOF
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	m4_if($1, [], [
-	  # Older versions of the 11.00 compiler do not understand -b yet
-	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
-	  _LT_LINKER_OPTION([if $CC understands -b],
-	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
-	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
-	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
-	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       fi
@@ -5324,34 +4823,19 @@ _LT_EOF
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-	# This should be the same for all languages, so no per-tag cache variable.
-	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
-	  [lt_cv_irix_exported_symbol],
-	  [save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-	   AC_LINK_IFELSE(
-	     [AC_LANG_SOURCE(
-	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
-			      [C++], [[int foo (void) { return 0; }]],
-			      [Fortran 77], [[
-      subroutine foo
-      end]],
-			      [Fortran], [[
-      subroutine foo
-      end]])])],
-	      [lt_cv_irix_exported_symbol=yes],
-	      [lt_cv_irix_exported_symbol=no])
-           LDFLAGS="$save_LDFLAGS"])
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-	fi
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        AC_LINK_IFELSE(int foo(void) {},
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+        )
+        LDFLAGS="$save_LDFLAGS"
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -5413,17 +4897,17 @@ _LT_EOF
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -5433,13 +4917,13 @@ _LT_EOF
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -5452,9 +4936,9 @@ _LT_EOF
       _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -5630,38 +5114,36 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
-	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
-	[$RM conftest*
-	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-	  soname=conftest
-	  lib=conftest
-	  libobjs=conftest.$ac_objext
-	  deplibs=
-	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
-	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
-	  compiler_flags=-v
-	  linker_flags=-v
-	  verstring=
-	  output_objdir=.
-	  libname=conftest
-	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
-	  _LT_TAGVAR(allow_undefined_flag, $1)=
-	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
-	  then
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	  else
-	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  fi
-	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-	else
-	  cat conftest.err 1>&5
-	fi
-	$RM conftest*
-	])
-      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+        _LT_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+        then
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
       ;;
     esac
   fi
@@ -5698,6 +5180,9 @@ _LT_TAGDECL([], [no_undefined_flag], [1],
 _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
     [Flag to hardcode $libdir into a binary during linking.
     This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+    [[If ld is used when linking, flag to hardcode $libdir into a binary
+    during linking.  This must work even if $libdir does not exist]])
 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
     [Whether we need a single "-rpath" flag with a separated argument])
 _LT_TAGDECL([], [hardcode_direct], [0],
@@ -5723,6 +5208,8 @@ _LT_TAGDECL([], [inherit_rpath], [0],
     to runtime path list])
 _LT_TAGDECL([], [link_all_deplibs], [0],
     [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [fix_srcfile_path], [1],
+    [Fix the shell variable $srcfile for the compiler])
 _LT_TAGDECL([], [always_export_symbols], [0],
     [Set to "yes" if exported symbols are required])
 _LT_TAGDECL([], [export_symbols_cmds], [2],
@@ -5733,8 +5220,6 @@ _LT_TAGDECL([], [include_expsyms], [1],
     [Symbols that must always be exported])
 _LT_TAGDECL([], [prelink_cmds], [2],
     [Commands necessary for linking programs (against libraries) with templates])
-_LT_TAGDECL([], [postlink_cmds], [2],
-    [Commands necessary for finishing linking programs])
 _LT_TAGDECL([], [file_list_spec], [1],
     [Specify filename containing input files])
 dnl FIXME: Not yet implemented
@@ -5775,6 +5260,10 @@ compiler_DEFAULT=$CC
 _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
 if test -n "$compiler"; then
   _LT_COMPILER_NO_RTTI($1)
   _LT_COMPILER_PIC($1)
@@ -5824,15 +5313,14 @@ CC="$lt_save_CC"
 ])# _LT_LANG_C_CONFIG
 
 
-# _LT_LANG_CXX_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a C++ compiler are suitably
-# defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_CXX_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+# _LT_PROG_CXX
+# ------------
+# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
+# compiler, we have our own version here.
+m4_defun([_LT_PROG_CXX],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
+AC_PROG_CXX
 if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
     ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
     (test "X$CXX" != "Xg++"))) ; then
@@ -5840,6 +5328,22 @@ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
 else
   _lt_caught_CXX_error=yes
 fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_CXX
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_CXX], [])
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[AC_REQUIRE([_LT_PROG_CXX])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
 
 AC_LANG_PUSH(C++)
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
@@ -5851,6 +5355,7 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -5860,8 +5365,6 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -5893,7 +5396,6 @@ if test "$_lt_caught_CXX_error" != yes; then
 
   # Allow CC to be a program name with arguments.
   lt_save_CC=$CC
-  lt_save_CFLAGS=$CFLAGS
   lt_save_LD=$LD
   lt_save_GCC=$GCC
   GCC=$GXX
@@ -5911,7 +5413,6 @@ if test "$_lt_caught_CXX_error" != yes; then
   fi
   test -z "${LDCXX+set}" || LD=$LDCXX
   CC=${CXX-"c++"}
-  CFLAGS=$CXXFLAGS
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
   _LT_CC_BASENAME([$compiler])
@@ -5933,8 +5434,8 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Check if GNU C++ uses GNU ld as the underlying linker, since the
       # archiving commands below assume that GNU ld is being used.
       if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
 
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
         _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5966,7 +5467,7 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Commands to make compiler produce verbose output that lists
       # what "hidden" libraries, object files and flags are used when
       # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 
     else
       GXX=no
@@ -6075,10 +5576,10 @@ if test "$_lt_caught_CXX_error" != yes; then
           _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
           # Determine the default libpath from the value encoded in an empty
           # executable.
-          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_SYS_MODULE_PATH_AIX
           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
         else
           if test "$host_cpu" = ia64; then
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -6087,19 +5588,14 @@ if test "$_lt_caught_CXX_error" != yes; then
           else
 	    # Determine the default libpath from the value encoded in an
 	    # empty executable.
-	    _LT_SYS_MODULE_PATH_AIX([$1])
+	    _LT_SYS_MODULE_PATH_AIX
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 	    # Warning - without using the other run time loading flags,
 	    # -berok will link without error, but may produce a broken library.
 	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
 	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	    if test "$with_gnu_ld" = yes; then
-	      # We only use this code for GNU lds that support --whole-archive.
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	    else
-	      # Exported symbols can be pulled into shared objects from archives
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	    fi
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
 	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 	    # This is similar to how AIX traditionally builds its shared
 	    # libraries.
@@ -6129,75 +5625,28 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
       cygwin* | mingw* | pw32* | cegcc*)
-	case $GXX,$cc_basename in
-	,cl* | no,cl*)
-	  # Native MSVC
-	  # hardcode_libdir_flag_spec is actually meaningless, as there is
-	  # no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=yes
-	  _LT_TAGVAR(file_list_spec, $1)='@'
-	  # Tell ltmain to make .lib files, not .a files.
-	  libext=lib
-	  # Tell ltmain to make .dll files, not .so files.
-	  shrext_cmds=".dll"
-	  # FIXME: Setting linknames here is a bad hack.
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	    else
-	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	    fi~
-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	    linknames='
-	  # The linker will not automatically build a static lib if we build a DLL.
-	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-	  # Don't use ranlib
-	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	    lt_tool_outputfile="@TOOL_OUTPUT@"~
-	    case $lt_outputfile in
-	      *.exe|*.EXE) ;;
-	      *)
-		lt_outputfile="$lt_outputfile.exe"
-		lt_tool_outputfile="$lt_tool_outputfile.exe"
-		;;
-	    esac~
-	    func_to_tool_file "$lt_outputfile"~
-	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	      $RM "$lt_outputfile.manifest";
-	    fi'
-	  ;;
-	*)
-	  # g++
-	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-	  # as there is no search path for DLLs.
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-	  _LT_TAGVAR(always_export_symbols, $1)=no
-	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	    # If the export-symbols file already is a .def file (1st line
-	    # is EXPORTS), use it as is; otherwise, prepend...
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      cp $export_symbols $output_objdir/$soname.def;
-	    else
-	      echo EXPORTS > $output_objdir/$soname.def;
-	      cat $export_symbols >> $output_objdir/$soname.def;
-	    fi~
-	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	  else
-	    _LT_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	  ;;
-	esac
-	;;
+        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+        # as there is no search path for DLLs.
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+        _LT_TAGVAR(always_export_symbols, $1)=no
+        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          # If the export-symbols file already is a .def file (1st line
+          # is EXPORTS), use it as is; otherwise, prepend...
+          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    cp $export_symbols $output_objdir/$soname.def;
+          else
+	    echo EXPORTS > $output_objdir/$soname.def;
+	    cat $export_symbols >> $output_objdir/$soname.def;
+          fi~
+          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        else
+          _LT_TAGVAR(ld_shlibs, $1)=no
+        fi
+        ;;
       darwin* | rhapsody*)
         _LT_DARWIN_LINKER_FEATURES($1)
 	;;
@@ -6220,7 +5669,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         esac
         ;;
 
-      freebsd2.*)
+      freebsd[[12]]*)
         # C++ shared libraries reported to be fairly broken before
 	# switch to ELF
         _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6239,11 +5688,6 @@ if test "$_lt_caught_CXX_error" != yes; then
       gnu*)
         ;;
 
-      haiku*)
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(link_all_deplibs, $1)=yes
-        ;;
-
       hpux9*)
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -6268,11 +5712,11 @@ if test "$_lt_caught_CXX_error" != yes; then
             # explicitly linking system object files so we need to strip them
             # from the output so that they don't get included in the library
             # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
             ;;
           *)
             if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
             else
               # FIXME: insert proper C++ library support
               _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6333,7 +5777,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 	    ;;
           *)
 	    if test "$GXX" = yes; then
@@ -6343,10 +5787,10 @@ if test "$_lt_caught_CXX_error" != yes; then
 	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          ia64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          *)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	        esac
 	      fi
@@ -6376,7 +5820,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         case $cc_basename in
           CC*)
 	    # SGI C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
@@ -6387,9 +5831,9 @@ if test "$_lt_caught_CXX_error" != yes; then
           *)
 	    if test "$GXX" = yes; then
 	      if test "$with_gnu_ld" = no; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	      else
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
 	      fi
 	    fi
 	    _LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -6400,7 +5844,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(inherit_rpath, $1)=yes
         ;;
 
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu)
         case $cc_basename in
           KCC*)
 	    # Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -6418,7 +5862,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -6455,26 +5899,26 @@ if test "$_lt_caught_CXX_error" != yes; then
           pgCC* | pgcpp*)
             # Portland Group C++ compiler
 	    case `$CC -V` in
-	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+	    *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
 	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
 	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
 		$RANLIB $oldlib'
 	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
 		rm -rf $tpldir~
 		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
-	    *) # Version 6 and above use weak symbols
+	    *) # Version 6 will use weak symbols
 	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
 	      ;;
@@ -6482,7 +5926,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
             ;;
 	  cxx*)
 	    # Compaq C++
@@ -6501,9 +5945,9 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 	    ;;
-	  xl* | mpixl* | bgxl*)
+	  xl*)
 	    # IBM XL 8.0 on PPC, with GNU ld
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -6523,13 +5967,13 @@ if test "$_lt_caught_CXX_error" != yes; then
 	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
 	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	      _LT_TAGVAR(compiler_needs_object, $1)=yes
 
 	      # Not sure whether something based on
 	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
 	      # would be better.
-	      output_verbose_link_cmd='func_echo_all'
+	      output_verbose_link_cmd='echo'
 
 	      # Archives containing C++ object files must be created using
 	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6598,7 +6042,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
 	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
 	  fi
-	  output_verbose_link_cmd=func_echo_all
+	  output_verbose_link_cmd=echo
 	else
 	  _LT_TAGVAR(ld_shlibs, $1)=no
 	fi
@@ -6633,15 +6077,15 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    case $host in
 	      osf3*)
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
 		;;
 	      *)
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
 	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
 	          $RM $lib.exp'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
 		;;
@@ -6657,17 +6101,17 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
 	    ;;
 	  *)
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
 	      case $host in
 	        osf3*)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	        *)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 		  ;;
 	      esac
 
@@ -6677,7 +6121,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	      # Commands to make compiler produce verbose output that lists
 	      # what "hidden" libraries, object files and flags are used when
 	      # linking a shared library.
-	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 
 	    else
 	      # FIXME: insert proper C++ library support
@@ -6713,7 +6157,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
       solaris*)
         case $cc_basename in
-          CC* | sunCC*)
+          CC*)
 	    # Sun C++ 4.2, 5.x and Centerline C++
             _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
 	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
@@ -6734,7 +6178,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    esac
 	    _LT_TAGVAR(link_all_deplibs, $1)=yes
 
-	    output_verbose_link_cmd='func_echo_all'
+	    output_verbose_link_cmd='echo'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6754,14 +6198,14 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
 	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
 	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 	      else
 	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
 	        # platform.
@@ -6772,7 +6216,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
-	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
 	      fi
 
 	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
@@ -6826,10 +6270,6 @@ if test "$_lt_caught_CXX_error" != yes; then
           CC*)
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
-	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
-	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
-	      '"$_LT_TAGVAR(reload_cmds, $1)"
 	    ;;
 	  *)
 	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
@@ -6885,7 +6325,6 @@ if test "$_lt_caught_CXX_error" != yes; then
   fi # test -n "$compiler"
 
   CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
   LDCXX=$LD
   LD=$lt_save_LD
   GCC=$lt_save_GCC
@@ -6900,29 +6339,6 @@ AC_LANG_POP
 ])# _LT_LANG_CXX_CONFIG
 
 
-# _LT_FUNC_STRIPNAME_CNF
-# ----------------------
-# func_stripname_cnf prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-#
-# This function is identical to the (non-XSI) version of func_stripname,
-# except this one can be used by m4 code that may be executed by configure,
-# rather than the libtool script.
-m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
-AC_REQUIRE([_LT_DECL_SED])
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
-func_stripname_cnf ()
-{
-  case ${2} in
-  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-  esac
-} # func_stripname_cnf
-])# _LT_FUNC_STRIPNAME_CNF
-
 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
 # ---------------------------------
 # Figure out "hidden" library dependencies from verbose
@@ -6931,7 +6347,6 @@ func_stripname_cnf ()
 # objects, libraries and library flags.
 m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
 # Dependencies to place before and after the object being linked:
 _LT_TAGVAR(predep_objects, $1)=
 _LT_TAGVAR(postdep_objects, $1)=
@@ -6981,20 +6396,7 @@ public class foo {
   }
 };
 _LT_EOF
-], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
-package foo
-func foo() {
-}
-_LT_EOF
 ])
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
-esac
-
 dnl Parse the compiler output and extract the necessary
 dnl objects, libraries and library flags.
 if AC_TRY_EVAL(ac_compile); then
@@ -7006,7 +6408,7 @@ if AC_TRY_EVAL(ac_compile); then
   pre_test_object_deps_done=no
 
   for p in `eval "$output_verbose_link_cmd"`; do
-    case ${prev}${p} in
+    case $p in
 
     -L* | -R* | -l*)
        # Some compilers place space between "-{L,R}" and the path.
@@ -7015,22 +6417,13 @@ if AC_TRY_EVAL(ac_compile); then
           test $p = "-R"; then
 	 prev=$p
 	 continue
+       else
+	 prev=
        fi
 
-       # Expand the sysroot to ease extracting the directories later.
-       if test -z "$prev"; then
-         case $p in
-         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
-         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
-         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
-         esac
-       fi
-       case $p in
-       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
-       esac
        if test "$pre_test_object_deps_done" = no; then
-	 case ${prev} in
-	 -L | -R)
+	 case $p in
+	 -L* | -R*)
 	   # Internal compiler library paths should come after those
 	   # provided the user.  The postdeps already come after the
 	   # user supplied libs so there is no need to process them.
@@ -7050,10 +6443,8 @@ if AC_TRY_EVAL(ac_compile); then
 	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
 	 fi
        fi
-       prev=
        ;;
 
-    *.lto.$objext) ;; # Ignore GCC LTO objects
     *.$objext)
        # This assumes that the test object file only shows up
        # once in the compiler output.
@@ -7089,7 +6480,6 @@ else
 fi
 
 $RM -f confest.$objext
-CFLAGS=$_lt_libdeps_save_CFLAGS
 
 # PORTME: override above test on systems where it is broken
 m4_if([$1], [CXX],
@@ -7126,7 +6516,7 @@ linux*)
 
 solaris*)
   case $cc_basename in
-  CC* | sunCC*)
+  CC*)
     # The more standards-conforming stlport4 library is
     # incompatible with the Cstd library. Avoid specifying
     # it if it's in CXXFLAGS. Ignore libCrun as
@@ -7170,16 +6560,32 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1],
 ])# _LT_SYS_HIDDEN_LIBDEPS
 
 
+# _LT_PROG_F77
+# ------------
+# Since AC_PROG_F77 is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_F77],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
+AC_PROG_F77
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_F77
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_F77], [])
+
+
 # _LT_LANG_F77_CONFIG([TAG])
 # --------------------------
 # Ensure that the configuration variables for a Fortran 77 compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_F77_CONFIG],
-[AC_LANG_PUSH(Fortran 77)
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
+[AC_REQUIRE([_LT_PROG_F77])dnl
+AC_LANG_PUSH(Fortran 77)
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -7189,6 +6595,7 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7197,8 +6604,6 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -7238,9 +6643,7 @@ if test "$_lt_disable_F77" != yes; then
   # Allow CC to be a program name with arguments.
   lt_save_CC="$CC"
   lt_save_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
   CC=${F77-"f77"}
-  CFLAGS=$FFLAGS
   compiler=$CC
   _LT_TAGVAR(compiler, $1)=$CC
   _LT_CC_BASENAME([$compiler])
@@ -7294,24 +6697,38 @@ if test "$_lt_disable_F77" != yes; then
 
   GCC=$lt_save_GCC
   CC="$lt_save_CC"
-  CFLAGS="$lt_save_CFLAGS"
 fi # test "$_lt_disable_F77" != yes
 
 AC_LANG_POP
 ])# _LT_LANG_F77_CONFIG
 
 
+# _LT_PROG_FC
+# -----------
+# Since AC_PROG_FC is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_FC],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
+AC_PROG_FC
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_FC
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_FC], [])
+
+
 # _LT_LANG_FC_CONFIG([TAG])
 # -------------------------
 # Ensure that the configuration variables for a Fortran compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_FC_CONFIG],
-[AC_LANG_PUSH(Fortran)
-
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
+[AC_REQUIRE([_LT_PROG_FC])dnl
+AC_LANG_PUSH(Fortran)
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -7321,6 +6738,7 @@ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
 _LT_TAGVAR(hardcode_direct, $1)=no
 _LT_TAGVAR(hardcode_direct_absolute, $1)=no
 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
 _LT_TAGVAR(hardcode_libdir_separator, $1)=
 _LT_TAGVAR(hardcode_minus_L, $1)=no
 _LT_TAGVAR(hardcode_automatic, $1)=no
@@ -7329,8 +6747,6 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -7370,9 +6786,7 @@ if test "$_lt_disable_FC" != yes; then
   # Allow CC to be a program name with arguments.
   lt_save_CC="$CC"
   lt_save_GCC=$GCC
-  lt_save_CFLAGS=$CFLAGS
   CC=${FC-"f95"}
-  CFLAGS=$FCFLAGS
   compiler=$CC
   GCC=$ac_cv_fc_compiler_gnu
 
@@ -7428,8 +6842,7 @@ if test "$_lt_disable_FC" != yes; then
   fi # test -n "$compiler"
 
   GCC=$lt_save_GCC
-  CC=$lt_save_CC
-  CFLAGS=$lt_save_CFLAGS
+  CC="$lt_save_CC"
 fi # test "$_lt_disable_FC" != yes
 
 AC_LANG_POP
@@ -7466,12 +6879,10 @@ _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
+lt_save_CC="$CC"
 lt_save_GCC=$GCC
 GCC=yes
 CC=${GCJ-"gcj"}
-CFLAGS=$GCJFLAGS
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
 _LT_TAGVAR(LD, $1)="$LD"
@@ -7481,9 +6892,11 @@ _LT_CC_BASENAME([$compiler])
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
 if test -n "$compiler"; then
   _LT_COMPILER_NO_RTTI($1)
   _LT_COMPILER_PIC($1)
@@ -7498,32 +6911,31 @@ fi
 AC_LANG_RESTORE
 
 GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
+CC="$lt_save_CC"
 ])# _LT_LANG_GCJ_CONFIG
 
 
-# _LT_LANG_GO_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Go compiler
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
 # are suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GO_CONFIG],
-[AC_REQUIRE([LT_PROG_GO])dnl
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
 AC_LANG_SAVE
 
-# Source file extension for Go test sources.
-ac_ext=go
+# Source file extension for RC test sources.
+ac_ext=rc
 
-# Object file extension for compiled Go test sources.
+# Object file extension for compiled RC test sources.
 objext=o
 _LT_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="package main; func main() { }"
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='package main; func main() { }'
+lt_simple_link_test_code="$lt_simple_compile_test_code"
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_TAG_COMPILER
@@ -7533,94 +6945,24 @@ _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
+lt_save_CC="$CC"
 lt_save_GCC=$GCC
-GCC=yes
-CC=${GOC-"gccgo"}
-CFLAGS=$GOFLAGS
+GCC=
+CC=${RC-"windres"}
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
 _LT_CC_BASENAME([$compiler])
-
-# Go did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
 
 if test -n "$compiler"; then
-  _LT_COMPILER_NO_RTTI($1)
-  _LT_COMPILER_PIC($1)
-  _LT_COMPILER_C_O($1)
-  _LT_COMPILER_FILE_LOCKS($1)
-  _LT_LINKER_SHLIBS($1)
-  _LT_LINKER_HARDCODE_LIBPATH($1)
-
+  :
   _LT_CONFIG($1)
 fi
 
-AC_LANG_RESTORE
-
 GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GO_CONFIG
-
-
-# _LT_LANG_RC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for the Windows resource compiler
-# are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_RC_CONFIG],
-[AC_REQUIRE([LT_PROG_RC])dnl
-AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=
-CC=${RC-"windres"}
-CFLAGS=
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-if test -n "$compiler"; then
-  :
-  _LT_CONFIG($1)
-fi
-
-GCC=$lt_save_GCC
-AC_LANG_RESTORE
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_RC_CONFIG
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# _LT_LANG_RC_CONFIG
 
 
 # LT_PROG_GCJ
@@ -7639,13 +6981,6 @@ dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
 
 
-# LT_PROG_GO
-# ----------
-AC_DEFUN([LT_PROG_GO],
-[AC_CHECK_TOOL(GOC, gccgo,)
-])
-
-
 # LT_PROG_RC
 # ----------
 AC_DEFUN([LT_PROG_RC],
@@ -7685,15 +7020,6 @@ _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
 AC_SUBST([OBJDUMP])
 ])
 
-# _LT_DECL_DLLTOOL
-# ----------------
-# Ensure DLLTOOL variable is set.
-m4_defun([_LT_DECL_DLLTOOL],
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
-AC_SUBST([DLLTOOL])
-])
 
 # _LT_DECL_SED
 # ------------
@@ -7709,10 +7035,12 @@ _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
 ])# _LT_DECL_SED
 
 m4_ifndef([AC_PROG_SED], [
+############################################################
 # NOTE: This macro has been submitted for inclusion into   #
 #  GNU Autoconf as AC_PROG_SED.  When it is available in   #
 #  a released version of Autoconf we should remove this    #
 #  macro and use it instead.                               #
+############################################################
 
 m4_defun([AC_PROG_SED],
 [AC_MSG_CHECKING([for a sed that does not truncate output])
@@ -7785,8 +7113,8 @@ m4_defun([_LT_CHECK_SHELL_FEATURES],
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -7825,1739 +7153,208 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
 ])# _LT_CHECK_SHELL_FEATURES
 
 
-# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
-# ------------------------------------------------------
-# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
-# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
-m4_defun([_LT_PROG_FUNCTION_REPLACE],
-[dnl {
-sed -e '/^$1 ()$/,/^} # $1 /c\
-$1 ()\
-{\
-m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
-} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-])
-
-
-# _LT_PROG_REPLACE_SHELLFNS
-# -------------------------
-# Replace existing portable implementations of several shell functions with
-# equivalent extended shell implementations where those features are available..
-m4_defun([_LT_PROG_REPLACE_SHELLFNS],
-[if test x"$xsi_shell" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
-    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-    # positional parameters, so assign one to ordinary parameter first.
-    func_stripname_result=${3}
-    func_stripname_result=${func_stripname_result#"${1}"}
-    func_stripname_result=${func_stripname_result%"${2}"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
-    func_split_long_opt_name=${1%%=*}
-    func_split_long_opt_arg=${1#*=}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
-    func_split_short_opt_arg=${1#??}
-    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
-    case ${1} in
-      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-      *)    func_lo2o_result=${1} ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
-
-  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
-
-  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
-    func_quote_for_eval "${2}"
-dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
-    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
-fi
-])
-
-# _LT_PATH_CONVERSION_FUNCTIONS
-# -----------------------------
-# Determine which file name conversion functions should be used by
-# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
-# for certain cross-compile configurations and native mingw.
-m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_MSG_CHECKING([how to convert $build file names to $host format])
-AC_CACHE_VAL(lt_cv_to_host_file_cmd,
-[case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
-        ;;
-    esac
-    ;;
-  *-*-cygwin* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_noop
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
-        ;;
-    esac
-    ;;
-  * ) # unhandled hosts (and "normal" native builds)
-    lt_cv_to_host_file_cmd=func_convert_file_noop
-    ;;
-esac
-])
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
-_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
-         [0], [convert $build file names to $host format])dnl
-
-AC_MSG_CHECKING([how to convert $build file names to toolchain format])
-AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
-[#assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
-        ;;
-    esac
-    ;;
-esac
-])
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
-_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
-         [0], [convert $build files to toolchain format])dnl
-])# _LT_PATH_CONVERSION_FUNCTIONS
-
-# Helper functions for option handling.                    -*- Autoconf -*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-#   Inc.
-#   Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 7 ltoptions.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
-
-
-# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
-# ------------------------------------------
-m4_define([_LT_MANGLE_OPTION],
-[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
-
-
-# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
-# ---------------------------------------
-# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
-# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
-# saved as a flag.
-m4_define([_LT_SET_OPTION],
-[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
-m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
-        _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
-])
-
-
-# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
-# ------------------------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-m4_define([_LT_IF_OPTION],
-[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
-
-
-# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
-# -------------------------------------------------------
-# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
-# are set.
-m4_define([_LT_UNLESS_OPTIONS],
-[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
-		      [m4_define([$0_found])])])[]dnl
-m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
-])[]dnl
-])
-
-
-# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
-# ----------------------------------------
-# OPTION-LIST is a space-separated list of Libtool options associated
-# with MACRO-NAME.  If any OPTION has a matching handler declared with
-# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
-# the unknown option and exit.
-m4_defun([_LT_SET_OPTIONS],
-[# Set options
-m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
-    [_LT_SET_OPTION([$1], _LT_Option)])
-
-m4_if([$1],[LT_INIT],[
-  dnl
-  dnl Simply set some default values (i.e off) if boolean options were not
-  dnl specified:
-  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
-  ])
-  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
-  ])
-  dnl
-  dnl If no reference was made to various pairs of opposing options, then
-  dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
-  dnl archives by default:
-  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
-  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
-  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-  		   [_LT_ENABLE_FAST_INSTALL])
-  ])
-])# _LT_SET_OPTIONS
-
-
-
-# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
-# -----------------------------------------
-m4_define([_LT_MANGLE_DEFUN],
-[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
-
-
-# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
-# -----------------------------------------------
-m4_define([LT_OPTION_DEFINE],
-[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
-])# LT_OPTION_DEFINE
-
-
-# dlopen
-# ------
-LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
-])
-
-AU_DEFUN([AC_LIBTOOL_DLOPEN],
-[_LT_SET_OPTION([LT_INIT], [dlopen])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
-
-
-# win32-dll
-# ---------
-# Declare package support for building win32 dll's.
-LT_OPTION_DEFINE([LT_INIT], [win32-dll],
-[enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-esac
-
-test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [1], [Assembler program])dnl
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
-])# win32-dll
-
-AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-_LT_SET_OPTION([LT_INIT], [win32-dll])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
-
-
-# _LT_ENABLE_SHARED([DEFAULT])
-# ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_SHARED],
-[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([shared],
-    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
-	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
-
-    _LT_DECL([build_libtool_libs], [enable_shared], [0],
-	[Whether or not to build shared libraries])
-])# _LT_ENABLE_SHARED
-
-LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
-])
-
-AC_DEFUN([AC_DISABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], [disable-shared])
-])
-
-AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_SHARED], [])
-dnl AC_DEFUN([AM_DISABLE_SHARED], [])
-
-
-
-# _LT_ENABLE_STATIC([DEFAULT])
-# ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_STATIC],
-[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([static],
-    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
-	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
-
-    _LT_DECL([build_old_libs], [enable_static], [0],
-	[Whether or not to build static libraries])
-])# _LT_ENABLE_STATIC
-
-LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
-])
-
-AC_DEFUN([AC_DISABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], [disable-static])
-])
-
-AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_STATIC], [])
-dnl AC_DEFUN([AM_DISABLE_STATIC], [])
-
-
-
-# _LT_ENABLE_FAST_INSTALL([DEFAULT])
-# ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_FAST_INSTALL],
-[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([fast-install],
-    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
-    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
-
-_LT_DECL([fast_install], [enable_fast_install], [0],
-	 [Whether or not to optimize for fast installation])dnl
-])# _LT_ENABLE_FAST_INSTALL
-
-LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
-
-# Old names:
-AU_DEFUN([AC_ENABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
-])
-
-AU_DEFUN([AC_DISABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
-dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
-
-
-# _LT_WITH_PIC([MODE])
-# --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
-# LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
-m4_define([_LT_WITH_PIC],
-[AC_ARG_WITH([pic],
-    [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
-	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [lt_p=${PACKAGE-default}
-    case $withval in
-    yes|no) pic_mode=$withval ;;
-    *)
-      pic_mode=default
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
-	if test "X$lt_pkg" = "X$lt_p"; then
-	  pic_mode=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
-
-_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
-])# _LT_WITH_PIC
-
-LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
-
-# Old name:
-AU_DEFUN([AC_LIBTOOL_PICMODE],
-[_LT_SET_OPTION([LT_INIT], [pic-only])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
-
-
-m4_define([_LTDL_MODE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
-		 [m4_define([_LTDL_MODE], [nonrecursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [recursive],
-		 [m4_define([_LTDL_MODE], [recursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [subproject],
-		 [m4_define([_LTDL_MODE], [subproject])])
-
-m4_define([_LTDL_TYPE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [installable],
-		 [m4_define([_LTDL_TYPE], [installable])])
-LT_OPTION_DEFINE([LTDL_INIT], [convenience],
-		 [m4_define([_LTDL_TYPE], [convenience])])
-
-# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
-#
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-# Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 6 ltsugar.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
-
-
-# lt_join(SEP, ARG1, [ARG2...])
-# -----------------------------
-# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
-# associated separator.
-# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
-# versions in m4sugar had bugs.
-m4_define([lt_join],
-[m4_if([$#], [1], [],
-       [$#], [2], [[$2]],
-       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
-m4_define([_lt_join],
-[m4_if([$#$2], [2], [],
-       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
-
-
-# lt_car(LIST)
-# lt_cdr(LIST)
-# ------------
-# Manipulate m4 lists.
-# These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
-m4_define([lt_car], [[$1]])
-m4_define([lt_cdr],
-[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
-       [$#], 1, [],
-       [m4_dquote(m4_shift($@))])])
-m4_define([lt_unquote], $1)
-
-
-# lt_append(MACRO-NAME, STRING, [SEPARATOR])
-# ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
-# Note that neither SEPARATOR nor STRING are expanded; they are appended
-# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
-# No SEPARATOR is output if MACRO-NAME was previously undefined (different
-# than defined and empty).
-#
-# This macro is needed until we can rely on Autoconf 2.62, since earlier
-# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
-m4_define([lt_append],
-[m4_define([$1],
-	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
-
-
-
-# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
-# ----------------------------------------------------------
-# Produce a SEP delimited list of all paired combinations of elements of
-# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
-# has the form PREFIXmINFIXSUFFIXn.
-# Needed until we can rely on m4_combine added in Autoconf 2.62.
-m4_define([lt_combine],
-[m4_if(m4_eval([$# > 3]), [1],
-       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
-[[m4_foreach([_Lt_prefix], [$2],
-	     [m4_foreach([_Lt_suffix],
-		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
-	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
-
-
-# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
-# -----------------------------------------------------------------------
-# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
-# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
-m4_define([lt_if_append_uniq],
-[m4_ifdef([$1],
-	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
-		 [lt_append([$1], [$2], [$3])$4],
-		 [$5])],
-	  [lt_append([$1], [$2], [$3])$4])])
-
-
-# lt_dict_add(DICT, KEY, VALUE)
-# -----------------------------
-m4_define([lt_dict_add],
-[m4_define([$1($2)], [$3])])
-
-
-# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
-# --------------------------------------------
-m4_define([lt_dict_add_subkey],
-[m4_define([$1($2:$3)], [$4])])
-
-
-# lt_dict_fetch(DICT, KEY, [SUBKEY])
-# ----------------------------------
-m4_define([lt_dict_fetch],
-[m4_ifval([$3],
-	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
-    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
-
-
-# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
-# -----------------------------------------------------------------
-m4_define([lt_if_dict_fetch],
-[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
-	[$5],
-    [$6])])
-
-
-# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
-# --------------------------------------------------------------
-m4_define([lt_dict_filter],
-[m4_if([$5], [], [],
-  [lt_join(m4_quote(m4_default([$4], [[, ]])),
-           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
-		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
-])
-
-# ltversion.m4 -- version numbers			-*- Autoconf -*-
-#
-#   Copyright (C) 2004 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# @configure_input@
-
-# serial 3337 ltversion.m4
-# This file is part of GNU Libtool
-
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
-
-AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
-_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
-_LT_DECL(, macro_revision, 0)
-])
-
-# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
-#
-#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
-#   Written by Scott James Remnant, 2004.
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 5 lt~obsolete.m4
-
-# These exist entirely to fool aclocal when bootstrapping libtool.
-#
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
-# which have later been changed to m4_define as they aren't part of the
-# exported API, or moved to Autoconf or Automake where they belong.
-#
-# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
-# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
-# using a macro with the same name in our local m4/libtool.m4 it'll
-# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
-# and doesn't know about Autoconf macros at all.)
-#
-# So we provide this file, which has a silly filename so it's always
-# included after everything else.  This provides aclocal with the
-# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
-# because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
-#
-# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
-# Yes, that means every name once taken will need to remain here until
-# we give up compatibility with versions before 1.7, at which point
-# we need to keep only those names which we still refer to.
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
-
-m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
-m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
-m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
-m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
-m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
-m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
-m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
-m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
-m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
-m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
-m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
-m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
-m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
-m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
-m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
-m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
-m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
-m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
-m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
-m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
-m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
-m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
-m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
-m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
-m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
-m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
-m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
-m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
-m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
-m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
-m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
-m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
-m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
-m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
-m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
-m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
-m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
-m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
-m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
-m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
-m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
-m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
-m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
-m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
-m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
-m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
-m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
-m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
-m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
-m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
-
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_AUTOMAKE_VERSION(VERSION)
-# ----------------------------
-# Automake X.Y traces this macro to ensure aclocal.m4 has been
-# generated from the m4 files accompanying Automake X.Y.
-# (This private macro should not be called outside this file.)
-AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
-dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
-dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.3], [],
-      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
-])
-
-# _AM_AUTOCONF_VERSION(VERSION)
-# -----------------------------
-# aclocal traces this macro to find the Autoconf version.
-# This is a private macro too.  Using m4_define simplifies
-# the logic in aclocal, which can simply ignore this definition.
-m4_define([_AM_AUTOCONF_VERSION], [])
-
-# AM_SET_CURRENT_AUTOMAKE_VERSION
-# -------------------------------
-# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
-# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
-AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.3])dnl
-m4_ifndef([AC_AUTOCONF_VERSION],
-  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
-
-# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
-
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
-#
-# Of course, Automake must honor this variable whenever it calls a
-# tool from the auxiliary directory.  The problem is that $srcdir (and
-# therefore $ac_aux_dir as well) can be either absolute or relative,
-# depending on how configure is run.  This is pretty annoying, since
-# it makes $ac_aux_dir quite unusable in subdirectories: in the top
-# source directory, any form will work fine, but in subdirectories a
-# relative path needs to be adjusted first.
-#
-# $ac_aux_dir/missing
-#    fails when called from a subdirectory if $ac_aux_dir is relative
-# $top_srcdir/$ac_aux_dir/missing
-#    fails if $ac_aux_dir is absolute,
-#    fails when called from a subdirectory in a VPATH build with
-#          a relative $ac_aux_dir
-#
-# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
-# are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
-# start a VPATH build or use an absolute $srcdir.
-#
-# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
-# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
-#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
-# and then we would define $MISSING as
-#   MISSING="\${SHELL} $am_aux_dir/missing"
-# This will work as long as MISSING is not called from configure, because
-# unfortunately $(top_srcdir) has no meaning in configure.
-# However there are other variables, like CC, which are often used in
-# configure, and could therefore not use this "fixed" $ac_aux_dir.
-#
-# Another solution, used here, is to always expand $ac_aux_dir to an
-# absolute PATH.  The drawback is that using absolute paths prevent a
-# configured tree to be moved without reconfiguration.
-
-AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-])
-
-# AM_CONDITIONAL                                            -*- Autoconf -*-
-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 9
-
-# AM_CONDITIONAL(NAME, SHELL-CONDITION)
-# -------------------------------------
-# Define a conditional.
-AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
-AC_SUBST([$1_TRUE])dnl
-AC_SUBST([$1_FALSE])dnl
-_AM_SUBST_NOTMAKE([$1_TRUE])dnl
-_AM_SUBST_NOTMAKE([$1_FALSE])dnl
-m4_define([_AM_COND_VALUE_$1], [$2])dnl
-if $2; then
-  $1_TRUE=
-  $1_FALSE='#'
-else
-  $1_TRUE='#'
-  $1_FALSE=
-fi
-AC_CONFIG_COMMANDS_PRE(
-[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
-  AC_MSG_ERROR([[conditional "$1" was never defined.
-Usually this means the macro was only invoked conditionally.]])
-fi])])
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
-# 2010, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 12
-
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
-# written in clear, in which case automake, when reading aclocal.m4,
-# will think it sees a *use*, and therefore will trigger all it's
-# C support machinery.  Also note that it means that autoscan, seeing
-# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
-
-
-# _AM_DEPENDENCIES(NAME)
-# ----------------------
-# See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
-# We try a few techniques and use that to set a single cache variable.
-#
-# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
-# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
-# dependency, and given that the user is not expected to run this macro,
-# just rely on AC_PROG_CC.
-AC_DEFUN([_AM_DEPENDENCIES],
-[AC_REQUIRE([AM_SET_DEPDIR])dnl
-AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
-AC_REQUIRE([AM_MAKE_INCLUDE])dnl
-AC_REQUIRE([AM_DEP_TRACK])dnl
-
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
-
-AC_CACHE_CHECK([dependency style of $depcc],
-               [am_cv_$1_dependencies_compiler_type],
-[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_$1_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
-  fi
-  am__universal=false
-  m4_case([$1], [CC],
-    [case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac],
-    [CXX],
-    [case " $depcc " in #(
-     *\ -arch\ *\ -arch\ *) am__universal=true ;;
-     esac])
-
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.  Also, some Intel
-    # versions had trouble with output in subdirs
-    am__obj=sub/conftest.${OBJEXT-o}
-    am__minus_obj="-o $am__obj"
-    case $depmode in
-    gcc)
-      # This depmode causes a compiler race in universal mode.
-      test "$am__universal" = false || continue
-      ;;
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-	continue
-      else
-	break
-      fi
-      ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
-      # This compiler won't grok `-c -o', but also, the minuso test has
-      # not run yet.  These depmodes are late enough in the game, and
-      # so weak that their functioning should not be impacted.
-      am__obj=conftest.${OBJEXT-o}
-      am__minus_obj=
-      ;;
-    none) break ;;
-    esac
-    if depmode=$depmode \
-       source=sub/conftest.c object=$am__obj \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_$1_dependencies_compiler_type=$depmode
-        break
-      fi
-    fi
-  done
-
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_$1_dependencies_compiler_type=none
-fi
-])
-AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
-AM_CONDITIONAL([am__fastdep$1], [
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
-])
-
-
-# AM_SET_DEPDIR
-# -------------
-# Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
-AC_DEFUN([AM_SET_DEPDIR],
-[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
-])
-
-
-# AM_DEP_TRACK
-# ------------
-AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-  am__nodep='_no'
-fi
-AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
-AC_SUBST([AMDEPBACKSLASH])dnl
-_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
-AC_SUBST([am__nodep])dnl
-_AM_SUBST_NOTMAKE([am__nodep])dnl
-])
-
-# Generate code to set up dependency tracking.              -*- Autoconf -*-
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-#serial 5
-
-# _AM_OUTPUT_DEPENDENCY_COMMANDS
-# ------------------------------
-AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
-[{
-  # Autoconf 2.62 quotes --file arguments for eval, but not when files
-  # are listed without --file.  Let's play safe and only enable the eval
-  # if we detect the quoting.
-  case $CONFIG_FILES in
-  *\'*) eval set x "$CONFIG_FILES" ;;
-  *)   set x $CONFIG_FILES ;;
+# _LT_PROG_XSI_SHELLFNS
+# ---------------------
+# Bourne and XSI compatible variants of some useful shell functions.
+m4_defun([_LT_PROG_XSI_SHELLFNS],
+[case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
   esac
-  shift
-  for mf
-  do
-    # Strip MF so we end up with the name of the file.
-    mf=`echo "$mf" | sed -e 's/:.*$//'`
-    # Check whether this is an Automake generated Makefile or not.
-    # We used to match only the files named `Makefile.in', but
-    # some people rename them; so instead we look at the file content.
-    # Grep'ing the first line is not enough: some people post-process
-    # each Makefile.in and add a new line on top of each file to say so.
-    # Grep'ing the whole file is not good either: AIX grep has a line
-    # limit of 2048, but all sed's we know have understand at least 4000.
-    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-      dirpart=`AS_DIRNAME("$mf")`
-    else
-      continue
-    fi
-    # Extract the definition of DEPDIR, am__include, and am__quote
-    # from the Makefile without running `make'.
-    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-    test -z "$DEPDIR" && continue
-    am__include=`sed -n 's/^am__include = //p' < "$mf"`
-    test -z "am__include" && continue
-    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
-    # Find all dependency output files, they are included files with
-    # $(DEPDIR) in their names.  We invoke sed twice because it is the
-    # simplest approach to changing $(DEPDIR) to its actual value in the
-    # expansion.
-    for file in `sed -n "
-      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-      # Make sure the directory exists.
-      test -f "$dirpart/$file" && continue
-      fdir=`AS_DIRNAME(["$file"])`
-      AS_MKDIR_P([$dirpart/$fdir])
-      # echo "creating $dirpart/$file"
-      echo '# dummy' > "$dirpart/$file"
-    done
-  done
 }
-])# _AM_OUTPUT_DEPENDENCY_COMMANDS
-
-
-# AM_OUTPUT_DEPENDENCY_COMMANDS
-# -----------------------------
-# This macro should only be invoked once -- use via AC_REQUIRE.
-#
-# This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each `.P' file that we will
-# need in order to bootstrap the dependency handling code.
-AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
-[AC_CONFIG_COMMANDS([depfiles],
-     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
-     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
 
-# Do all the work for Automake.                             -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 16
-
-# This macro actually does too much.  Some checks are only needed if
-# your package does certain things.  But this isn't really a big deal.
-
-# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
-# AM_INIT_AUTOMAKE([OPTIONS])
-# -----------------------------------------------
-# The call with PACKAGE and VERSION arguments is the old style
-# call (pre autoconf-2.50), which is being phased out.  PACKAGE
-# and VERSION should now be passed to AC_INIT and removed from
-# the call to AM_INIT_AUTOMAKE.
-# We support both call styles for the transition.  After
-# the next Automake release, Autoconf can make the AC_INIT
-# arguments mandatory, and then we can depend on a new Autoconf
-# release and drop the old call support.
-AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
-dnl Autoconf wants to disallow AM_ names.  We explicitly allow
-dnl the ones we care about.
-m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
-AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
-AC_REQUIRE([AC_PROG_INSTALL])dnl
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
-  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
-  # is not polluted with repeated "-I."
-  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
-  # test to see if srcdir already configured
-  if test -f $srcdir/config.status; then
-    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-  fi
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
-  if (cygpath --version) >/dev/null 2>/dev/null; then
-    CYGPATH_W='cygpath -w'
-  else
-    CYGPATH_W=echo
-  fi
-fi
-AC_SUBST([CYGPATH_W])
-
-# Define the identity of the package.
-dnl Distinguish between old-style and new-style calls.
-m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
- AC_SUBST([PACKAGE], [$1])dnl
- AC_SUBST([VERSION], [$2])],
-[_AM_SET_OPTIONS([$1])dnl
-dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
-  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
-
-_AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
-
-# Some tools Automake needs.
-AC_REQUIRE([AM_SANITY_CHECK])dnl
-AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
-AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([AC_PROG_MAKE_SET])dnl
-AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
-	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
-			     [_AM_PROG_TAR([v7])])])
-_AM_IF_OPTION([no-dependencies],,
-[AC_PROVIDE_IFELSE([AC_PROG_CC],
-		  [_AM_DEPENDENCIES(CC)],
-		  [define([AC_PROG_CC],
-			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_CXX],
-		  [_AM_DEPENDENCIES(CXX)],
-		  [define([AC_PROG_CXX],
-			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-		  [_AM_DEPENDENCIES(OBJC)],
-		  [define([AC_PROG_OBJC],
-			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
-])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
-AC_CONFIG_COMMANDS_PRE(dnl
-[m4_provide_if([_AM_COMPILER_EXEEXT],
-  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
-])
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
 
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
-dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
-dnl mangled by Autoconf and run in a shell conditional statement.
-m4_define([_AC_COMPILER_EXEEXT],
-m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
-
-
-# When config.status generates a header, we must update the stamp-h file.
-# This file resides in the same directory as the config header
-# that is generated.  The stamp files are numbered to have different names.
-
-# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
-# loop where config.status creates the headers, so we can generate
-# our stamp files there.
-AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
-[# Compute $1's index in $config_headers.
-_am_arg=$1
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $_am_arg | $_am_arg:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
   esac
-done
-echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+  func_basename_result="${1##*/}"
+}
 
-# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
 
-# serial 1
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=${1%%=*}
+  func_opt_split_arg=${1#*=}
+}
 
-# AM_PROG_INSTALL_SH
-# ------------------
-# Define $install_sh.
-AC_DEFUN([AM_PROG_INSTALL_SH],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
-  *)
-    install_sh="\${SHELL} $am_aux_dir/install-sh"
+# func_lo2o object
+func_lo2o ()
+{
+  case ${1} in
+    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+    *)    func_lo2o_result=${1} ;;
   esac
-fi
-AC_SUBST(install_sh)])
-
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# Check whether the underlying file-system supports filenames
-# with a leading dot.  For instance MS-DOS doesn't.
-AC_DEFUN([AM_SET_LEADING_DOT],
-[rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
-  am__leading_dot=.
-else
-  am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-AC_SUBST([am__leading_dot])])
+}
 
-# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=${1%.*}.lo
+}
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-# AM_MAKE_INCLUDE()
-# -----------------
-# Check to see how make treats includes.
-AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-	@echo this is the am__doit target
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from `make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
-  am__include=include
-  am__quote=
-  _am_result=GNU
-  ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   case `$am_make -s -f confmf 2> /dev/null` in #(
-   *the\ am__doit\ target*)
-     am__include=.include
-     am__quote="\""
-     _am_result=BSD
-     ;;
-   esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=$(( $[*] ))
+}
 
-# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=${#1}
+}
 
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
 
-# serial 6
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
 
-# AM_MISSING_PROG(NAME, PROGRAM)
-# ------------------------------
-AC_DEFUN([AM_MISSING_PROG],
-[AC_REQUIRE([AM_MISSING_HAS_RUN])
-$1=${$1-"${am_missing_run}$2"}
-AC_SUBST($1)])
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
 
+dnl func_dirname_and_basename
+dnl A portable version of this function is already defined in general.m4sh
+dnl so there is no need for it here.
 
-# AM_MISSING_HAS_RUN
-# ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
-AC_DEFUN([AM_MISSING_HAS_RUN],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([missing])dnl
-if test x"${MISSING+set}" != xset; then
-  case $am_aux_dir in
-  *\ * | *\	*)
-    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
-  *)
-    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
   esac
-fi
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
-else
-  am_missing_run=
-  AC_MSG_WARN([`missing' script is too old or missing])
-fi
-])
-
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
-  [[\\/$]]* | ?:[[\\/]]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
-# Helper functions for option handling.                     -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
-# Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 5
-
-# _AM_MANGLE_OPTION(NAME)
-# -----------------------
-AC_DEFUN([_AM_MANGLE_OPTION],
-[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+}
 
-# _AM_SET_OPTION(NAME)
-# --------------------
-# Set option NAME.  Presently that only means defining a flag for this option.
-AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+# sed scripts:
+my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[[^=]]*=//'
 
-# _AM_SET_OPTIONS(OPTIONS)
-# ------------------------
-# OPTIONS is a space-separated list of Automake options.
-AC_DEFUN([_AM_SET_OPTIONS],
-[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
 
-# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
-# -------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-AC_DEFUN([_AM_IF_OPTION],
-[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+# func_lo2o object
+func_lo2o ()
+{
+  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
 
-# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
+}
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=`expr "$[@]"`
+}
 
-# serial 5
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
 
-# AM_SANITY_CHECK
-# ---------------
-AC_DEFUN([AM_SANITY_CHECK],
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name.  Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
-  *[[\\\"\#\$\&\'\`$am_lf]]*)
-    AC_MSG_ERROR([unsafe absolute working directory name]);;
-esac
-case $srcdir in
-  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
-    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+_LT_EOF
 esac
 
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments.  Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
-   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
-   if test "$[*]" = "X"; then
-      # -L didn't work.
-      set X `ls -t "$srcdir/configure" conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$[*]" != "X $srcdir/configure conftest.file" \
-      && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-alias in your environment])
-   fi
-
-   test "$[2]" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-AC_MSG_RESULT(yes)])
-
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
-# AM_PROG_INSTALL_STRIP
-# ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
-# specify the program used to strip binaries.  This is especially
-# annoying in cross-compiling environments, where the build's strip
-# is unlikely to handle the host's binaries.
-# Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
-# STRIPPROG with the value of the STRIP variable (set by the user).
-AC_DEFUN([AM_PROG_INSTALL_STRIP],
-[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
-if test "$cross_compiling" != no; then
-  AC_CHECK_TOOL([STRIP], [strip], :)
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-AC_SUBST([INSTALL_STRIP_PROGRAM])])
-
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 3
-
-# _AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
-# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
-# This macro is traced by Automake.
-AC_DEFUN([_AM_SUBST_NOTMAKE])
-
-# AM_SUBST_NOTMAKE(VARIABLE)
-# --------------------------
-# Public sister of _AM_SUBST_NOTMAKE.
-AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
-
-# Check how to create a tarball.                            -*- Autoconf -*-
+case $lt_shell_append in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
 
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$[1]+=\$[2]"
+}
+_LT_EOF
+    ;;
+  *)
+    cat << \_LT_EOF >> "$cfgfile"
 
-# serial 2
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$[1]=\$$[1]\$[2]"
+}
 
-# _AM_PROG_TAR(FORMAT)
-# --------------------
-# Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
-#
-# Substitute a variable $(am__tar) that is a command
-# writing to stdout a FORMAT-tarball containing the directory
-# $tardir.
-#     tardir=directory && $(am__tar) > result.tar
-#
-# Substitute a variable $(am__untar) that extract such
-# a tarball read from stdin.
-#     $(am__untar) < result.tar
-AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.  Yes, it's still used
-# in the wild :-(  We should find a proper way to deprecate it ...
-AC_SUBST([AMTAR], ['$${TAR-tar}'])
-m4_if([$1], [v7],
-     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
+_LT_EOF
     ;;
   esac
-
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
-
-  # tar/untar a dummy directory, and stop if the command works
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
-  rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar <conftest.tar])
-    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
-
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
-AC_SUBST([am__tar])
-AC_SUBST([am__untar])
-]) # _AM_PROG_TAR
-
-m4_include([config/osmvsel.m4])
+])
diff --git a/config/ltmain.sh b/config/ltmain.sh
old mode 100644
new mode 100755
index 63ae69d..a72f2fd
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -1,9 +1,9 @@
+# Generated from ltmain.m4sh.
 
-# libtool (GNU libtool) 2.4.2
+# ltmain.sh (GNU libtool) 2.2.6b
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -32,57 +32,50 @@
 #
 # Provide generalized library-building support services.
 #
-#       --config             show all configuration variables
-#       --debug              enable verbose shell tracing
-#   -n, --dry-run            display commands without modifying any files
-#       --features           display basic configuration information and exit
-#       --mode=MODE          use operation mode MODE
-#       --preserve-dup-deps  don't remove duplicate dependency libraries
-#       --quiet, --silent    don't print informational messages
-#       --no-quiet, --no-silent
-#                            print informational messages (default)
-#       --no-warn            don't display warning messages
-#       --tag=TAG            use configuration variables from tag TAG
-#   -v, --verbose            print more informational messages than default
-#       --no-verbose         don't print the extra informational messages
-#       --version            print version information
-#   -h, --help, --help-all   print short, long, or detailed help message
+#     --config             show all configuration variables
+#     --debug              enable verbose shell tracing
+# -n, --dry-run            display commands without modifying any files
+#     --features           display basic configuration information and exit
+#     --mode=MODE          use operation mode MODE
+#     --preserve-dup-deps  don't remove duplicate dependency libraries
+#     --quiet, --silent    don't print informational messages
+#     --tag=TAG            use configuration variables from tag TAG
+# -v, --verbose            print informational messages (default)
+#     --version            print version information
+# -h, --help               print short or long help message
 #
 # MODE must be one of the following:
 #
-#         clean              remove files from the build directory
-#         compile            compile a source file into a libtool object
-#         execute            automatically set library path, then run a program
-#         finish             complete the installation of libtool libraries
-#         install            install libraries or executables
-#         link               create a library or an executable
-#         uninstall          remove libraries from an installed directory
+#       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.  When passed as first option,
-# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# MODE-ARGS vary depending on the MODE.
 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
 #
 # When reporting a bug, please describe a test case to reproduce it and
 # include the following information:
 #
-#         host-triplet:	$host
-#         shell:		$SHELL
-#         compiler:		$LTCC
-#         compiler flags:		$LTCFLAGS
-#         linker:		$LD (gnu? $with_gnu_ld)
-#         $progname:	(GNU libtool) 2.4.2
-#         automake:	$automake_version
-#         autoconf:	$autoconf_version
+#       host-triplet:	$host
+#       shell:		$SHELL
+#       compiler:		$LTCC
+#       compiler flags:		$LTCFLAGS
+#       linker:		$LD (gnu? $with_gnu_ld)
+#       $progname:		(GNU libtool) 2.2.6b
+#       automake:		$automake_version
+#       autoconf:		$autoconf_version
 #
 # Report bugs to <bug-libtool at gnu.org>.
-# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
-# General help using GNU software: <http://www.gnu.org/gethelp/>.
 
-PROGRAM=libtool
+PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION=2.4.2
+VERSION=2.2.6b
 TIMESTAMP=""
-package_revision=1.3337
+package_revision=1.3017
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -98,15 +91,10 @@ fi
 BIN_SH=xpg4; export BIN_SH # for Tru64
 DUALCASE=1; export DUALCASE # for MKS sh
 
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-}
-
 # NLS nuisances: We save the old values to restore during execute mode.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
 lt_user_locale=
 lt_safe_locale=
 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
@@ -119,28 +107,24 @@ do
 	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
 	fi"
 done
-LC_ALL=C
-LANGUAGE=C
-export LANGUAGE LC_ALL
 
 $lt_unset CDPATH
 
 
-# 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"
 
 
 
 : ${CP="cp -f"}
-test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${ECHO="echo"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
+: ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
+: ${SED="/bin/sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -160,27 +144,6 @@ IFS=" 	$lt_nl"
 dirname="s,/[^/]*$,,"
 basename="s,^.*/,,"
 
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-} # func_dirname may be replaced by extended shell implementation
-
-
-# func_basename file
-func_basename ()
-{
-    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
-} # func_basename may be replaced by extended shell implementation
-
-
 # func_dirname_and_basename file append nondir_replacement
 # perform func_basename and func_dirname in a single function
 # call:
@@ -195,183 +158,33 @@ func_basename ()
 # those functions but instead duplicate the functionality here.
 func_dirname_and_basename ()
 {
-    # Extract subdirectory from the argument.
-    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
-} # func_dirname_and_basename may be replaced by extended shell implementation
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-    case ${2} in
-      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-    esac
-} # func_stripname may be replaced by extended shell implementation
-
-
-# These SED scripts presuppose an absolute path with a trailing slash.
-pathcar='s,^/\([^/]*\).*$,\1,'
-pathcdr='s,^/[^/]*,,'
-removedotparts=':dotsl
-		s@/\./@/@g
-		t dotsl
-		s,/\.$,/,'
-collapseslashes='s@/\{1,\}@/@g'
-finalslash='s,/*$,/,'
-
-# func_normal_abspath PATH
-# Remove doubled-up and trailing slashes, "." path components,
-# and cancel out any ".." path components in PATH after making
-# it an absolute path.
-#             value returned in "$func_normal_abspath_result"
-func_normal_abspath ()
-{
-  # Start from root dir and reassemble the path.
-  func_normal_abspath_result=
-  func_normal_abspath_tpath=$1
-  func_normal_abspath_altnamespace=
-  case $func_normal_abspath_tpath in
-    "")
-      # Empty path, that just means $cwd.
-      func_stripname '' '/' "`pwd`"
-      func_normal_abspath_result=$func_stripname_result
-      return
-    ;;
-    # The next three entries are used to spot a run of precisely
-    # two leading slashes without using negated character classes;
-    # we take advantage of case's first-match behaviour.
-    ///*)
-      # Unusual form of absolute path, do nothing.
-    ;;
-    //*)
-      # Not necessarily an ordinary path; POSIX reserves leading '//'
-      # and for example Cygwin uses it to access remote file shares
-      # over CIFS/SMB, so we conserve a leading double slash if found.
-      func_normal_abspath_altnamespace=/
-    ;;
-    /*)
-      # Absolute path, do nothing.
-    ;;
-    *)
-      # Relative path, prepend $cwd.
-      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
-    ;;
-  esac
-  # Cancel out all the simple stuff to save iterations.  We also want
-  # the path to end with a slash for ease of parsing, so make sure
-  # there is one (and only one) here.
-  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
-  while :; do
-    # Processed it all yet?
-    if test "$func_normal_abspath_tpath" = / ; then
-      # If we ascended to the root using ".." the result may be empty now.
-      if test -z "$func_normal_abspath_result" ; then
-        func_normal_abspath_result=/
-      fi
-      break
-    fi
-    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcar"`
-    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcdr"`
-    # Figure out what to do with it
-    case $func_normal_abspath_tcomponent in
-      "")
-        # Trailing empty path component, ignore it.
-      ;;
-      ..)
-        # Parent dir; strip last assembled component from result.
-        func_dirname "$func_normal_abspath_result"
-        func_normal_abspath_result=$func_dirname_result
-      ;;
-      *)
-        # Actual path component, append it.
-        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
-      ;;
-    esac
-  done
-  # Restore leading double-slash if one was found on entry.
-  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
 }
 
-# func_relative_path SRCDIR DSTDIR
-# generates a relative path from SRCDIR to DSTDIR, with a trailing
-# slash if non-empty, suitable for immediately appending a filename
-# without needing to append a separator.
-#             value returned in "$func_relative_path_result"
-func_relative_path ()
-{
-  func_relative_path_result=
-  func_normal_abspath "$1"
-  func_relative_path_tlibdir=$func_normal_abspath_result
-  func_normal_abspath "$2"
-  func_relative_path_tbindir=$func_normal_abspath_result
-
-  # Ascend the tree starting from libdir
-  while :; do
-    # check if we have found a prefix of bindir
-    case $func_relative_path_tbindir in
-      $func_relative_path_tlibdir)
-        # found an exact match
-        func_relative_path_tcancelled=
-        break
-        ;;
-      $func_relative_path_tlibdir*)
-        # found a matching prefix
-        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
-        func_relative_path_tcancelled=$func_stripname_result
-        if test -z "$func_relative_path_result"; then
-          func_relative_path_result=.
-        fi
-        break
-        ;;
-      *)
-        func_dirname $func_relative_path_tlibdir
-        func_relative_path_tlibdir=${func_dirname_result}
-        if test "x$func_relative_path_tlibdir" = x ; then
-          # Have to descend all the way to the root!
-          func_relative_path_result=../$func_relative_path_result
-          func_relative_path_tcancelled=$func_relative_path_tbindir
-          break
-        fi
-        func_relative_path_result=../$func_relative_path_result
-        ;;
-    esac
-  done
-
-  # Now calculate path; take care to avoid doubling-up slashes.
-  func_stripname '' '/' "$func_relative_path_result"
-  func_relative_path_result=$func_stripname_result
-  func_stripname '/' '/' "$func_relative_path_tcancelled"
-  if test "x$func_stripname_result" != x ; then
-    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
-  fi
+# Generated shell functions inserted here.
 
-  # Normalisation. If bindir is libdir, return empty string,
-  # else relative path ending with a slash; either way, target
-  # file name can be directly appended.
-  if test ! -z "$func_relative_path_result"; then
-    func_stripname './' '' "$func_relative_path_result/"
-    func_relative_path_result=$func_stripname_result
-  fi
-}
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
 
 # The name of this program:
+# In the unlikely event $progname began with a '-', it would play havoc with
+# func_echo (imagine progname=-n), so we prepend ./ in that case:
 func_dirname_and_basename "$progpath"
 progname=$func_basename_result
+case $progname in
+  -*) progname=./$progname ;;
+esac
 
 # Make sure we have an absolute path for reexecution:
 case $progpath in
@@ -383,7 +196,7 @@ case $progpath in
      ;;
   *)
      save_IFS="$IFS"
-     IFS=${PATH_SEPARATOR-:}
+     IFS=:
      for progdir in $PATH; do
        IFS="$save_IFS"
        test -x "$progdir/$progname" && break
@@ -402,15 +215,6 @@ sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
 # Same as above, but do not quote variable references.
 double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
-# Sed substitution that turns a string into a regex matching for the
-# string literally.
-sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
-
-# Sed substitution that converts a w32 file name or path
-# which contains forward slashes, into one that contains
-# (escaped) backslashes.  A very naive implementation.
-lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-
 # Re-`\' parameter expansions in output of double_quote_subst that were
 # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
 # in input to double_quote_subst, that '$' was protected from expansion.
@@ -439,7 +243,7 @@ opt_warning=:
 # name if it has been set yet.
 func_echo ()
 {
-    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+    $ECHO "$progname${mode+: }$mode: $*"
 }
 
 # func_verbose arg...
@@ -454,25 +258,18 @@ func_verbose ()
     :
 }
 
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*"
-}
-
 # func_error arg...
 # Echo program name prefixed message to standard error.
 func_error ()
 {
-    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
 }
 
 # func_warning arg...
 # Echo program name prefixed warning message to standard error.
 func_warning ()
 {
-    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
 
     # bash bug again:
     :
@@ -529,9 +326,9 @@ func_mkdir_p ()
         case $my_directory_path in */*) ;; *) break ;; esac
 
         # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
       done
-      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
 
       save_mkdir_p_IFS="$IFS"; IFS=':'
       for my_dir in $my_dir_list; do
@@ -581,7 +378,7 @@ func_mktempdir ()
         func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
     fi
 
-    $ECHO "$my_tmpdir"
+    $ECHO "X$my_tmpdir" | $Xsed
 }
 
 
@@ -595,7 +392,7 @@ func_quote_for_eval ()
 {
     case $1 in
       *[\\\`\"\$]*)
-	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
       *)
         func_quote_for_eval_unquoted_result="$1" ;;
     esac
@@ -622,7 +419,7 @@ func_quote_for_expand ()
 {
     case $1 in
       *[\\\`\"]*)
-	my_arg=`$ECHO "$1" | $SED \
+	my_arg=`$ECHO "X$1" | $Xsed \
 	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
       *)
         my_arg="$1" ;;
@@ -691,39 +488,15 @@ func_show_eval_locale ()
     fi
 }
 
-# func_tr_sh
-# Turn $1 into a string suitable for a shell variable name.
-# Result is stored in $func_tr_sh_result.  All characters
-# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
-# if $1 begins with a digit, a '_' is prepended as well.
-func_tr_sh ()
-{
-  case $1 in
-  [0-9]* | *[!a-zA-Z0-9_]*)
-    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
-    ;;
-  * )
-    func_tr_sh_result=$1
-    ;;
-  esac
-}
+
+
 
 
 # func_version
 # Echo version message to standard output and exit.
 func_version ()
 {
-    $opt_debug
-
-    $SED -n '/(C)/!b go
-	:more
-	/\./!{
-	  N
-	  s/\n# / /
-	  b more
-	}
-	:go
-	/^# '$PROGRAM' (GNU /,/# warranty; / {
+    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
         s/^# //
 	s/^# *$//
         s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
@@ -736,28 +509,22 @@ func_version ()
 # Echo short help message to standard output and exit.
 func_usage ()
 {
-    $opt_debug
-
-    $SED -n '/^# Usage:/,/^#  *.*--help/ {
+    $SED -n '/^# Usage:/,/# -h/ {
         s/^# //
 	s/^# *$//
 	s/\$progname/'$progname'/
 	p
     }' < "$progpath"
-    echo
+    $ECHO
     $ECHO "run \`$progname --help | more' for full usage"
     exit $?
 }
 
-# func_help [NOEXIT]
-# Echo long help message to standard output and exit,
-# unless 'noexit' is passed as argument.
+# func_help
+# Echo long help message to standard output and exit.
 func_help ()
 {
-    $opt_debug
-
     $SED -n '/^# Usage:/,/# Report bugs to/ {
-	:print
         s/^# //
 	s/^# *$//
 	s*\$progname*'$progname'*
@@ -767,18 +534,11 @@ func_help ()
 	s*\$LTCFLAGS*'"$LTCFLAGS"'*
 	s*\$LD*'"$LD"'*
 	s/\$with_gnu_ld/'"$with_gnu_ld"'/
-	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
-	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
+	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
 	p
-	d
-     }
-     /^# .* home page:/b print
-     /^# General help using/b print
-     ' < "$progpath"
-    ret=$?
-    if test -z "$1"; then
-      exit $ret
-    fi
+     }' < "$progpath"
+    exit $?
 }
 
 # func_missing_arg argname
@@ -786,106 +546,63 @@ func_help ()
 # exit_cmd.
 func_missing_arg ()
 {
-    $opt_debug
-
-    func_error "missing argument for $1."
+    func_error "missing argument for $1"
     exit_cmd=exit
 }
 
+exit_cmd=:
 
-# func_split_short_opt shortopt
-# Set func_split_short_opt_name and func_split_short_opt_arg shell
-# variables after splitting SHORTOPT after the 2nd character.
-func_split_short_opt ()
-{
-    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
-    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
-
-    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
-    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
-} # func_split_short_opt may be replaced by extended shell implementation
-
-
-# func_split_long_opt longopt
-# Set func_split_long_opt_name and func_split_long_opt_arg shell
-# variables after splitting LONGOPT at the `=' sign.
-func_split_long_opt ()
-{
-    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
-    my_sed_long_arg='1s/^--[^=]*=//'
-
-    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
-    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
-} # func_split_long_opt may be replaced by extended shell implementation
 
-exit_cmd=:
 
 
 
+# Check that we have a working $ECHO.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell, and then maybe $ECHO will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
 
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
 
 magic="%%%MAGIC variable%%%"
 magic_exe="%%%MAGIC EXE variable%%%"
 
 # Global variables.
+# $mode is unset
 nonopt=
+execute_dlfiles=
 preserve_args=
 lo2o="s/\\.lo\$/.${objext}/"
 o2lo="s/\\.${objext}\$/.lo/"
 extracted_archives=
 extracted_serial=0
 
+opt_dry_run=false
+opt_duplicate_deps=false
+opt_silent=false
+opt_debug=:
+
 # If this variable is set in any of the actions, the command in it
 # will be execed at the end.  This prevents here-documents from being
 # left over by shells.
 exec_cmd=
 
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
-    eval "${1}=\$${1}\${2}"
-} # func_append may be replaced by extended shell implementation
-
-# func_append_quoted var value
-# Quote VALUE and append to the end of shell variable VAR, separated
-# by a space.
-func_append_quoted ()
-{
-    func_quote_for_eval "${2}"
-    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
-} # func_append_quoted may be replaced by extended shell implementation
-
-
-# func_arith arithmetic-term...
-func_arith ()
-{
-    func_arith_result=`expr "${@}"`
-} # func_arith may be replaced by extended shell implementation
-
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
-} # func_len may be replaced by extended shell implementation
-
-
-# func_lo2o object
-func_lo2o ()
-{
-    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
-} # func_lo2o may be replaced by extended shell implementation
-
-
-# func_xform libobj-or-source
-func_xform ()
-{
-    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
-} # func_xform may be replaced by extended shell implementation
-
-
 # func_fatal_configuration arg...
 # Echo program name prefixed message to standard error, followed by
 # a configuration failure hint, and exit.
@@ -919,16 +636,16 @@ func_config ()
 # Display the features supported by this script.
 func_features ()
 {
-    echo "host: $host"
+    $ECHO "host: $host"
     if test "$build_libtool_libs" = yes; then
-      echo "enable shared libraries"
+      $ECHO "enable shared libraries"
     else
-      echo "disable shared libraries"
+      $ECHO "disable shared libraries"
     fi
     if test "$build_old_libs" = yes; then
-      echo "enable static libraries"
+      $ECHO "enable static libraries"
     else
-      echo "disable static libraries"
+      $ECHO "disable static libraries"
     fi
 
     exit $?
@@ -975,209 +692,117 @@ func_enable_tag ()
   esac
 }
 
-# func_check_version_match
-# Ensure that we are using m4 macros, and libtool script from the same
-# release of libtool.
-func_check_version_match ()
+# Parse options once, thoroughly.  This comes as soon as possible in
+# the script to make things like `libtool --version' happen quickly.
 {
-  if test "$package_revision" != "$macro_revision"; then
-    if test "$VERSION" != "$macro_version"; then
-      if test -z "$macro_version"; then
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from an older release.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      else
-        cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
-      fi
-    else
-      cat >&2 <<_LT_EOF
-$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
-$progname: of $PACKAGE $VERSION and run autoconf again.
-_LT_EOF
-    fi
-
-    exit $EXIT_MISMATCH
-  fi
-}
-
-
-# Shorthand for --mode=foo, only valid as the first argument
-case $1 in
-clean|clea|cle|cl)
-  shift; set dummy --mode clean ${1+"$@"}; shift
-  ;;
-compile|compil|compi|comp|com|co|c)
-  shift; set dummy --mode compile ${1+"$@"}; shift
-  ;;
-execute|execut|execu|exec|exe|ex|e)
-  shift; set dummy --mode execute ${1+"$@"}; shift
-  ;;
-finish|finis|fini|fin|fi|f)
-  shift; set dummy --mode finish ${1+"$@"}; shift
-  ;;
-install|instal|insta|inst|ins|in|i)
-  shift; set dummy --mode install ${1+"$@"}; shift
-  ;;
-link|lin|li|l)
-  shift; set dummy --mode link ${1+"$@"}; shift
-  ;;
-uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-  shift; set dummy --mode uninstall ${1+"$@"}; shift
-  ;;
-esac
-
-
-
-# Option defaults:
-opt_debug=:
-opt_dry_run=false
-opt_config=false
-opt_preserve_dup_deps=false
-opt_features=false
-opt_finish=false
-opt_help=false
-opt_help_all=false
-opt_silent=:
-opt_warning=:
-opt_verbose=:
-opt_silent=false
-opt_verbose=false
 
+  # Shorthand for --mode=foo, only valid as the first argument
+  case $1 in
+  clean|clea|cle|cl)
+    shift; set dummy --mode clean ${1+"$@"}; shift
+    ;;
+  compile|compil|compi|comp|com|co|c)
+    shift; set dummy --mode compile ${1+"$@"}; shift
+    ;;
+  execute|execut|execu|exec|exe|ex|e)
+    shift; set dummy --mode execute ${1+"$@"}; shift
+    ;;
+  finish|finis|fini|fin|fi|f)
+    shift; set dummy --mode finish ${1+"$@"}; shift
+    ;;
+  install|instal|insta|inst|ins|in|i)
+    shift; set dummy --mode install ${1+"$@"}; shift
+    ;;
+  link|lin|li|l)
+    shift; set dummy --mode link ${1+"$@"}; shift
+    ;;
+  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+    shift; set dummy --mode uninstall ${1+"$@"}; shift
+    ;;
+  esac
 
-# Parse options once, thoroughly.  This comes as soon as possible in the
-# script to make things like `--version' happen as quickly as we can.
-{
-  # this just eases exit handling
-  while test $# -gt 0; do
+  # Parse non-mode specific arguments:
+  while test "$#" -gt 0; do
     opt="$1"
     shift
+
     case $opt in
-      --debug|-x)	opt_debug='set -x'
+      --config)		func_config					;;
+
+      --debug)		preserve_args="$preserve_args $opt"
 			func_echo "enabling shell trace mode"
+			opt_debug='set -x'
 			$opt_debug
 			;;
-      --dry-run|--dryrun|-n)
-			opt_dry_run=:
-			;;
-      --config)
-			opt_config=:
-func_config
-			;;
-      --dlopen|-dlopen)
-			optarg="$1"
-			opt_dlopen="${opt_dlopen+$opt_dlopen
-}$optarg"
+
+      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			execute_dlfiles="$execute_dlfiles $1"
 			shift
 			;;
-      --preserve-dup-deps)
-			opt_preserve_dup_deps=:
-			;;
-      --features)
-			opt_features=:
-func_features
-			;;
-      --finish)
-			opt_finish=:
-set dummy --mode finish ${1+"$@"}; shift
-			;;
-      --help)
-			opt_help=:
-			;;
-      --help-all)
-			opt_help_all=:
-opt_help=': help-all'
-			;;
-      --mode)
-			test $# = 0 && func_missing_arg $opt && break
-			optarg="$1"
-			opt_mode="$optarg"
-case $optarg in
-  # Valid mode arguments:
-  clean|compile|execute|finish|install|link|relink|uninstall) ;;
-
-  # Catch anything else as an error
-  *) func_error "invalid argument for $opt"
-     exit_cmd=exit
-     break
-     ;;
-esac
+
+      --dry-run | -n)	opt_dry_run=:					;;
+      --features)       func_features					;;
+      --finish)		mode="finish"					;;
+
+      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			case $1 in
+			  # Valid mode arguments:
+			  clean)	;;
+			  compile)	;;
+			  execute)	;;
+			  finish)	;;
+			  install)	;;
+			  link)		;;
+			  relink)	;;
+			  uninstall)	;;
+
+			  # Catch anything else as an error
+			  *) func_error "invalid argument for $opt"
+			     exit_cmd=exit
+			     break
+			     ;;
+		        esac
+
+			mode="$1"
 			shift
 			;;
-      --no-silent|--no-quiet)
-			opt_silent=false
-func_append preserve_args " $opt"
-			;;
-      --no-warning|--no-warn)
-			opt_warning=false
-func_append preserve_args " $opt"
-			;;
-      --no-verbose)
-			opt_verbose=false
-func_append preserve_args " $opt"
-			;;
-      --silent|--quiet)
+
+      --preserve-dup-deps)
+			opt_duplicate_deps=:				;;
+
+      --quiet|--silent)	preserve_args="$preserve_args $opt"
 			opt_silent=:
-func_append preserve_args " $opt"
-        opt_verbose=false
 			;;
-      --verbose|-v)
-			opt_verbose=:
-func_append preserve_args " $opt"
-opt_silent=false
+
+      --verbose| -v)	preserve_args="$preserve_args $opt"
+			opt_silent=false
 			;;
-      --tag)
-			test $# = 0 && func_missing_arg $opt && break
-			optarg="$1"
-			opt_tag="$optarg"
-func_append preserve_args " $opt $optarg"
-func_enable_tag "$optarg"
+
+      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			preserve_args="$preserve_args $opt $1"
+			func_enable_tag "$1"	# tagname is set here
 			shift
 			;;
 
-      -\?|-h)		func_usage				;;
-      --help)		func_help				;;
-      --version)	func_version				;;
-
       # Separate optargs to long options:
-      --*=*)
-			func_split_long_opt "$opt"
-			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+      -dlopen=*|--mode=*|--tag=*)
+			func_opt_split "$opt"
+			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
 			shift
 			;;
 
-      # Separate non-argument short options:
-      -\?*|-h*|-n*|-v*)
-			func_split_short_opt "$opt"
-			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
-			shift
-			;;
+      -\?|-h)		func_usage					;;
+      --help)		opt_help=:					;;
+      --version)	func_version					;;
 
-      --)		break					;;
-      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
-      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
+      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
+
+      *)		nonopt="$opt"
+			break
+			;;
     esac
   done
 
-  # Validate options:
-
-  # save first non-option argument
-  if test "$#" -gt 0; then
-    nonopt="$opt"
-    shift
-  fi
-
-  # preserve --debug
-  test "$opt_debug" = : || func_append preserve_args " --debug"
 
   case $host in
     *cygwin* | *mingw* | *pw32* | *cegcc*)
@@ -1185,44 +810,82 @@ func_enable_tag "$optarg"
       opt_duplicate_compiler_generated_deps=:
       ;;
     *)
-      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
       ;;
   esac
 
-  $opt_help || {
-    # Sanity checks first:
-    func_check_version_match
+  # Having warned about all mis-specified options, bail out if
+  # anything was wrong.
+  $exit_cmd $EXIT_FAILURE
+}
 
-    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-      func_fatal_configuration "not configured to build any kind of library"
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
     fi
 
-    # Darwin sucks
-    eval std_shrext=\"$shrext_cmds\"
+    exit $EXIT_MISMATCH
+  fi
+}
 
-    # Only execute mode is allowed to have -dlopen flags.
-    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
-      func_error "unrecognized option \`-dlopen'"
-      $ECHO "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
 
-    # Change the help message to a mode-specific one.
-    generic_help="$help"
-    help="Try \`$progname --help --mode=$opt_mode' for more information."
-  }
+## ----------- ##
+##    Main.    ##
+## ----------- ##
 
+$opt_help || {
+  # Sanity checks first:
+  func_check_version_match
 
-  # Bail if the options were screwed
-  $exit_cmd $EXIT_FAILURE
-}
+  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+    func_fatal_configuration "not configured to build any kind of library"
+  fi
 
+  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
 
 
+  # Darwin sucks
+  eval std_shrext=\"$shrext_cmds\"
+
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    func_error "unrecognized option \`-dlopen'"
+    $ECHO "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$progname --help --mode=$mode' for more information."
+}
 
-## ----------- ##
-##    Main.    ##
-## ----------- ##
 
 # func_lalib_p file
 # True iff FILE is a libtool `.la' library or `.lo' object file.
@@ -1287,9 +950,12 @@ func_ltwrapper_executable_p ()
 # temporary ltwrapper_script.
 func_ltwrapper_scriptname ()
 {
-    func_dirname_and_basename "$1" "" "."
-    func_stripname '' '.exe' "$func_basename_result"
-    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+    func_ltwrapper_scriptname_result=""
+    if func_ltwrapper_executable_p "$1"; then
+	func_dirname_and_basename "$1" "" "."
+	func_stripname '' '.exe' "$func_basename_result"
+	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+    fi
 }
 
 # func_ltwrapper_p file
@@ -1335,37 +1001,6 @@ func_source ()
 }
 
 
-# func_resolve_sysroot PATH
-# Replace a leading = in PATH with a sysroot.  Store the result into
-# func_resolve_sysroot_result
-func_resolve_sysroot ()
-{
-  func_resolve_sysroot_result=$1
-  case $func_resolve_sysroot_result in
-  =*)
-    func_stripname '=' '' "$func_resolve_sysroot_result"
-    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
-    ;;
-  esac
-}
-
-# func_replace_sysroot PATH
-# If PATH begins with the sysroot, replace it with = and
-# store the result into func_replace_sysroot_result.
-func_replace_sysroot ()
-{
-  case "$lt_sysroot:$1" in
-  ?*:"$lt_sysroot"*)
-    func_stripname "$lt_sysroot" '' "$1"
-    func_replace_sysroot_result="=$func_stripname_result"
-    ;;
-  *)
-    # Including no sysroot.
-    func_replace_sysroot_result=$1
-    ;;
-  esac
-}
-
 # func_infer_tag arg
 # Infer tagged configuration to use if any are available and
 # if one wasn't chosen via the "--tag" command line option.
@@ -1378,15 +1013,13 @@ func_infer_tag ()
     if test -n "$available_tags" && test -z "$tagname"; then
       CC_quoted=
       for arg in $CC; do
-	func_append_quoted CC_quoted "$arg"
+        func_quote_for_eval "$arg"
+	CC_quoted="$CC_quoted $func_quote_for_eval_result"
       done
-      CC_expanded=`func_echo_all $CC`
-      CC_quoted_expanded=`func_echo_all $CC_quoted`
       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 "* | " $CC_expanded "* | "$CC_expanded "* | \
-      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+      " $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.
       *)
@@ -1397,13 +1030,11 @@ func_infer_tag ()
 	    CC_quoted=
 	    for arg in $CC; do
 	      # Double-quote args containing other shell metacharacters.
-	      func_append_quoted CC_quoted "$arg"
+	      func_quote_for_eval "$arg"
+	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
 	    done
-	    CC_expanded=`func_echo_all $CC`
-	    CC_quoted_expanded=`func_echo_all $CC_quoted`
 	    case "$@ " in
-	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
-	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+	      " $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.
@@ -1466,486 +1097,6 @@ EOF
     }
 }
 
-
-##################################################
-# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
-##################################################
-
-# func_convert_core_file_wine_to_w32 ARG
-# Helper function used by file name conversion functions when $build is *nix,
-# and $host is mingw, cygwin, or some other w32 environment. Relies on a
-# correctly configured wine environment available, with the winepath program
-# in $build's $PATH.
-#
-# ARG is the $build file name to be converted to w32 format.
-# Result is available in $func_convert_core_file_wine_to_w32_result, and will
-# be empty on error (or when ARG is empty)
-func_convert_core_file_wine_to_w32 ()
-{
-  $opt_debug
-  func_convert_core_file_wine_to_w32_result="$1"
-  if test -n "$1"; then
-    # Unfortunately, winepath does not exit with a non-zero error code, so we
-    # are forced to check the contents of stdout. On the other hand, if the
-    # command is not found, the shell will set an exit code of 127 and print
-    # *an error message* to stdout. So we must check for both error code of
-    # zero AND non-empty stdout, which explains the odd construction:
-    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
-    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
-      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
-        $SED -e "$lt_sed_naive_backslashify"`
-    else
-      func_convert_core_file_wine_to_w32_result=
-    fi
-  fi
-}
-# end: func_convert_core_file_wine_to_w32
-
-
-# func_convert_core_path_wine_to_w32 ARG
-# Helper function used by path conversion functions when $build is *nix, and
-# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
-# configured wine environment available, with the winepath program in $build's
-# $PATH. Assumes ARG has no leading or trailing path separator characters.
-#
-# ARG is path to be converted from $build format to win32.
-# Result is available in $func_convert_core_path_wine_to_w32_result.
-# Unconvertible file (directory) names in ARG are skipped; if no directory names
-# are convertible, then the result may be empty.
-func_convert_core_path_wine_to_w32 ()
-{
-  $opt_debug
-  # unfortunately, winepath doesn't convert paths, only file names
-  func_convert_core_path_wine_to_w32_result=""
-  if test -n "$1"; then
-    oldIFS=$IFS
-    IFS=:
-    for func_convert_core_path_wine_to_w32_f in $1; do
-      IFS=$oldIFS
-      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
-      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
-        if test -z "$func_convert_core_path_wine_to_w32_result"; then
-          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
-        else
-          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
-        fi
-      fi
-    done
-    IFS=$oldIFS
-  fi
-}
-# end: func_convert_core_path_wine_to_w32
-
-
-# func_cygpath ARGS...
-# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
-# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
-# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
-# (2), returns the Cygwin file name or path in func_cygpath_result (input
-# file name or path is assumed to be in w32 format, as previously converted
-# from $build's *nix or MSYS format). In case (3), returns the w32 file name
-# or path in func_cygpath_result (input file name or path is assumed to be in
-# Cygwin format). Returns an empty string on error.
-#
-# ARGS are passed to cygpath, with the last one being the file name or path to
-# be converted.
-#
-# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
-# environment variable; do not put it in $PATH.
-func_cygpath ()
-{
-  $opt_debug
-  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
-    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
-    if test "$?" -ne 0; then
-      # on failure, ensure result is empty
-      func_cygpath_result=
-    fi
-  else
-    func_cygpath_result=
-    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
-  fi
-}
-#end: func_cygpath
-
-
-# func_convert_core_msys_to_w32 ARG
-# Convert file name or path ARG from MSYS format to w32 format.  Return
-# result in func_convert_core_msys_to_w32_result.
-func_convert_core_msys_to_w32 ()
-{
-  $opt_debug
-  # awkward: cmd appends spaces to result
-  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
-    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
-}
-#end: func_convert_core_msys_to_w32
-
-
-# func_convert_file_check ARG1 ARG2
-# Verify that ARG1 (a file name in $build format) was converted to $host
-# format in ARG2. Otherwise, emit an error message, but continue (resetting
-# func_to_host_file_result to ARG1).
-func_convert_file_check ()
-{
-  $opt_debug
-  if test -z "$2" && test -n "$1" ; then
-    func_error "Could not determine host file name corresponding to"
-    func_error "  \`$1'"
-    func_error "Continuing, but uninstalled executables may not work."
-    # Fallback:
-    func_to_host_file_result="$1"
-  fi
-}
-# end func_convert_file_check
-
-
-# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
-# Verify that FROM_PATH (a path in $build format) was converted to $host
-# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
-# func_to_host_file_result to a simplistic fallback value (see below).
-func_convert_path_check ()
-{
-  $opt_debug
-  if test -z "$4" && test -n "$3"; then
-    func_error "Could not determine the host path corresponding to"
-    func_error "  \`$3'"
-    func_error "Continuing, but uninstalled executables may not work."
-    # Fallback.  This is a deliberately simplistic "conversion" and
-    # should not be "improved".  See libtool.info.
-    if test "x$1" != "x$2"; then
-      lt_replace_pathsep_chars="s|$1|$2|g"
-      func_to_host_path_result=`echo "$3" |
-        $SED -e "$lt_replace_pathsep_chars"`
-    else
-      func_to_host_path_result="$3"
-    fi
-  fi
-}
-# end func_convert_path_check
-
-
-# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
-# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
-# and appending REPL if ORIG matches BACKPAT.
-func_convert_path_front_back_pathsep ()
-{
-  $opt_debug
-  case $4 in
-  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
-    ;;
-  esac
-  case $4 in
-  $2 ) func_append func_to_host_path_result "$3"
-    ;;
-  esac
-}
-# end func_convert_path_front_back_pathsep
-
-
-##################################################
-# $build to $host FILE NAME CONVERSION FUNCTIONS #
-##################################################
-# invoked via `$to_host_file_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# Result will be available in $func_to_host_file_result.
-
-
-# func_to_host_file ARG
-# Converts the file name ARG from $build format to $host format. Return result
-# in func_to_host_file_result.
-func_to_host_file ()
-{
-  $opt_debug
-  $to_host_file_cmd "$1"
-}
-# end func_to_host_file
-
-
-# func_to_tool_file ARG LAZY
-# converts the file name ARG from $build format to toolchain format. Return
-# result in func_to_tool_file_result.  If the conversion in use is listed
-# in (the comma separated) LAZY, no conversion takes place.
-func_to_tool_file ()
-{
-  $opt_debug
-  case ,$2, in
-    *,"$to_tool_file_cmd",*)
-      func_to_tool_file_result=$1
-      ;;
-    *)
-      $to_tool_file_cmd "$1"
-      func_to_tool_file_result=$func_to_host_file_result
-      ;;
-  esac
-}
-# end func_to_tool_file
-
-
-# func_convert_file_noop ARG
-# Copy ARG to func_to_host_file_result.
-func_convert_file_noop ()
-{
-  func_to_host_file_result="$1"
-}
-# end func_convert_file_noop
-
-
-# func_convert_file_msys_to_w32 ARG
-# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper.  Returns result in
-# func_to_host_file_result.
-func_convert_file_msys_to_w32 ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    func_convert_core_msys_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_w32
-
-
-# func_convert_file_cygwin_to_w32 ARG
-# Convert file name ARG from Cygwin to w32 format.  Returns result in
-# func_to_host_file_result.
-func_convert_file_cygwin_to_w32 ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
-    # LT_CYGPATH in this case.
-    func_to_host_file_result=`cygpath -m "$1"`
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_cygwin_to_w32
-
-
-# func_convert_file_nix_to_w32 ARG
-# Convert file name ARG from *nix to w32 format.  Requires a wine environment
-# and a working winepath. Returns result in func_to_host_file_result.
-func_convert_file_nix_to_w32 ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    func_convert_core_file_wine_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_w32
-
-
-# func_convert_file_msys_to_cygwin ARG
-# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_file_msys_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    func_convert_core_msys_to_w32 "$1"
-    func_cygpath -u "$func_convert_core_msys_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_cygwin
-
-
-# func_convert_file_nix_to_cygwin ARG
-# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
-# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
-# in func_to_host_file_result.
-func_convert_file_nix_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_file_result="$1"
-  if test -n "$1"; then
-    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
-    func_convert_core_file_wine_to_w32 "$1"
-    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
-  fi
-  func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_cygwin
-
-
-#############################################
-# $build to $host PATH CONVERSION FUNCTIONS #
-#############################################
-# invoked via `$to_host_path_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# The result will be available in $func_to_host_path_result.
-#
-# Path separators are also converted from $build format to $host format.  If
-# ARG begins or ends with a path separator character, it is preserved (but
-# converted to $host format) on output.
-#
-# All path conversion functions are named using the following convention:
-#   file name conversion function    : func_convert_file_X_to_Y ()
-#   path conversion function         : func_convert_path_X_to_Y ()
-# where, for any given $build/$host combination the 'X_to_Y' value is the
-# same.  If conversion functions are added for new $build/$host combinations,
-# the two new functions must follow this pattern, or func_init_to_host_path_cmd
-# will break.
-
-
-# func_init_to_host_path_cmd
-# Ensures that function "pointer" variable $to_host_path_cmd is set to the
-# appropriate value, based on the value of $to_host_file_cmd.
-to_host_path_cmd=
-func_init_to_host_path_cmd ()
-{
-  $opt_debug
-  if test -z "$to_host_path_cmd"; then
-    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
-    to_host_path_cmd="func_convert_path_${func_stripname_result}"
-  fi
-}
-
-
-# func_to_host_path ARG
-# Converts the path ARG from $build format to $host format. Return result
-# in func_to_host_path_result.
-func_to_host_path ()
-{
-  $opt_debug
-  func_init_to_host_path_cmd
-  $to_host_path_cmd "$1"
-}
-# end func_to_host_path
-
-
-# func_convert_path_noop ARG
-# Copy ARG to func_to_host_path_result.
-func_convert_path_noop ()
-{
-  func_to_host_path_result="$1"
-}
-# end func_convert_path_noop
-
-
-# func_convert_path_msys_to_w32 ARG
-# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper.  Returns result in
-# func_to_host_path_result.
-func_convert_path_msys_to_w32 ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # Remove leading and trailing path separator characters from ARG.  MSYS
-    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
-    # and winepath ignores them completely.
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
-    func_convert_path_check : ";" \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
-  fi
-}
-# end func_convert_path_msys_to_w32
-
-
-# func_convert_path_cygwin_to_w32 ARG
-# Convert path ARG from Cygwin to w32 format.  Returns result in
-# func_to_host_file_result.
-func_convert_path_cygwin_to_w32 ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # See func_convert_path_msys_to_w32:
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
-    func_convert_path_check : ";" \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
-  fi
-}
-# end func_convert_path_cygwin_to_w32
-
-
-# func_convert_path_nix_to_w32 ARG
-# Convert path ARG from *nix to w32 format.  Requires a wine environment and
-# a working winepath.  Returns result in func_to_host_file_result.
-func_convert_path_nix_to_w32 ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # See func_convert_path_msys_to_w32:
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
-    func_convert_path_check : ";" \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
-  fi
-}
-# end func_convert_path_nix_to_w32
-
-
-# func_convert_path_msys_to_cygwin ARG
-# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_path_msys_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # See func_convert_path_msys_to_w32:
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
-    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
-    func_convert_path_check : : \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
-  fi
-}
-# end func_convert_path_msys_to_cygwin
-
-
-# func_convert_path_nix_to_cygwin ARG
-# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
-# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
-# func_to_host_file_result.
-func_convert_path_nix_to_cygwin ()
-{
-  $opt_debug
-  func_to_host_path_result="$1"
-  if test -n "$1"; then
-    # Remove leading and trailing path separator characters from
-    # ARG. msys behavior is inconsistent here, cygpath turns them
-    # into '.;' and ';.', and winepath ignores them completely.
-    func_stripname : : "$1"
-    func_to_host_path_tmp1=$func_stripname_result
-    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
-    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
-    func_convert_path_check : : \
-      "$func_to_host_path_tmp1" "$func_to_host_path_result"
-    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
-  fi
-}
-# end func_convert_path_nix_to_cygwin
-
-
 # func_mode_compile arg...
 func_mode_compile ()
 {
@@ -1986,12 +1137,12 @@ func_mode_compile ()
 	  ;;
 
 	-pie | -fpie | -fPIE)
-          func_append pie_flag " $arg"
+          pie_flag="$pie_flag $arg"
 	  continue
 	  ;;
 
 	-shared | -static | -prefer-pic | -prefer-non-pic)
-	  func_append later " $arg"
+	  later="$later $arg"
 	  continue
 	  ;;
 
@@ -2012,14 +1163,15 @@ func_mode_compile ()
 	  save_ifs="$IFS"; IFS=','
 	  for arg in $args; do
 	    IFS="$save_ifs"
-	    func_append_quoted lastarg "$arg"
+	    func_quote_for_eval "$arg"
+	    lastarg="$lastarg $func_quote_for_eval_result"
 	  done
 	  IFS="$save_ifs"
 	  func_stripname ' ' '' "$lastarg"
 	  lastarg=$func_stripname_result
 
 	  # Add the arguments to base_compile.
-	  func_append base_compile " $lastarg"
+	  base_compile="$base_compile $lastarg"
 	  continue
 	  ;;
 
@@ -2035,7 +1187,8 @@ func_mode_compile ()
       esac    #  case $arg_mode
 
       # Aesthetically quote the previous argument.
-      func_append_quoted base_compile "$lastarg"
+      func_quote_for_eval "$lastarg"
+      base_compile="$base_compile $func_quote_for_eval_result"
     done # for arg
 
     case $arg_mode in
@@ -2060,7 +1213,7 @@ func_mode_compile ()
     *.[cCFSifmso] | \
     *.ada | *.adb | *.ads | *.asm | \
     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
       func_xform "$libobj"
       libobj=$func_xform_result
       ;;
@@ -2135,7 +1288,7 @@ func_mode_compile ()
     # 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 "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
       lockfile="$output_obj.lock"
     else
       output_obj=
@@ -2166,16 +1319,17 @@ compiler."
 	$opt_dry_run || $RM $removelist
 	exit $EXIT_FAILURE
       fi
-      func_append removelist " $output_obj"
+      removelist="$removelist $output_obj"
       $ECHO "$srcfile" > "$lockfile"
     fi
 
     $opt_dry_run || $RM $removelist
-    func_append removelist " $lockfile"
+    removelist="$removelist $lockfile"
     trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
 
-    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
-    srcfile=$func_to_tool_file_result
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
     func_quote_for_eval "$srcfile"
     qsrcfile=$func_quote_for_eval_result
 
@@ -2195,7 +1349,7 @@ compiler."
 
       if test -z "$output_obj"; then
 	# Place PIC objects in $objdir
-	func_append command " -o $lobj"
+	command="$command -o $lobj"
       fi
 
       func_show_eval_locale "$command"	\
@@ -2242,11 +1396,11 @@ compiler."
 	command="$base_compile $qsrcfile $pic_flag"
       fi
       if test "$compiler_c_o" = yes; then
-	func_append command " -o $obj"
+	command="$command -o $obj"
       fi
 
       # Suppress compiler output if we already did a PIC compilation.
-      func_append command "$suppress_output"
+      command="$command$suppress_output"
       func_show_eval_locale "$command" \
         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 
@@ -2291,13 +1445,13 @@ compiler."
 }
 
 $opt_help || {
-  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+test "$mode" = compile && func_mode_compile ${1+"$@"}
 }
 
 func_mode_help ()
 {
     # We need to display help for each of the modes.
-    case $opt_mode in
+    case $mode in
       "")
         # Generic help is extracted from the usage comments
         # at the start of this file.
@@ -2328,11 +1482,10 @@ This mode accepts the following additional options:
 
   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
   -no-suppress      do not suppress compiler output for multiple passes
-  -prefer-pic       try to build PIC objects only
-  -prefer-non-pic   try to build non-PIC objects only
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
   -shared           do not build a \`.o' file suitable for static linking
   -static           only build a \`.o' file suitable for static linking
-  -Wc,FLAG          pass FLAG directly to the compiler
 
 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
 from the given SOURCEFILE.
@@ -2385,7 +1538,7 @@ either the \`install' or \`cp' program.
 
 The following components of INSTALL-COMMAND are treated specially:
 
-  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
 
 The rest of the components are interpreted as arguments to that command (only
 BSD-compatible install options are recognized)."
@@ -2405,8 +1558,6 @@ 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
-  -bindir BINDIR    specify path to binaries directory (for systems where
-                    libraries must be found in the PATH setting at runtime)
   -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)
@@ -2435,11 +1586,6 @@ The following components of LINK-COMMAND are treated specially:
   -version-info CURRENT[:REVISION[:AGE]]
                     specify library version info [each variable defaults to 0]
   -weak LIBNAME     declare that the target provides the LIBNAME interface
-  -Wc,FLAG
-  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
-  -Wl,FLAG
-  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
-  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 
 All other options (arguments beginning with \`-') are ignored.
 
@@ -2473,44 +1619,18 @@ Otherwise, only FILE itself is deleted using RM."
         ;;
 
       *)
-        func_fatal_help "invalid operation mode \`$opt_mode'"
+        func_fatal_help "invalid operation mode \`$mode'"
         ;;
     esac
 
-    echo
+    $ECHO
     $ECHO "Try \`$progname --help' for more information about other modes."
+
+    exit $?
 }
 
-# Now that we've collected a possible --mode arg, show help if necessary
-if $opt_help; then
-  if test "$opt_help" = :; then
-    func_mode_help
-  else
-    {
-      func_help noexit
-      for opt_mode in compile link execute install finish uninstall clean; do
-	func_mode_help
-      done
-    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
-    {
-      func_help noexit
-      for opt_mode in compile link execute install finish uninstall clean; do
-	echo
-	func_mode_help
-      done
-    } |
-    sed '1d
-      /^When reporting/,/^Report/{
-	H
-	d
-      }
-      $x
-      /information about other modes/d
-      /more detailed .*MODE/d
-      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
-  fi
-  exit $?
-fi
+  # Now that we've collected a possible --mode arg, show help if necessary
+  $opt_help && func_mode_help
 
 
 # func_mode_execute arg...
@@ -2523,16 +1643,13 @@ func_mode_execute ()
       func_fatal_help "you must specify a COMMAND"
 
     # Handle -dlopen flags immediately.
-    for file in $opt_dlopen; do
+    for file in $execute_dlfiles; do
       test -f "$file" \
 	|| func_fatal_help "\`$file' is not a file"
 
       dir=
       case $file in
       *.la)
-	func_resolve_sysroot "$file"
-	file=$func_resolve_sysroot_result
-
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$lib' is not a valid libtool archive"
@@ -2554,7 +1671,7 @@ func_mode_execute ()
 	dir="$func_dirname_result"
 
 	if test -f "$dir/$objdir/$dlname"; then
-	  func_append dir "/$objdir"
+	  dir="$dir/$objdir"
 	else
 	  if test ! -f "$dir/$dlname"; then
 	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
@@ -2595,7 +1712,7 @@ func_mode_execute ()
     for file
     do
       case $file in
-      -* | *.la | *.lo ) ;;
+      -*) ;;
       *)
 	# Do a test to see if this is really a libtool program.
 	if func_ltwrapper_script_p "$file"; then
@@ -2611,7 +1728,8 @@ func_mode_execute ()
 	;;
       esac
       # Quote arguments (to preserve shell metacharacters).
-      func_append_quoted args "$file"
+      func_quote_for_eval "$file"
+      args="$args $func_quote_for_eval_result"
     done
 
     if test "X$opt_dry_run" = Xfalse; then
@@ -2636,66 +1754,29 @@ func_mode_execute ()
       # Display what would be done.
       if test -n "$shlibpath_var"; then
 	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-	echo "export $shlibpath_var"
+	$ECHO "export $shlibpath_var"
       fi
       $ECHO "$cmd$args"
       exit $EXIT_SUCCESS
     fi
 }
 
-test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+test "$mode" = execute && func_mode_execute ${1+"$@"}
 
 
-# func_mode_finish arg...
-func_mode_finish ()
-{
-    $opt_debug
-    libs=
-    libdirs=
-    admincmds=
-
-    for opt in "$nonopt" ${1+"$@"}
-    do
-      if test -d "$opt"; then
-	func_append libdirs " $opt"
-
-      elif test -f "$opt"; then
-	if func_lalib_unsafe_p "$opt"; then
-	  func_append libs " $opt"
-	else
-	  func_warning "\`$opt' is not a valid libtool archive"
-	fi
-
-      else
-	func_fatal_error "invalid argument \`$opt'"
-      fi
-    done
-
-    if test -n "$libs"; then
-      if test -n "$lt_sysroot"; then
-        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
-        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
-      else
-        sysroot_cmd=
-      fi
-
-      # Remove sysroot references
-      if $opt_dry_run; then
-        for lib in $libs; do
-          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
-        done
-      else
-        tmpdir=`func_mktempdir`
-        for lib in $libs; do
-	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
-	    > $tmpdir/tmp-la
-	  mv -f $tmpdir/tmp-la $lib
-	done
-        ${RM}r "$tmpdir"
-      fi
-    fi
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libdirs="$nonopt"
+    admincmds=
 
     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
       for libdir in $libdirs; do
 	if test -n "$finish_cmds"; then
 	  # Do each command in the finish commands.
@@ -2705,7 +1786,7 @@ func_mode_finish ()
 	if test -n "$finish_eval"; then
 	  # Do the single finish_eval.
 	  eval cmds=\"$finish_eval\"
-	  $opt_dry_run || eval "$cmds" || func_append admincmds "
+	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
        $cmds"
 	fi
       done
@@ -2714,55 +1795,53 @@ func_mode_finish ()
     # Exit here if they wanted silent mode.
     $opt_silent && exit $EXIT_SUCCESS
 
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      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 "X----------------------------------------------------------------------" | $Xsed
+    $ECHO "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $ECHO "   $libdir"
+    done
+    $ECHO
+    $ECHO "If you ever happen to want to link against installed libraries"
+    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
+    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $ECHO "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $ECHO "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $ECHO "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
 
-      echo "See any operating system documentation about shared libraries for"
-      case $host in
-	solaris2.[6789]|solaris2.1[0-9])
-	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-	  echo "pages."
-	  ;;
-	*)
-	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
-	  ;;
-      esac
-      echo "----------------------------------------------------------------------"
+      $ECHO "   - use the \`$flag' linker flag"
     fi
+    if test -n "$admincmds"; then
+      $ECHO "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $ECHO
+
+    $ECHO "See any operating system documentation about shared libraries for"
+    case $host in
+      solaris2.[6789]|solaris2.1[0-9])
+        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	$ECHO "pages."
+	;;
+      *)
+        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
+        ;;
+    esac
+    $ECHO "X----------------------------------------------------------------------" | $Xsed
     exit $EXIT_SUCCESS
 }
 
-test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+test "$mode" = finish && func_mode_finish ${1+"$@"}
 
 
 # func_mode_install arg...
@@ -2773,7 +1852,7 @@ func_mode_install ()
     # install_prog (especially on Windows NT).
     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
        # Allow the use of GNU shtool's install command.
-       case $nonopt in *shtool*) :;; *) false;; esac; then
+       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
       # Aesthetically quote it.
       func_quote_for_eval "$nonopt"
       install_prog="$func_quote_for_eval_result "
@@ -2787,12 +1866,7 @@ func_mode_install ()
     # The real first argument should be the name of the installation program.
     # Aesthetically quote it.
     func_quote_for_eval "$arg"
-    func_append install_prog "$func_quote_for_eval_result"
-    install_shared_prog=$install_prog
-    case " $install_prog " in
-      *[\\\ /]cp\ *) install_cp=: ;;
-      *) install_cp=false ;;
-    esac
+    install_prog="$install_prog$func_quote_for_eval_result"
 
     # We need to accept at least all the BSD install flags.
     dest=
@@ -2802,12 +1876,10 @@ func_mode_install ()
     install_type=
     isdir=no
     stripme=
-    no_mode=:
     for arg
     do
-      arg2=
       if test -n "$dest"; then
-	func_append files " $dest"
+	files="$files $dest"
 	dest=$arg
 	continue
       fi
@@ -2815,9 +1887,10 @@ func_mode_install ()
       case $arg in
       -d) isdir=yes ;;
       -f)
-	if $install_cp; then :; else
-	  prev=$arg
-	fi
+	case " $install_prog " in
+	*[\\\ /]cp\ *) ;;
+	*) prev=$arg ;;
+	esac
 	;;
       -g | -m | -o)
 	prev=$arg
@@ -2831,10 +1904,6 @@ func_mode_install ()
       *)
 	# If the previous option needed an argument, then skip it.
 	if test -n "$prev"; then
-	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
-	    arg2=$install_override_mode
-	    no_mode=false
-	  fi
 	  prev=
 	else
 	  dest=$arg
@@ -2845,11 +1914,7 @@ func_mode_install ()
 
       # Aesthetically quote the argument.
       func_quote_for_eval "$arg"
-      func_append install_prog " $func_quote_for_eval_result"
-      if test -n "$arg2"; then
-	func_quote_for_eval "$arg2"
-      fi
-      func_append install_shared_prog " $func_quote_for_eval_result"
+      install_prog="$install_prog $func_quote_for_eval_result"
     done
 
     test -z "$install_prog" && \
@@ -2858,13 +1923,6 @@ func_mode_install ()
     test -n "$prev" && \
       func_fatal_help "the \`$prev' option requires an argument"
 
-    if test -n "$install_override_mode" && $no_mode; then
-      if $install_cp; then :; else
-	func_quote_for_eval "$install_override_mode"
-	func_append install_shared_prog " -m $func_quote_for_eval_result"
-      fi
-    fi
-
     if test -z "$files"; then
       if test -z "$dest"; then
 	func_fatal_help "no file or destination specified"
@@ -2919,13 +1977,10 @@ func_mode_install ()
       case $file in
       *.$libext)
 	# Do the static libraries later.
-	func_append staticlibs " $file"
+	staticlibs="$staticlibs $file"
 	;;
 
       *.la)
-	func_resolve_sysroot "$file"
-	file=$func_resolve_sysroot_result
-
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
 	  || func_fatal_help "\`$file' is not a valid libtool archive"
@@ -2939,23 +1994,23 @@ func_mode_install ()
 	if test "X$destdir" = "X$libdir"; then
 	  case "$current_libdirs " in
 	  *" $libdir "*) ;;
-	  *) func_append current_libdirs " $libdir" ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
 	  esac
 	else
 	  # Note the libdir as a future libdir.
 	  case "$future_libdirs " in
 	  *" $libdir "*) ;;
-	  *) func_append future_libdirs " $libdir" ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
 	  esac
 	fi
 
 	func_dirname "$file" "/" ""
 	dir="$func_dirname_result"
-	func_append dir "$objdir"
+	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 -e "s%$libdir\$%%"`
+	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
 
 	  # Don't allow the user to place us outside of our expected
 	  # location b/c this prevents finding dependent libraries that
@@ -2968,9 +2023,9 @@ func_mode_install ()
 
 	  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%"`
+	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 	  else
-	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
 	  fi
 
 	  func_warning "relinking \`$file'"
@@ -2988,7 +2043,7 @@ func_mode_install ()
 	  test -n "$relink_command" && srcname="$realname"T
 
 	  # Install the shared library and build the symlinks.
-	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
 	      'exit $?'
 	  tstripme="$stripme"
 	  case $host_os in
@@ -3028,7 +2083,7 @@ func_mode_install ()
 	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 
 	# Maybe install the static library, too.
-	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
 	;;
 
       *.lo)
@@ -3128,7 +2183,7 @@ func_mode_install ()
 	    if test -f "$lib"; then
 	      func_source "$lib"
 	    fi
-	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
 	    if test -n "$libdir" && test ! -f "$libfile"; then
 	      func_warning "\`$lib' has not been installed in \`$libdir'"
 	      finalize=no
@@ -3147,7 +2202,7 @@ func_mode_install ()
 		file="$func_basename_result"
 	        outputname="$tmpdir/$file"
 	        # Replace the output file specification.
-	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
 
 	        $opt_silent || {
 	          func_quote_for_expand "$relink_command"
@@ -3166,7 +2221,7 @@ func_mode_install ()
 	    }
 	  else
 	    # Install the binary that we compiled earlier.
-	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
 	  fi
 	fi
 
@@ -3202,13 +2257,11 @@ func_mode_install ()
 
       # Set up the ranlib parameters.
       oldlib="$destdir/$name"
-      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
-      tool_oldlib=$func_to_tool_file_result
 
       func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
 
       if test -n "$stripme" && test -n "$old_striplib"; then
-	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+	func_show_eval "$old_striplib $oldlib" 'exit $?'
       fi
 
       # Do each command in the postinstall commands.
@@ -3227,7 +2280,7 @@ func_mode_install ()
     fi
 }
 
-test "$opt_mode" = install && func_mode_install ${1+"$@"}
+test "$mode" = install && func_mode_install ${1+"$@"}
 
 
 # func_generate_dlsyms outputname originator pic_p
@@ -3270,22 +2323,6 @@ func_generate_dlsyms ()
 extern \"C\" {
 #endif
 
-#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
-#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
-#endif
-
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT_DLSYM_CONST
-#else
-# define LT_DLSYM_CONST const
-#endif
-
 /* External symbol declarations for the compiler. */\
 "
 
@@ -3295,11 +2332,10 @@ extern \"C\" {
 	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 
 	  # Add our own program objects to the symbol list.
-	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 	  for progfile in $progfiles; do
-	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
-	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
-	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+	    func_verbose "extracting global C symbols from \`$progfile'"
+	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
 	  done
 
 	  if test -n "$exclude_expsyms"; then
@@ -3335,7 +2371,7 @@ extern \"C\" {
 	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 	      eval '$MV "$nlist"T "$nlist"'
 	      case $host in
-	        *cygwin* | *mingw* | *cegcc* )
+	        *cygwin | *mingw* | *cegcc* )
 	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 	          ;;
@@ -3348,52 +2384,10 @@ extern \"C\" {
 	  func_verbose "extracting global C symbols from \`$dlprefile'"
 	  func_basename "$dlprefile"
 	  name="$func_basename_result"
-          case $host in
-	    *cygwin* | *mingw* | *cegcc* )
-	      # if an import library, we need to obtain dlname
-	      if func_win32_import_lib_p "$dlprefile"; then
-	        func_tr_sh "$dlprefile"
-	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
-	        dlprefile_dlbasename=""
-	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
-	          # Use subshell, to avoid clobbering current variable values
-	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
-	          if test -n "$dlprefile_dlname" ; then
-	            func_basename "$dlprefile_dlname"
-	            dlprefile_dlbasename="$func_basename_result"
-	          else
-	            # no lafile. user explicitly requested -dlpreopen <import library>.
-	            $sharedlib_from_linklib_cmd "$dlprefile"
-	            dlprefile_dlbasename=$sharedlib_from_linklib_result
-	          fi
-	        fi
-	        $opt_dry_run || {
-	          if test -n "$dlprefile_dlbasename" ; then
-	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
-	          else
-	            func_warning "Could not compute DLL name from $name"
-	            eval '$ECHO ": $name " >> "$nlist"'
-	          fi
-	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
-	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
-	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
-	        }
-	      else # not an import lib
-	        $opt_dry_run || {
-	          eval '$ECHO ": $name " >> "$nlist"'
-	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
-	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	        }
-	      fi
-	    ;;
-	    *)
-	      $opt_dry_run || {
-	        eval '$ECHO ": $name " >> "$nlist"'
-	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
-	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
-	      }
-	    ;;
-          esac
+	  $opt_dry_run || {
+	    eval '$ECHO ": $name " >> "$nlist"'
+	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	  }
 	done
 
 	$opt_dry_run || {
@@ -3421,19 +2415,36 @@ extern \"C\" {
 	  if test -f "$nlist"S; then
 	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
 	  else
-	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
 	  fi
 
-	  echo >> "$output_objdir/$my_dlsyms" "\
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
 
 /* The mapping between symbol names and symbols.  */
 typedef struct {
   const char *name;
   void *address;
 } lt_dlsymlist;
-extern LT_DLSYM_CONST lt_dlsymlist
+"
+	  case $host in
+	  *cygwin* | *mingw* | *cegcc* )
+	    $ECHO >> "$output_objdir/$my_dlsyms" "\
+/* DATA imports from DLLs on WIN32 con't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs.  */"
+	    lt_dlsym_const= ;;
+	  *osf5*)
+	    echo >> "$output_objdir/$my_dlsyms" "\
+/* This system does not cope well with relocations in const data */"
+	    lt_dlsym_const= ;;
+	  *)
+	    lt_dlsym_const=const ;;
+	  esac
+
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+extern $lt_dlsym_const lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[];
-LT_DLSYM_CONST lt_dlsymlist
+$lt_dlsym_const lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[] =
 {\
   { \"$my_originator\", (void *) 0 },"
@@ -3446,7 +2457,7 @@ lt_${my_prefix}_LTX_preloaded_symbols[] =
 	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
 	    ;;
 	  esac
-	  echo >> "$output_objdir/$my_dlsyms" "\
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
   {0, (void *) 0}
 };
 
@@ -3473,7 +2484,7 @@ static const void *lt_preloaded_setup() {
 	  # 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*)
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
 	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
 	  *-*-hpux*)
 	    pic_flag_for_symtable=" $pic_flag"  ;;
@@ -3489,7 +2500,7 @@ static const void *lt_preloaded_setup() {
 	for arg in $LTCFLAGS; do
 	  case $arg in
 	  -pie | -fpie | -fPIE) ;;
-	  *) func_append symtab_cflags " $arg" ;;
+	  *) symtab_cflags="$symtab_cflags $arg" ;;
 	  esac
 	done
 
@@ -3504,16 +2515,16 @@ static const void *lt_preloaded_setup() {
 	case $host in
 	*cygwin* | *mingw* | *cegcc* )
 	  if test -f "$output_objdir/$my_outputname.def"; then
-	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
 	  else
-	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
-	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
 	  fi
 	  ;;
 	*)
-	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
-	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
 	  ;;
 	esac
 	;;
@@ -3527,8 +2538,8 @@ static const void *lt_preloaded_setup() {
       # really was required.
 
       # Nullify the symbol file.
-      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
-      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
     fi
 }
 
@@ -3538,7 +2549,6 @@ static const void *lt_preloaded_setup() {
 # 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.
-# Despite the name, also deal with 64 bit binaries.
 func_win32_libid ()
 {
   $opt_debug
@@ -3549,11 +2559,9 @@ func_win32_libid ()
     win32_libid_type="x86 archive import"
     ;;
   *ar\ archive*) # could be an import, or static
-    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
-       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
-      func_to_tool_file "$1" func_convert_file_msys_to_w32
-      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 |
 	$SED -n -e '
 	    1,100{
 		/ I /{
@@ -3582,131 +2590,6 @@ func_win32_libid ()
   $ECHO "$win32_libid_type"
 }
 
-# func_cygming_dll_for_implib ARG
-#
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-# Invoked by eval'ing the libtool variable
-#    $sharedlib_from_linklib_cmd
-# Result is available in the variable
-#    $sharedlib_from_linklib_result
-func_cygming_dll_for_implib ()
-{
-  $opt_debug
-  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
-}
-
-# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
-#
-# The is the core of a fallback implementation of a
-# platform-specific function to extract the name of the
-# DLL associated with the specified import library LIBNAME.
-#
-# SECTION_NAME is either .idata$6 or .idata$7, depending
-# on the platform and compiler that created the implib.
-#
-# Echos the name of the DLL associated with the
-# specified import library.
-func_cygming_dll_for_implib_fallback_core ()
-{
-  $opt_debug
-  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
-  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
-    $SED '/^Contents of section '"$match_literal"':/{
-      # Place marker at beginning of archive member dllname section
-      s/.*/====MARK====/
-      p
-      d
-    }
-    # These lines can sometimes be longer than 43 characters, but
-    # are always uninteresting
-    /:[	 ]*file format pe[i]\{,1\}-/d
-    /^In archive [^:]*:/d
-    # Ensure marker is printed
-    /^====MARK====/p
-    # Remove all lines with less than 43 characters
-    /^.\{43\}/!d
-    # From remaining lines, remove first 43 characters
-    s/^.\{43\}//' |
-    $SED -n '
-      # Join marker and all lines until next marker into a single line
-      /^====MARK====/ b para
-      H
-      $ b para
-      b
-      :para
-      x
-      s/\n//g
-      # Remove the marker
-      s/^====MARK====//
-      # Remove trailing dots and whitespace
-      s/[\. \t]*$//
-      # Print
-      /./p' |
-    # we now have a list, one entry per line, of the stringified
-    # contents of the appropriate section of all members of the
-    # archive which possess that section. Heuristic: eliminate
-    # all those which have a first or second character that is
-    # a '.' (that is, objdump's representation of an unprintable
-    # character.) This should work for all archives with less than
-    # 0x302f exports -- but will fail for DLLs whose name actually
-    # begins with a literal '.' or a single character followed by
-    # a '.'.
-    #
-    # Of those that remain, print the first one.
-    $SED -e '/^\./d;/^.\./d;q'
-}
-
-# func_cygming_gnu_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is a GNU/binutils-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_gnu_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
-  test -n "$func_cygming_gnu_implib_tmp"
-}
-
-# func_cygming_ms_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is an MS-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_ms_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
-  test -n "$func_cygming_ms_implib_tmp"
-}
-
-# func_cygming_dll_for_implib_fallback ARG
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-#
-# This fallback implementation is for use when $DLLTOOL
-# does not support the --identify-strict option.
-# Invoked by eval'ing the libtool variable
-#    $sharedlib_from_linklib_cmd
-# Result is available in the variable
-#    $sharedlib_from_linklib_result
-func_cygming_dll_for_implib_fallback ()
-{
-  $opt_debug
-  if func_cygming_gnu_implib_p "$1" ; then
-    # binutils import library
-    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
-  elif func_cygming_ms_implib_p "$1" ; then
-    # ms-generated import library
-    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
-  else
-    # unknown
-    sharedlib_from_linklib_result=""
-  fi
-}
 
 
 # func_extract_an_archive dir oldlib
@@ -3715,18 +2598,7 @@ func_extract_an_archive ()
     $opt_debug
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
-    if test "$lock_old_archive_extraction" = yes; then
-      lockfile=$f_ex_an_ar_oldlib.lock
-      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
-	func_echo "Waiting for $lockfile to be removed"
-	sleep 2
-      done
-    fi
-    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
-		   'stat=$?; rm -f "$lockfile"; exit $stat'
-    if test "$lock_old_archive_extraction" = yes; then
-      $opt_dry_run || rm -f "$lockfile"
-    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
      :
     else
@@ -3797,7 +2669,7 @@ func_extract_archives ()
 	    darwin_file=
 	    darwin_files=
 	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
 	      $LIPO -create -output "$darwin_file" $darwin_files
 	    done # $darwin_filelist
 	    $RM -rf unfat-$$
@@ -3812,30 +2684,25 @@ func_extract_archives ()
         func_extract_an_archive "$my_xdir" "$my_xabs"
 	;;
       esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
     done
 
     func_extract_archives_result="$my_oldobjs"
 }
 
 
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
+
+# func_emit_wrapper_part1 [arg=no]
 #
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory.  This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
+# Emit the first part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part1 ()
 {
-	func_emit_wrapper_arg1=${1-no}
+	func_emit_wrapper_part1_arg1=no
+	if test -n "$1" ; then
+	  func_emit_wrapper_part1_arg1=$1
+	fi
 
 	$ECHO "\
 #! $SHELL
@@ -3851,6 +2718,7 @@ func_emit_wrapper ()
 
 # Sed substitution that helps us do robust quoting.  It backslashifies
 # metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
 sed_quote_subst='$sed_quote_subst'
 
 # Be Bourne compatible
@@ -3881,135 +2749,31 @@ if test \"\$libtool_install_magic\" = \"$magic\"; then
 else
   # When we are sourced in execute mode, \$file and \$ECHO are already set.
   if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    file=\"\$0\""
-
-    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
-    $ECHO "\
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$1
-_LTECHO_EOF'
-}
-    ECHO=\"$qECHO\"
-  fi
-
-# Very basic option parsing. These options are (a) specific to
-# the libtool wrapper, (b) are identical between the wrapper
-# /script/ and the wrapper /executable/ which is used only on
-# windows platforms, and (c) all begin with the string "--lt-"
-# (application programs are unlikely to have options which match
-# this pattern).
-#
-# There are only two supported options: --lt-debug and
-# --lt-dump-script. There is, deliberately, no --lt-help.
-#
-# The first argument to this parsing function should be the
-# script's $0 value, followed by "$@".
-lt_option_debug=
-func_parse_lt_options ()
-{
-  lt_script_arg0=\$0
-  shift
-  for lt_opt
-  do
-    case \"\$lt_opt\" in
-    --lt-debug) lt_option_debug=1 ;;
-    --lt-dump-script)
-        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
-        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
-        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
-        cat \"\$lt_dump_D/\$lt_dump_F\"
-        exit 0
-      ;;
-    --lt-*)
-        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
-        exit 1
-      ;;
-    esac
-  done
-
-  # Print the debug banner immediately:
-  if test -n \"\$lt_option_debug\"; then
-    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
-  fi
-}
-
-# Used when --lt-debug. Prints its arguments to stdout
-# (redirection is the responsibility of the caller)
-func_lt_dump_args ()
-{
-  lt_dump_args_N=1;
-  for lt_arg
-  do
-    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
-    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
-  done
-}
-
-# Core function for launching the target application
-func_exec_program_core ()
-{
-"
-  case $host in
-  # Backslashes separate directories on plain windows
-  *-*-mingw | *-*-os2* | *-cegcc*)
-    $ECHO "\
-      if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
-        func_lt_dump_args \${1+\"\$@\"} 1>&2
-      fi
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-    ;;
-
-  *)
-    $ECHO "\
-      if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
-        func_lt_dump_args \${1+\"\$@\"} 1>&2
-      fi
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
-    ;;
-  esac
-  $ECHO "\
-      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
-      exit 1
-}
-
-# A function to encapsulate launching the target application
-# Strips options in the --lt-* namespace from \$@ and
-# launches target application with the remaining arguments.
-func_exec_program ()
-{
-  case \" \$* \" in
-  *\\ --lt-*)
-    for lt_wr_arg
-    do
-      case \$lt_wr_arg in
-      --lt-*) ;;
-      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
-      esac
+    ECHO=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
       shift
-    done ;;
-  esac
-  func_exec_program_core \${1+\"\$@\"}
-}
-
-  # Parse options
-  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$ECHO works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$ECHO will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$ECHO "\
 
   # Find the directory that this script lives in.
-  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+  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'\`
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
   while test -n \"\$file\"; do
-    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
 
     # If there was a directory component, then change thisdir.
     if test \"x\$destdir\" != \"x\$file\"; then
@@ -4019,13 +2783,30 @@ func_exec_program ()
       esac
     fi
 
-    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
   done
+"
+}
+# end: func_emit_wrapper_part1
+
+# func_emit_wrapper_part2 [arg=no]
+#
+# Emit the second part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part2 ()
+{
+	func_emit_wrapper_part2_arg1=no
+	if test -n "$1" ; then
+	  func_emit_wrapper_part2_arg1=$1
+	fi
+
+	$ECHO "\
 
   # Usually 'no', except on cygwin/mingw when embedded into
   # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
     # special case for '.'
     if test \"\$thisdir\" = \".\"; then
@@ -4033,7 +2814,7 @@ func_exec_program ()
     fi
     # remove .libs from thisdir
     case \"\$thisdir\" in
-    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
     $objdir )   thisdir=. ;;
     esac
   fi
@@ -4088,18 +2869,6 @@ func_exec_program ()
 
   if test -f \"\$progdir/\$program\"; then"
 
-	# fixup the dll searchpath if we need to.
-	#
-	# Fix the DLL searchpath if we need to.  Do this before prepending
-	# to shlibpath, because on Windows, both are PATH and uninstalled
-	# libraries must come first.
-	if test -n "$dllsearchpath"; then
-	  $ECHO "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-	fi
-
 	# Export our shlibpath_var if we have one.
 	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 	  $ECHO "\
@@ -4108,28 +2877,253 @@ func_exec_program ()
 
     # 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 \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
 
     export $shlibpath_var
 "
 	fi
 
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
 	$ECHO "\
     if test \"\$libtool_execute_magic\" != \"$magic\"; then
       # Run the actual program with our arguments.
-      func_exec_program \${1+\"\$@\"}
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2* | *-cegcc*)
+	  $ECHO "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $ECHO "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
     fi
   else
     # The program doesn't exist.
     \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
-    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
     exit 1
   fi
 fi\
 "
 }
+# end: func_emit_wrapper_part2
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+	func_emit_wrapper_arg1=no
+	if test -n "$1" ; then
+	  func_emit_wrapper_arg1=$1
+	fi
+
+	# split this up so that func_emit_cwrapperexe_src
+	# can call each part independently.
+	func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
+	func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
+}
+
+
+# func_to_host_path arg
+#
+# Convert paths to host format when used with build tools.
+# Intended for use with "native" mingw (where libtool itself
+# is running under the msys shell), or in the following cross-
+# build environments:
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+# where wine is equipped with the `winepath' executable.
+# In the native mingw case, the (msys) shell automatically
+# converts paths for any non-msys applications it launches,
+# but that facility isn't available from inside the cwrapper.
+# Similar accommodations are necessary for $host mingw and
+# $build cygwin.  Calling this function does no harm for other
+# $host/$build combinations not listed above.
+#
+# ARG is the path (on $build) that should be converted to
+# the proper representation for $host. The result is stored
+# in $func_to_host_path_result.
+func_to_host_path ()
+{
+  func_to_host_path_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        case $build in
+          *mingw* ) # actually, msys
+            # awkward: cmd appends spaces to result
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_path_tmp1=`cygpath -w "$1"`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # Unfortunately, winepath does not exit with a non-zero
+            # error code, so we are forced to check the contents of
+            # stdout. On the other hand, if the command is not
+            # found, the shell will set an exit code of 127 and print
+            # *an error message* to stdout. So we must check for both
+            # error code of zero AND non-empty stdout, which explains
+            # the odd construction:
+            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
+            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
+              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+                $SED -e "$lt_sed_naive_backslashify"`
+            else
+              # Allow warning below.
+              func_to_host_path_result=""
+            fi
+            ;;
+        esac
+        if test -z "$func_to_host_path_result" ; then
+          func_error "Could not determine host path corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback:
+          func_to_host_path_result="$1"
+        fi
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_path
 
+# func_to_host_pathlist arg
+#
+# Convert pathlists to host format when used with build tools.
+# See func_to_host_path(), above. This function supports the
+# following $build/$host combinations (but does no harm for
+# combinations not listed here):
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+#
+# Path separators are also converted from $build format to
+# $host format. If ARG begins or ends with a path separator
+# character, it is preserved (but converted to $host format)
+# on output.
+#
+# ARG is a pathlist (on $build) that should be converted to
+# the proper representation on $host. The result is stored
+# in $func_to_host_pathlist_result.
+func_to_host_pathlist ()
+{
+  func_to_host_pathlist_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        # Remove leading and trailing path separator characters from
+        # ARG. msys behavior is inconsistent here, cygpath turns them
+        # into '.;' and ';.', and winepath ignores them completely.
+        func_to_host_pathlist_tmp2="$1"
+        # Once set for this call, this variable should not be
+        # reassigned. It is used in tha fallback case.
+        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
+          $SED -e 's|^:*||' -e 's|:*$||'`
+        case $build in
+          *mingw* ) # Actually, msys.
+            # Awkward: cmd appends spaces to result.
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # unfortunately, winepath doesn't convert pathlists
+            func_to_host_pathlist_result=""
+            func_to_host_pathlist_oldIFS=$IFS
+            IFS=:
+            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
+              IFS=$func_to_host_pathlist_oldIFS
+              if test -n "$func_to_host_pathlist_f" ; then
+                func_to_host_path "$func_to_host_pathlist_f"
+                if test -n "$func_to_host_path_result" ; then
+                  if test -z "$func_to_host_pathlist_result" ; then
+                    func_to_host_pathlist_result="$func_to_host_path_result"
+                  else
+                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+                  fi
+                fi
+              fi
+              IFS=:
+            done
+            IFS=$func_to_host_pathlist_oldIFS
+            ;;
+        esac
+        if test -z "$func_to_host_pathlist_result" ; then
+          func_error "Could not determine the host path(s) corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback. This may break if $1 contains DOS-style drive
+          # specifications. The fix is not to complicate the expression
+          # below, but for the user to provide a working wine installation
+          # with winepath so that path translation in the cross-to-mingw
+          # case works properly.
+          lt_replace_pathsep_nix_to_dos="s|:|;|g"
+          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
+            $SED -e "$lt_replace_pathsep_nix_to_dos"`
+        fi
+        # Now, add the leading and trailing path separators back
+        case "$1" in
+          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
+            ;;
+        esac
+        case "$1" in
+          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+            ;;
+        esac
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_pathlist
 
 # func_emit_cwrapperexe_src
 # emit the source code for a wrapper executable on stdout
@@ -4147,23 +3141,31 @@ func_emit_cwrapperexe_src ()
 
    This wrapper executable should never be moved out of the build directory.
    If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "$SHELL $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
 */
 EOF
 	    cat <<"EOF"
-#ifdef _MSC_VER
-# define _CRT_SECURE_NO_DEPRECATE 1
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #ifdef _MSC_VER
 # include <direct.h>
 # include <process.h>
 # include <io.h>
+# define setmode _setmode
 #else
 # include <unistd.h>
 # include <stdint.h>
 # ifdef __CYGWIN__
 #  include <io.h>
+#  define HAVE_SETENV
+#  ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+#  endif
 # endif
 #endif
 #include <malloc.h>
@@ -4175,44 +3177,6 @@ EOF
 #include <fcntl.h>
 #include <sys/stat.h>
 
-/* declarations of non-ANSI functions */
-#if defined(__MINGW32__)
-# ifdef __STRICT_ANSI__
-int _putenv (const char *);
-# endif
-#elif defined(__CYGWIN__)
-# ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-# endif
-/* #elif defined (other platforms) ... */
-#endif
-
-/* portability defines, excluding path handling macros */
-#if defined(_MSC_VER)
-# define setmode _setmode
-# define stat    _stat
-# define chmod   _chmod
-# define getcwd  _getcwd
-# define putenv  _putenv
-# define S_IXUSR _S_IEXEC
-# ifndef _INTPTR_T_DEFINED
-#  define _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#elif defined(__MINGW32__)
-# define setmode _setmode
-# define stat    _stat
-# define chmod   _chmod
-# define getcwd  _getcwd
-# define putenv  _putenv
-#elif defined(__CYGWIN__)
-# define HAVE_SETENV
-# define FOPEN_WB "wb"
-/* #elif defined (other platforms) ... */
-#endif
-
 #if defined(PATH_MAX)
 # define LT_PATHMAX PATH_MAX
 #elif defined(MAXPATHLEN)
@@ -4228,7 +3192,14 @@ int setenv (const char *, const char *, int);
 # define S_IXGRP 0
 #endif
 
-/* path handling portability macros */
+#ifdef _MSC_VER
+# define S_IXUSR _S_IEXEC
+# define stat _stat
+# ifndef _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#endif
+
 #ifndef DIR_SEPARATOR
 # define DIR_SEPARATOR '/'
 # define PATH_SEPARATOR ':'
@@ -4259,6 +3230,10 @@ int setenv (const char *, const char *, int);
 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 #endif /* PATH_SEPARATOR_2 */
 
+#ifdef __CYGWIN__
+# define FOPEN_WB "wb"
+#endif
+
 #ifndef FOPEN_WB
 # define FOPEN_WB "w"
 #endif
@@ -4271,13 +3246,22 @@ int setenv (const char *, const char *, int);
   if (stale) { free ((void *) stale); stale = 0; } \
 } while (0)
 
-#if defined(LT_DEBUGWRAPPER)
-static int lt_debug = 1;
+#undef LTWRAPPER_DEBUGPRINTF
+#if defined DEBUGWRAPPER
+# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
+static void
+ltwrapper_debugprintf (const char *fmt, ...)
+{
+    va_list args;
+    va_start (args, fmt);
+    (void) vfprintf (stderr, fmt, args);
+    va_end (args);
+}
 #else
-static int lt_debug = 0;
+# define LTWRAPPER_DEBUGPRINTF(args)
 #endif
 
-const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+const char *program_name = NULL;
 
 void *xmalloc (size_t num);
 char *xstrdup (const char *string);
@@ -4287,27 +3271,41 @@ char *chase_symlinks (const char *pathspec);
 int make_executable (const char *path);
 int check_executable (const char *path);
 char *strendzap (char *str, const char *pat);
-void lt_debugprintf (const char *file, int line, const char *fmt, ...);
-void lt_fatal (const char *file, int line, const char *message, ...);
-static const char *nonnull (const char *s);
-static const char *nonempty (const char *s);
+void lt_fatal (const char *message, ...);
 void lt_setenv (const char *name, const char *value);
 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_opt_process_env_set (const char *arg);
+void lt_opt_process_env_prepend (const char *arg);
+void lt_opt_process_env_append (const char *arg);
+int lt_split_name_value (const char *arg, char** name, char** value);
 void lt_update_exe_path (const char *name, const char *value);
 void lt_update_lib_path (const char *name, const char *value);
-char **prepare_spawn (char **argv);
-void lt_dump_script (FILE *f);
+
+static const char *script_text_part1 =
+EOF
+
+	    func_emit_wrapper_part1 yes |
+	        $SED -e 's/\([\\"]\)/\\\1/g' \
+	             -e 's/^/  "/' -e 's/$/\\n"/'
+	    echo ";"
+	    cat <<EOF
+
+static const char *script_text_part2 =
 EOF
+	    func_emit_wrapper_part2 yes |
+	        $SED -e 's/\([\\"]\)/\\\1/g' \
+	             -e 's/^/  "/' -e 's/$/\\n"/'
+	    echo ";"
 
 	    cat <<EOF
-volatile const char * MAGIC_EXE = "$magic_exe";
+const char * MAGIC_EXE = "$magic_exe";
 const char * LIB_PATH_VARNAME = "$shlibpath_var";
 EOF
 
 	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-              func_to_host_path "$temp_rpath"
+              func_to_host_pathlist "$temp_rpath"
 	      cat <<EOF
-const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
+const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
 EOF
 	    else
 	      cat <<"EOF"
@@ -4316,10 +3314,10 @@ EOF
 	    fi
 
 	    if test -n "$dllsearchpath"; then
-              func_to_host_path "$dllsearchpath:"
+              func_to_host_pathlist "$dllsearchpath:"
 	      cat <<EOF
 const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
+const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
 EOF
 	    else
 	      cat <<"EOF"
@@ -4342,10 +3340,24 @@ EOF
 	    cat <<"EOF"
 
 #define LTWRAPPER_OPTION_PREFIX         "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
 
+static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
 static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
-static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
+
+static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
+  /* argument is putenv-style "foo=bar", value of foo is set to bar */
+
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
+  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
+
+static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
+  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
 
 int
 main (int argc, char *argv[])
@@ -4362,13 +3374,10 @@ main (int argc, char *argv[])
   int i;
 
   program_name = (char *) xstrdup (base_name (argv[0]));
-  newargz = XMALLOC (char *, argc + 1);
+  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
+  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
 
-  /* very simple arg parsing; don't want to rely on getopt
-   * also, copy all non cwrapper options to newargz, except
-   * argz[0], which is handled differently
-   */
-  newargc=0;
+  /* very simple arg parsing; don't want to rely on getopt */
   for (i = 1; i < argc; i++)
     {
       if (strcmp (argv[i], dumpscript_opt) == 0)
@@ -4382,57 +3391,25 @@ EOF
 	      esac
 
 	    cat <<"EOF"
-	  lt_dump_script (stdout);
+	  printf ("%s", script_text_part1);
+	  printf ("%s", script_text_part2);
 	  return 0;
 	}
-      if (strcmp (argv[i], debug_opt) == 0)
-	{
-          lt_debug = 1;
-          continue;
-	}
-      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
-        {
-          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
-             namespace, but it is not one of the ones we know about and
-             have already dealt with, above (inluding dump-script), then
-             report an error. Otherwise, targets might begin to believe
-             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
-             namespace. The first time any user complains about this, we'll
-             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
-             or a configure.ac-settable value.
-           */
-          lt_fatal (__FILE__, __LINE__,
-		    "unrecognized %s option: '%s'",
-                    ltwrapper_option_prefix, argv[i]);
-        }
-      /* otherwise ... */
-      newargz[++newargc] = xstrdup (argv[i]);
     }
-  newargz[++newargc] = NULL;
-
-EOF
-	    cat <<EOF
-  /* The GNU banner must be the first non-error debug message */
-  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
-EOF
-	    cat <<"EOF"
-  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
-  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
 
+  newargz = XMALLOC (char *, argc + 1);
   tmp_pathspec = find_executable (argv[0]);
   if (tmp_pathspec == NULL)
-    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
-  lt_debugprintf (__FILE__, __LINE__,
-                  "(main) found exe (before symlink chase) at: %s\n",
-		  tmp_pathspec);
+    lt_fatal ("Couldn't find %s", argv[0]);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
+			  tmp_pathspec));
 
   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
-  lt_debugprintf (__FILE__, __LINE__,
-                  "(main) found exe (after symlink chase) at: %s\n",
-		  actual_cwrapper_path);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
+			  actual_cwrapper_path));
   XFREE (tmp_pathspec);
 
-  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
   strendzap (actual_cwrapper_path, actual_cwrapper_name);
 
   /* wrapper name transforms */
@@ -4450,9 +3427,8 @@ EOF
   target_name = tmp_pathspec;
   tmp_pathspec = 0;
 
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(main) libtool target name: %s\n",
-		  target_name);
+  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
+			  target_name));
 EOF
 
 	    cat <<EOF
@@ -4502,19 +3478,80 @@ EOF
 
   lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
   lt_setenv ("DUALCASE", "1");  /* for MSK sh */
-  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
-     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
-     because on Windows, both *_VARNAMEs are PATH but uninstalled
-     libraries must come first. */
-  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
   lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+
+  newargc=0;
+  for (i = 1; i < argc; i++)
+    {
+      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
+        {
+          if (argv[i][env_set_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_set_opt_len + 1;
+              lt_opt_process_env_set (p);
+            }
+          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_set (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_set_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
+        {
+          if (argv[i][env_prepend_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_prepend_opt_len + 1;
+              lt_opt_process_env_prepend (p);
+            }
+          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_prepend_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
+        {
+          if (argv[i][env_append_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_append_opt_len + 1;
+              lt_opt_process_env_append (p);
+            }
+          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_append (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_append_opt);
+          continue;
+        }
+      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal ("Unrecognized option in %s namespace: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
 
-  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
-		  nonnull (lt_argv_zero));
+  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
   for (i = 0; i < newargc; i++)
     {
-      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
-		      i, nonnull (newargz[i]));
+      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
     }
 
 EOF
@@ -4523,14 +3560,11 @@ EOF
 	      mingw*)
 		cat <<"EOF"
   /* execv doesn't actually work on mingw as expected on unix */
-  newargz = prepare_spawn (newargz);
   rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   if (rval == -1)
     {
       /* failed to start process */
-      lt_debugprintf (__FILE__, __LINE__,
-		      "(main) failed to launch target \"%s\": %s\n",
-		      lt_argv_zero, nonnull (strerror (errno)));
+      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
       return 127;
     }
   return rval;
@@ -4552,7 +3586,7 @@ xmalloc (size_t num)
 {
   void *p = (void *) malloc (num);
   if (!p)
-    lt_fatal (__FILE__, __LINE__, "memory exhausted");
+    lt_fatal ("Memory exhausted");
 
   return p;
 }
@@ -4586,8 +3620,8 @@ check_executable (const char *path)
 {
   struct stat st;
 
-  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
-                  nonempty (path));
+  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
+			  path ? (*path ? path : "EMPTY!") : "NULL!"));
   if ((!path) || (!*path))
     return 0;
 
@@ -4604,8 +3638,8 @@ make_executable (const char *path)
   int rval = 0;
   struct stat st;
 
-  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
-                  nonempty (path));
+  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
+			  path ? (*path ? path : "EMPTY!") : "NULL!"));
   if ((!path) || (!*path))
     return 0;
 
@@ -4631,8 +3665,8 @@ find_executable (const char *wrapper)
   int tmp_len;
   char *concat_name;
 
-  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
-                  nonempty (wrapper));
+  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
+			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
 
   if ((wrapper == NULL) || (*wrapper == '\0'))
     return NULL;
@@ -4685,8 +3719,7 @@ find_executable (const char *wrapper)
 		{
 		  /* empty path: current directory */
 		  if (getcwd (tmp, LT_PATHMAX) == NULL)
-		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
-                              nonnull (strerror (errno)));
+		    lt_fatal ("getcwd failed");
 		  tmp_len = strlen (tmp);
 		  concat_name =
 		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
@@ -4711,8 +3744,7 @@ find_executable (const char *wrapper)
     }
   /* Relative path | not found in path: prepend cwd */
   if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
-              nonnull (strerror (errno)));
+    lt_fatal ("getcwd failed");
   tmp_len = strlen (tmp);
   concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
   memcpy (concat_name, tmp, tmp_len);
@@ -4738,9 +3770,8 @@ chase_symlinks (const char *pathspec)
   int has_symlinks = 0;
   while (strlen (tmp_pathspec) && !has_symlinks)
     {
-      lt_debugprintf (__FILE__, __LINE__,
-		      "checking path component for symlinks: %s\n",
-		      tmp_pathspec);
+      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
+			      tmp_pathspec));
       if (lstat (tmp_pathspec, &s) == 0)
 	{
 	  if (S_ISLNK (s.st_mode) != 0)
@@ -4762,9 +3793,8 @@ chase_symlinks (const char *pathspec)
 	}
       else
 	{
-	  lt_fatal (__FILE__, __LINE__,
-		    "error accessing file \"%s\": %s",
-		    tmp_pathspec, nonnull (strerror (errno)));
+	  char *errstr = strerror (errno);
+	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
 	}
     }
   XFREE (tmp_pathspec);
@@ -4777,8 +3807,7 @@ chase_symlinks (const char *pathspec)
   tmp_pathspec = realpath (pathspec, buf);
   if (tmp_pathspec == 0)
     {
-      lt_fatal (__FILE__, __LINE__,
-		"could not follow symlinks for %s", pathspec);
+      lt_fatal ("Could not follow symlinks for %s", pathspec);
     }
   return xstrdup (tmp_pathspec);
 #endif
@@ -4804,25 +3833,11 @@ strendzap (char *str, const char *pat)
   return str;
 }
 
-void
-lt_debugprintf (const char *file, int line, const char *fmt, ...)
-{
-  va_list args;
-  if (lt_debug)
-    {
-      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
-      va_start (args, fmt);
-      (void) vfprintf (stderr, fmt, args);
-      va_end (args);
-    }
-}
-
 static void
-lt_error_core (int exit_status, const char *file,
-	       int line, const char *mode,
+lt_error_core (int exit_status, const char *mode,
 	       const char *message, va_list ap)
 {
-  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+  fprintf (stderr, "%s: %s: ", program_name, mode);
   vfprintf (stderr, message, ap);
   fprintf (stderr, ".\n");
 
@@ -4831,32 +3846,20 @@ lt_error_core (int exit_status, const char *file,
 }
 
 void
-lt_fatal (const char *file, int line, const char *message, ...)
+lt_fatal (const char *message, ...)
 {
   va_list ap;
   va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
   va_end (ap);
 }
 
-static const char *
-nonnull (const char *s)
-{
-  return s ? s : "(null)";
-}
-
-static const char *
-nonempty (const char *s)
-{
-  return (s && !*s) ? "(empty)" : nonnull (s);
-}
-
 void
 lt_setenv (const char *name, const char *value)
 {
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(lt_setenv) setting '%s' to '%s'\n",
-                  nonnull (name), nonnull (value));
+  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
   {
 #ifdef HAVE_SETENV
     /* always make a copy, for consistency with !HAVE_SETENV */
@@ -4901,12 +3904,95 @@ lt_extend_str (const char *orig_value, const char *add, int to_end)
   return new_value;
 }
 
+int
+lt_split_name_value (const char *arg, char** name, char** value)
+{
+  const char *p;
+  int len;
+  if (!arg || !*arg)
+    return 1;
+
+  p = strchr (arg, (int)'=');
+
+  if (!p)
+    return 1;
+
+  *value = xstrdup (++p);
+
+  len = strlen (arg) - strlen (*value);
+  *name = XMALLOC (char, len);
+  strncpy (*name, arg, len-1);
+  (*name)[len - 1] = '\0';
+
+  return 0;
+}
+
+void
+lt_opt_process_env_set (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
+    }
+
+  lt_setenv (name, value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_prepend (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 0);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_append (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 1);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
 void
 lt_update_exe_path (const char *name, const char *value)
 {
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
-                  nonnull (name), nonnull (value));
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
 
   if (name && *name && value && *value)
     {
@@ -4925,9 +4011,9 @@ lt_update_exe_path (const char *name, const char *value)
 void
 lt_update_lib_path (const char *name, const char *value)
 {
-  lt_debugprintf (__FILE__, __LINE__,
-		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
-                  nonnull (name), nonnull (value));
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
 
   if (name && *name && value && *value)
     {
@@ -4937,158 +4023,11 @@ lt_update_lib_path (const char *name, const char *value)
     }
 }
 
-EOF
-	    case $host_os in
-	      mingw*)
-		cat <<"EOF"
-
-/* Prepares an argument vector before calling spawn().
-   Note that spawn() does not by itself call the command interpreter
-     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
-      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-         GetVersionEx(&v);
-         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
-      }) ? "cmd.exe" : "command.com").
-   Instead it simply concatenates the arguments, separated by ' ', and calls
-   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
-   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
-   special way:
-   - Space and tab are interpreted as delimiters. They are not treated as
-     delimiters if they are surrounded by double quotes: "...".
-   - Unescaped double quotes are removed from the input. Their only effect is
-     that within double quotes, space and tab are treated like normal
-     characters.
-   - Backslashes not followed by double quotes are not special.
-   - But 2*n+1 backslashes followed by a double quote become
-     n backslashes followed by a double quote (n >= 0):
-       \" -> "
-       \\\" -> \"
-       \\\\\" -> \\"
- */
-#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-char **
-prepare_spawn (char **argv)
-{
-  size_t argc;
-  char **new_argv;
-  size_t i;
-
-  /* Count number of arguments.  */
-  for (argc = 0; argv[argc] != NULL; argc++)
-    ;
-
-  /* Allocate new argument vector.  */
-  new_argv = XMALLOC (char *, argc + 1);
-
-  /* Put quoted arguments into the new argument vector.  */
-  for (i = 0; i < argc; i++)
-    {
-      const char *string = argv[i];
-
-      if (string[0] == '\0')
-	new_argv[i] = xstrdup ("\"\"");
-      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
-	{
-	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
-	  size_t length;
-	  unsigned int backslashes;
-	  const char *s;
-	  char *quoted_string;
-	  char *p;
-
-	  length = 0;
-	  backslashes = 0;
-	  if (quote_around)
-	    length++;
-	  for (s = string; *s != '\0'; s++)
-	    {
-	      char c = *s;
-	      if (c == '"')
-		length += backslashes + 1;
-	      length++;
-	      if (c == '\\')
-		backslashes++;
-	      else
-		backslashes = 0;
-	    }
-	  if (quote_around)
-	    length += backslashes + 1;
-
-	  quoted_string = XMALLOC (char, length + 1);
-
-	  p = quoted_string;
-	  backslashes = 0;
-	  if (quote_around)
-	    *p++ = '"';
-	  for (s = string; *s != '\0'; s++)
-	    {
-	      char c = *s;
-	      if (c == '"')
-		{
-		  unsigned int j;
-		  for (j = backslashes + 1; j > 0; j--)
-		    *p++ = '\\';
-		}
-	      *p++ = c;
-	      if (c == '\\')
-		backslashes++;
-	      else
-		backslashes = 0;
-	    }
-	  if (quote_around)
-	    {
-	      unsigned int j;
-	      for (j = backslashes; j > 0; j--)
-		*p++ = '\\';
-	      *p++ = '"';
-	    }
-	  *p = '\0';
-
-	  new_argv[i] = quoted_string;
-	}
-      else
-	new_argv[i] = (char *) string;
-    }
-  new_argv[argc] = NULL;
-
-  return new_argv;
-}
-EOF
-		;;
-	    esac
 
-            cat <<"EOF"
-void lt_dump_script (FILE* f)
-{
-EOF
-	    func_emit_wrapper yes |
-	      $SED -n -e '
-s/^\(.\{79\}\)\(..*\)/\1\
-\2/
-h
-s/\([\\"]\)/\\\1/g
-s/$/\\n/
-s/\([^\n]*\).*/  fputs ("\1", f);/p
-g
-D'
-            cat <<"EOF"
-}
 EOF
 }
 # end: func_emit_cwrapperexe_src
 
-# func_win32_import_lib_p ARG
-# True if ARG is an import lib, as indicated by $file_magic_cmd
-func_win32_import_lib_p ()
-{
-    $opt_debug
-    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
-    *import*) : ;;
-    *) false ;;
-    esac
-}
-
 # func_mode_link arg...
 func_mode_link ()
 {
@@ -5133,7 +4072,6 @@ func_mode_link ()
     new_inherited_linker_flags=
 
     avoid_version=no
-    bindir=
     dlfiles=
     dlprefiles=
     dlself=no
@@ -5226,11 +4164,6 @@ func_mode_link ()
 	esac
 
 	case $prev in
-	bindir)
-	  bindir="$arg"
-	  prev=
-	  continue
-	  ;;
 	dlfiles|dlprefiles)
 	  if test "$preload" = no; then
 	    # Add the symbol object into the linking commands.
@@ -5262,9 +4195,9 @@ func_mode_link ()
 	    ;;
 	  *)
 	    if test "$prev" = dlfiles; then
-	      func_append dlfiles " $arg"
+	      dlfiles="$dlfiles $arg"
 	    else
-	      func_append dlprefiles " $arg"
+	      dlprefiles="$dlprefiles $arg"
 	    fi
 	    prev=
 	    continue
@@ -5288,7 +4221,7 @@ func_mode_link ()
 	    *-*-darwin*)
 	      case "$deplibs " in
 		*" $qarg.ltframework "*) ;;
-		*) func_append deplibs " $qarg.ltframework" # this is fixed later
+		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
 		   ;;
 	      esac
 	      ;;
@@ -5307,7 +4240,7 @@ func_mode_link ()
 	    moreargs=
 	    for fil in `cat "$save_arg"`
 	    do
-#	      func_append moreargs " $fil"
+#	      moreargs="$moreargs $fil"
 	      arg=$fil
 	      # A libtool-controlled object.
 
@@ -5336,7 +4269,7 @@ func_mode_link ()
 
 		  if test "$prev" = dlfiles; then
 		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		      func_append dlfiles " $pic_object"
+		      dlfiles="$dlfiles $pic_object"
 		      prev=
 		      continue
 		    else
@@ -5348,7 +4281,7 @@ func_mode_link ()
 		  # CHECK ME:  I think I busted this.  -Ossama
 		  if test "$prev" = dlprefiles; then
 		    # Preload the old-style object.
-		    func_append dlprefiles " $pic_object"
+		    dlprefiles="$dlprefiles $pic_object"
 		    prev=
 		  fi
 
@@ -5418,12 +4351,12 @@ func_mode_link ()
 	  if test "$prev" = rpath; then
 	    case "$rpath " in
 	    *" $arg "*) ;;
-	    *) func_append rpath " $arg" ;;
+	    *) rpath="$rpath $arg" ;;
 	    esac
 	  else
 	    case "$xrpath " in
 	    *" $arg "*) ;;
-	    *) func_append xrpath " $arg" ;;
+	    *) xrpath="$xrpath $arg" ;;
 	    esac
 	  fi
 	  prev=
@@ -5435,28 +4368,28 @@ func_mode_link ()
 	  continue
 	  ;;
 	weak)
-	  func_append weak_libs " $arg"
+	  weak_libs="$weak_libs $arg"
 	  prev=
 	  continue
 	  ;;
 	xcclinker)
-	  func_append linker_flags " $qarg"
-	  func_append compiler_flags " $qarg"
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xcompiler)
-	  func_append compiler_flags " $qarg"
+	  compiler_flags="$compiler_flags $qarg"
 	  prev=
 	  func_append compile_command " $qarg"
 	  func_append finalize_command " $qarg"
 	  continue
 	  ;;
 	xlinker)
-	  func_append linker_flags " $qarg"
-	  func_append compiler_flags " $wl$qarg"
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
 	  prev=
 	  func_append compile_command " $wl$qarg"
 	  func_append finalize_command " $wl$qarg"
@@ -5492,11 +4425,6 @@ func_mode_link ()
 	continue
 	;;
 
-      -bindir)
-	prev=bindir
-	continue
-	;;
-
       -dlopen)
 	prev=dlfiles
 	continue
@@ -5547,16 +4475,15 @@ func_mode_link ()
 	;;
 
       -L*)
-	func_stripname "-L" '' "$arg"
-	if test -z "$func_stripname_result"; then
+	func_stripname '-L' '' "$arg"
+	dir=$func_stripname_result
+	if test -z "$dir"; then
 	  if test "$#" -gt 0; then
 	    func_fatal_error "require no space between \`-L' and \`$1'"
 	  else
 	    func_fatal_error "need path for \`-L' option"
 	  fi
 	fi
-	func_resolve_sysroot "$func_stripname_result"
-	dir=$func_resolve_sysroot_result
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
@@ -5568,30 +4495,24 @@ func_mode_link ()
 	  ;;
 	esac
 	case "$deplibs " in
-	*" -L$dir "* | *" $arg "*)
-	  # Will only happen for absolute or sysroot arguments
-	  ;;
+	*" -L$dir "*) ;;
 	*)
-	  # Preserve sysroot, but never include relative directories
-	  case $dir in
-	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
-	    *) func_append deplibs " -L$dir" ;;
-	  esac
-	  func_append lib_search_path " $dir"
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
 	  ;;
 	esac
 	case $host in
 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
 	  case :$dllsearchpath: in
 	  *":$dir:"*) ;;
 	  ::) dllsearchpath=$dir;;
-	  *) func_append dllsearchpath ":$dir";;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
 	  ::) dllsearchpath=$testbindir;;
-	  *) func_append dllsearchpath ":$testbindir";;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -5601,7 +4522,7 @@ func_mode_link ()
       -l*)
 	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
 	    # These systems don't actually have a C or math library (as such)
 	    continue
 	    ;;
@@ -5615,7 +4536,7 @@ func_mode_link ()
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C and math libraries are in the System framework
-	    func_append deplibs " System.ltframework"
+	    deplibs="$deplibs System.ltframework"
 	    continue
 	    ;;
 	  *-*-sco3.2v5* | *-*-sco5v6*)
@@ -5635,7 +4556,7 @@ func_mode_link ()
 	   ;;
 	 esac
 	fi
-	func_append deplibs " $arg"
+	deplibs="$deplibs $arg"
 	continue
 	;;
 
@@ -5647,22 +4568,21 @@ func_mode_link ()
       # Tru64 UNIX uses -model [arg] to determine the layout of C++
       # classes, name mangling, and exception handling.
       # Darwin uses the -arch flag to determine output architecture.
-      -model|-arch|-isysroot|--sysroot)
-	func_append compiler_flags " $arg"
+      -model|-arch|-isysroot)
+	compiler_flags="$compiler_flags $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	prev=xcompiler
 	continue
 	;;
 
-      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
-	func_append compiler_flags " $arg"
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	compiler_flags="$compiler_flags $arg"
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	case "$new_inherited_linker_flags " in
 	    *" $arg "*) ;;
-	    * ) func_append new_inherited_linker_flags " $arg" ;;
+	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
 	esac
 	continue
 	;;
@@ -5729,17 +4649,13 @@ func_mode_link ()
 	# We need an absolute path.
 	case $dir in
 	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	=*)
-	  func_stripname '=' '' "$dir"
-	  dir=$lt_sysroot$func_stripname_result
-	  ;;
 	*)
 	  func_fatal_error "only absolute run-paths are allowed"
 	  ;;
 	esac
 	case "$xrpath " in
 	*" $dir "*) ;;
-	*) func_append xrpath " $dir" ;;
+	*) xrpath="$xrpath $dir" ;;
 	esac
 	continue
 	;;
@@ -5792,8 +4708,8 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  func_append arg " $func_quote_for_eval_result"
-	  func_append compiler_flags " $func_quote_for_eval_result"
+	  arg="$arg $wl$func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -5808,9 +4724,9 @@ func_mode_link ()
 	for flag in $args; do
 	  IFS="$save_ifs"
           func_quote_for_eval "$flag"
-	  func_append arg " $wl$func_quote_for_eval_result"
-	  func_append compiler_flags " $wl$func_quote_for_eval_result"
-	  func_append linker_flags " $func_quote_for_eval_result"
+	  arg="$arg $wl$func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
+	  linker_flags="$linker_flags $func_quote_for_eval_result"
 	done
 	IFS="$save_ifs"
 	func_stripname ' ' '' "$arg"
@@ -5838,27 +4754,23 @@ func_mode_link ()
 	arg="$func_quote_for_eval_result"
 	;;
 
-      # Flags to be passed through unchanged, with rationale:
-      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
-      # -r[0-9][0-9]*        specify processor for the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
-      # +DA*, +DD*           enable 64-bit mode for the HP compiler
-      # -q*                  compiler args for the IBM compiler
-      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
-      # -F/path              path to uninstalled frameworks, gcc on darwin
-      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
-      # @file                GCC response files
-      # -tp=*                Portland pgcc target processor selection
-      # --sysroot=*          for sysroot support
-      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # @file GCC response files
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
         func_quote_for_eval "$arg"
 	arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
         func_append finalize_command " $arg"
-        func_append compiler_flags " $arg"
+        compiler_flags="$compiler_flags $arg"
         continue
         ;;
 
@@ -5870,7 +4782,7 @@ func_mode_link ()
 
       *.$objext)
 	# A standard object.
-	func_append objs " $arg"
+	objs="$objs $arg"
 	;;
 
       *.lo)
@@ -5901,7 +4813,7 @@ func_mode_link ()
 
 	    if test "$prev" = dlfiles; then
 	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		func_append dlfiles " $pic_object"
+		dlfiles="$dlfiles $pic_object"
 		prev=
 		continue
 	      else
@@ -5913,7 +4825,7 @@ func_mode_link ()
 	    # CHECK ME:  I think I busted this.  -Ossama
 	    if test "$prev" = dlprefiles; then
 	      # Preload the old-style object.
-	      func_append dlprefiles " $pic_object"
+	      dlprefiles="$dlprefiles $pic_object"
 	      prev=
 	    fi
 
@@ -5958,25 +4870,24 @@ func_mode_link ()
 
       *.$libext)
 	# An archive.
-	func_append deplibs " $arg"
-	func_append old_deplibs " $arg"
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
 	continue
 	;;
 
       *.la)
 	# A libtool-controlled library.
 
-	func_resolve_sysroot "$arg"
 	if test "$prev" = dlfiles; then
 	  # This library was specified with -dlopen.
-	  func_append dlfiles " $func_resolve_sysroot_result"
+	  dlfiles="$dlfiles $arg"
 	  prev=
 	elif test "$prev" = dlprefiles; then
 	  # The library was specified with -dlpreopen.
-	  func_append dlprefiles " $func_resolve_sysroot_result"
+	  dlprefiles="$dlprefiles $arg"
 	  prev=
 	else
-	  func_append deplibs " $func_resolve_sysroot_result"
+	  deplibs="$deplibs $arg"
 	fi
 	continue
 	;;
@@ -6014,7 +4925,7 @@ func_mode_link ()
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
     else
       shlib_search_path=
     fi
@@ -6023,8 +4934,6 @@ func_mode_link ()
 
     func_dirname "$output" "/" ""
     output_objdir="$func_dirname_result$objdir"
-    func_to_tool_file "$output_objdir/"
-    tool_output_objdir=$func_to_tool_file_result
     # Create the object directory.
     func_mkdir_p "$output_objdir"
 
@@ -6045,12 +4954,12 @@ func_mode_link ()
     # Find all interdependent deplibs by searching for libraries
     # that are linked more than once (e.g. -la -lb -la)
     for deplib in $deplibs; do
-      if $opt_preserve_dup_deps ; then
+      if $opt_duplicate_deps ; then
 	case "$libs " in
-	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 	esac
       fi
-      func_append libs " $deplib"
+      libs="$libs $deplib"
     done
 
     if test "$linkmode" = lib; then
@@ -6063,9 +4972,9 @@ func_mode_link ()
       if $opt_duplicate_compiler_generated_deps; then
 	for pre_post_dep in $predeps $postdeps; do
 	  case "$pre_post_deps " in
-	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
 	  esac
-	  func_append pre_post_deps " $pre_post_dep"
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
 	done
       fi
       pre_post_deps=
@@ -6132,19 +5041,17 @@ func_mode_link ()
 	for lib in $dlprefiles; do
 	  # Ignore non-libtool-libs
 	  dependency_libs=
-	  func_resolve_sysroot "$lib"
 	  case $lib in
-	  *.la)	func_source "$func_resolve_sysroot_result" ;;
+	  *.la)	func_source "$lib" ;;
 	  esac
 
 	  # Collect preopened libtool deplibs, except any this library
 	  # has declared as weak libs
 	  for deplib in $dependency_libs; do
-	    func_basename "$deplib"
-            deplib_base=$func_basename_result
+            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
 	    case " $weak_libs " in
 	    *" $deplib_base "*) ;;
-	    *) func_append deplibs " $deplib" ;;
+	    *) deplibs="$deplibs $deplib" ;;
 	    esac
 	  done
 	done
@@ -6160,17 +5067,16 @@ func_mode_link ()
 	lib=
 	found=no
 	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
 	  if test "$linkmode,$pass" = "prog,link"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
 	  else
-	    func_append compiler_flags " $deplib"
+	    compiler_flags="$compiler_flags $deplib"
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -6255,7 +5161,7 @@ func_mode_link ()
 	    if test "$linkmode" = lib ; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
-		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
 		esac
 	    fi
 	  fi
@@ -6268,8 +5174,7 @@ func_mode_link ()
 	    test "$pass" = conv && continue
 	    newdependency_libs="$deplib $newdependency_libs"
 	    func_stripname '-L' '' "$deplib"
-	    func_resolve_sysroot "$func_stripname_result"
-	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
 	    ;;
 	  prog)
 	    if test "$pass" = conv; then
@@ -6283,8 +5188,7 @@ func_mode_link ()
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    fi
 	    func_stripname '-L' '' "$deplib"
-	    func_resolve_sysroot "$func_stripname_result"
-	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
 	    ;;
 	  *)
 	    func_warning "\`-L' is ignored for archives/objects"
@@ -6295,21 +5199,17 @@ func_mode_link ()
 	-R*)
 	  if test "$pass" = link; then
 	    func_stripname '-R' '' "$deplib"
-	    func_resolve_sysroot "$func_stripname_result"
-	    dir=$func_resolve_sysroot_result
+	    dir=$func_stripname_result
 	    # Make sure the xrpath contains only unique directories.
 	    case "$xrpath " in
 	    *" $dir "*) ;;
-	    *) func_append xrpath " $dir" ;;
+	    *) xrpath="$xrpath $dir" ;;
 	    esac
 	  fi
 	  deplibs="$deplib $deplibs"
 	  continue
 	  ;;
-	*.la)
-	  func_resolve_sysroot "$deplib"
-	  lib=$func_resolve_sysroot_result
-	  ;;
+	*.la) lib="$deplib" ;;
 	*.$libext)
 	  if test "$pass" = conv; then
 	    deplibs="$deplib $deplibs"
@@ -6327,7 +5227,7 @@ func_mode_link ()
 		match_pattern*)
 		  set dummy $deplibs_check_method; shift
 		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
 		    | $EGREP "$match_pattern_regex" > /dev/null; then
 		    valid_a_lib=yes
 		  fi
@@ -6337,15 +5237,15 @@ func_mode_link ()
 		;;
 	      esac
 	      if test "$valid_a_lib" != yes; then
-		echo
+		$ECHO
 		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
-		echo "*** I have the capability to make that library automatically link in when"
-		echo "*** you link to this library.  But I can only do this if you have a"
-		echo "*** shared version of the library, which you do not appear to have"
-		echo "*** because the file extensions .$libext of this argument makes me believe"
-		echo "*** that it is just a static archive that I should not use here."
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
+		$ECHO "*** that it is just a static archive that I should not use here."
 	      else
-		echo
+		$ECHO
 		$ECHO "*** Warning: Linking the shared library $output against the"
 		$ECHO "*** static library $deplib is not portable!"
 		deplibs="$deplib $deplibs"
@@ -6372,11 +5272,11 @@ func_mode_link ()
 	    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.
-	      func_append newdlprefiles " $deplib"
+	      newdlprefiles="$newdlprefiles $deplib"
 	      compile_deplibs="$deplib $compile_deplibs"
 	      finalize_deplibs="$deplib $finalize_deplibs"
 	    else
-	      func_append newdlfiles " $deplib"
+	      newdlfiles="$newdlfiles $deplib"
 	    fi
 	  fi
 	  continue
@@ -6418,20 +5318,20 @@ func_mode_link ()
 
 	# Convert "-framework foo" to "foo.ltframework"
 	if test -n "$inherited_linker_flags"; then
-	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
 	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
 	    case " $new_inherited_linker_flags " in
 	      *" $tmp_inherited_linker_flag "*) ;;
-	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
 	    esac
 	  done
 	fi
-	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 	if test "$linkmode,$pass" = "lib,link" ||
 	   test "$linkmode,$pass" = "prog,scan" ||
 	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-	  test -n "$dlopen" && func_append dlfiles " $dlopen"
-	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
 	fi
 
 	if test "$pass" = conv; then
@@ -6442,20 +5342,20 @@ func_mode_link ()
 	      func_fatal_error "cannot find name of link library for \`$lib'"
 	    fi
 	    # It is a libtool convenience library, so add in its objects.
-	    func_append convenience " $ladir/$objdir/$old_library"
-	    func_append old_convenience " $ladir/$objdir/$old_library"
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
 	    func_fatal_error "\`$lib' is not a convenience library"
 	  fi
 	  tmp_libs=
 	  for deplib in $dependency_libs; do
 	    deplibs="$deplib $deplibs"
-	    if $opt_preserve_dup_deps ; then
+	    if $opt_duplicate_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 	      esac
 	    fi
-	    func_append tmp_libs " $deplib"
+	    tmp_libs="$tmp_libs $deplib"
 	  done
 	  continue
 	fi # $pass = conv
@@ -6463,15 +5363,9 @@ func_mode_link ()
 
 	# Get the name of the library we link against.
 	linklib=
-	if test -n "$old_library" &&
-	   { test "$prefer_static_libs" = yes ||
-	     test "$prefer_static_libs,$installed" = "built,no"; }; then
-	  linklib=$old_library
-	else
-	  for l in $old_library $library_names; do
-	    linklib="$l"
-	  done
-	fi
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
 	if test -z "$linklib"; then
 	  func_fatal_error "cannot find name of link library for \`$lib'"
 	fi
@@ -6488,9 +5382,9 @@ func_mode_link ()
 	    # 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.
-	    func_append dlprefiles " $lib $dependency_libs"
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
 	  else
-	    func_append newdlfiles " $lib"
+	    newdlfiles="$newdlfiles $lib"
 	  fi
 	  continue
 	fi # $pass = dlopen
@@ -6512,14 +5406,14 @@ func_mode_link ()
 
 	# Find the relevant object directory and library name.
 	if test "X$installed" = Xyes; then
-	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
 	    func_warning "library \`$lib' was moved."
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    libdir="$abs_ladir"
 	  else
-	    dir="$lt_sysroot$libdir"
-	    absdir="$lt_sysroot$libdir"
+	    dir="$libdir"
+	    absdir="$libdir"
 	  fi
 	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
 	else
@@ -6527,12 +5421,12 @@ func_mode_link ()
 	    dir="$ladir"
 	    absdir="$abs_ladir"
 	    # Remove this search path later
-	    func_append notinst_path " $abs_ladir"
+	    notinst_path="$notinst_path $abs_ladir"
 	  else
 	    dir="$ladir/$objdir"
 	    absdir="$abs_ladir/$objdir"
 	    # Remove this search path later
-	    func_append notinst_path " $abs_ladir"
+	    notinst_path="$notinst_path $abs_ladir"
 	  fi
 	fi # $installed = yes
 	func_stripname 'lib' '.la' "$laname"
@@ -6543,46 +5437,20 @@ func_mode_link ()
 	  if test -z "$libdir" && test "$linkmode" = prog; then
 	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
 	  fi
-	  case "$host" in
-	    # special handling for platforms with PE-DLLs.
-	    *cygwin* | *mingw* | *cegcc* )
-	      # Linker will automatically link against shared library if both
-	      # static and shared are present.  Therefore, ensure we extract
-	      # symbols from the import library if a shared library is present
-	      # (otherwise, the dlopen module name will be incorrect).  We do
-	      # this by putting the import library name into $newdlprefiles.
-	      # We recover the dlopen module name by 'saving' the la file
-	      # name in a special purpose variable, and (later) extracting the
-	      # dlname from the la file.
-	      if test -n "$dlname"; then
-	        func_tr_sh "$dir/$linklib"
-	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
-	        func_append newdlprefiles " $dir/$linklib"
-	      else
-	        func_append newdlprefiles " $dir/$old_library"
-	        # Keep a list of preopened convenience libraries to check
-	        # that they are being used correctly in the link pass.
-	        test -z "$libdir" && \
-	          func_append dlpreconveniencelibs " $dir/$old_library"
-	      fi
-	    ;;
-	    * )
-	      # Prefer using a static library (so that no silly _DYNAMIC symbols
-	      # are required to link).
-	      if test -n "$old_library"; then
-	        func_append newdlprefiles " $dir/$old_library"
-	        # Keep a list of preopened convenience libraries to check
-	        # that they are being used correctly in the link pass.
-	        test -z "$libdir" && \
-	          func_append dlpreconveniencelibs " $dir/$old_library"
-	      # Otherwise, use the dlname, so that lt_dlopen finds it.
-	      elif test -n "$dlname"; then
-	        func_append newdlprefiles " $dir/$dlname"
-	      else
-	        func_append newdlprefiles " $dir/$linklib"
-	      fi
-	    ;;
-	  esac
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	    # Keep a list of preopened convenience libraries to check
+	    # that they are being used correctly in the link pass.
+	    test -z "$libdir" && \
+		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
 	fi # $pass = dlpreopen
 
 	if test -z "$libdir"; then
@@ -6600,7 +5468,7 @@ func_mode_link ()
 
 
 	if test "$linkmode" = prog && test "$pass" != link; then
-	  func_append newlib_search_path " $ladir"
+	  newlib_search_path="$newlib_search_path $ladir"
 	  deplibs="$lib $deplibs"
 
 	  linkalldeplibs=no
@@ -6613,8 +5481,7 @@ func_mode_link ()
 	  for deplib in $dependency_libs; do
 	    case $deplib in
 	    -L*) func_stripname '-L' '' "$deplib"
-	         func_resolve_sysroot "$func_stripname_result"
-	         func_append newlib_search_path " $func_resolve_sysroot_result"
+	         newlib_search_path="$newlib_search_path $func_stripname_result"
 		 ;;
 	    esac
 	    # Need to link against all dependency_libs?
@@ -6625,12 +5492,12 @@ func_mode_link ()
 	      # or/and link against static libraries
 	      newdependency_libs="$deplib $newdependency_libs"
 	    fi
-	    if $opt_preserve_dup_deps ; then
+	    if $opt_duplicate_deps ; then
 	      case "$tmp_libs " in
-	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 	      esac
 	    fi
-	    func_append tmp_libs " $deplib"
+	    tmp_libs="$tmp_libs $deplib"
 	  done # for deplib
 	  continue
 	fi # $linkmode = prog...
@@ -6645,7 +5512,7 @@ func_mode_link ()
 	      # Make sure the rpath contains only unique directories.
 	      case "$temp_rpath:" in
 	      *"$absdir:"*) ;;
-	      *) func_append temp_rpath "$absdir:" ;;
+	      *) temp_rpath="$temp_rpath$absdir:" ;;
 	      esac
 	    fi
 
@@ -6657,7 +5524,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) func_append compile_rpath " $absdir" ;;
+	      *) compile_rpath="$compile_rpath $absdir"
 	      esac
 	      ;;
 	    esac
@@ -6666,7 +5533,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) func_append finalize_rpath " $libdir" ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
 	      esac
 	      ;;
 	    esac
@@ -6691,12 +5558,12 @@ func_mode_link ()
 	  case $host in
 	  *cygwin* | *mingw* | *cegcc*)
 	      # No point in relinking DLLs because paths are not encoded
-	      func_append notinst_deplibs " $lib"
+	      notinst_deplibs="$notinst_deplibs $lib"
 	      need_relink=no
 	    ;;
 	  *)
 	    if test "$installed" = no; then
-	      func_append notinst_deplibs " $lib"
+	      notinst_deplibs="$notinst_deplibs $lib"
 	      need_relink=yes
 	    fi
 	    ;;
@@ -6713,7 +5580,7 @@ func_mode_link ()
 	    fi
 	  done
 	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
-	    echo
+	    $ECHO
 	    if test "$linkmode" = prog; then
 	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
 	    else
@@ -6731,7 +5598,7 @@ func_mode_link ()
 	    *)
 	      case "$compile_rpath " in
 	      *" $absdir "*) ;;
-	      *) func_append compile_rpath " $absdir" ;;
+	      *) compile_rpath="$compile_rpath $absdir"
 	      esac
 	      ;;
 	    esac
@@ -6740,7 +5607,7 @@ func_mode_link ()
 	    *)
 	      case "$finalize_rpath " in
 	      *" $libdir "*) ;;
-	      *) func_append finalize_rpath " $libdir" ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
 	      esac
 	      ;;
 	    esac
@@ -6794,7 +5661,7 @@ func_mode_link ()
 	    linklib=$newlib
 	  fi # test -n "$old_archive_from_expsyms_cmds"
 
-	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
+	  if test "$linkmode" = prog || test "$mode" != relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -6816,9 +5683,9 @@ func_mode_link ()
 		      if test "X$dlopenmodule" != "X$lib"; then
 			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
 			if test -z "$old_library" ; then
-			  echo
-			  echo "*** And there doesn't seem to be a static archive available"
-			  echo "*** The link will probably fail, sorry"
+			  $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
@@ -6845,12 +5712,12 @@ func_mode_link ()
 	         test "$hardcode_direct_absolute" = no; then
 		add="$dir/$linklib"
 	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$absdir"
+		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
 		    [\\/]*)
-		      func_append add_dir " -L$inst_prefix_dir$libdir"
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
 		      ;;
 		  esac
 		fi
@@ -6872,7 +5739,7 @@ func_mode_link ()
 	    if test -n "$add_shlibpath"; then
 	      case :$compile_shlibpath: in
 	      *":$add_shlibpath:"*) ;;
-	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
 	      esac
 	    fi
 	    if test "$linkmode" = prog; then
@@ -6886,13 +5753,13 @@ func_mode_link ()
 		 test "$hardcode_shlibpath_var" = yes; then
 		case :$finalize_shlibpath: in
 		*":$libdir:"*) ;;
-		*) func_append finalize_shlibpath "$libdir:" ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 		esac
 	      fi
 	    fi
 	  fi
 
-	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
+	  if test "$linkmode" = prog || test "$mode" = relink; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
@@ -6906,7 +5773,7 @@ func_mode_link ()
 	    elif test "$hardcode_shlibpath_var" = yes; then
 	      case :$finalize_shlibpath: in
 	      *":$libdir:"*) ;;
-	      *) func_append finalize_shlibpath "$libdir:" ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
 	      esac
 	      add="-l$name"
 	    elif test "$hardcode_automatic" = yes; then
@@ -6923,7 +5790,7 @@ func_mode_link ()
 	      if test -n "$inst_prefix_dir"; then
 		case $libdir in
 		  [\\/]*)
-		    func_append add_dir " -L$inst_prefix_dir$libdir"
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
 		    ;;
 		esac
 	      fi
@@ -6958,21 +5825,21 @@ func_mode_link ()
 
 	    # Just print a warning and add the library to dependency_libs so
 	    # that the program can be linked against the static library.
-	    echo
+	    $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."
+	    $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."
+	      $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."
+		$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
@@ -7000,46 +5867,37 @@ func_mode_link ()
 	           temp_xrpath=$func_stripname_result
 		   case " $xrpath " in
 		   *" $temp_xrpath "*) ;;
-		   *) func_append xrpath " $temp_xrpath";;
+		   *) xrpath="$xrpath $temp_xrpath";;
 		   esac;;
-	      *) func_append temp_deplibs " $libdir";;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
 	      esac
 	    done
 	    dependency_libs="$temp_deplibs"
 	  fi
 
-	  func_append newlib_search_path " $absdir"
+	  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"
-	    case $deplib in
-              -L*) func_stripname '-L' '' "$deplib"
-                   func_resolve_sysroot "$func_stripname_result";;
-              *) func_resolve_sysroot "$deplib" ;;
-            esac
-	    if $opt_preserve_dup_deps ; then
+	    if $opt_duplicate_deps ; then
 	      case "$tmp_libs " in
-	      *" $func_resolve_sysroot_result "*)
-                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
 	      esac
 	    fi
-	    func_append tmp_libs " $func_resolve_sysroot_result"
+	    tmp_libs="$tmp_libs $deplib"
 	  done
 
 	  if test "$link_all_deplibs" != no; then
 	    # Add the search paths of all dependency libraries
 	    for deplib in $dependency_libs; do
-	      path=
 	      case $deplib in
 	      -L*) path="$deplib" ;;
 	      *.la)
-	        func_resolve_sysroot "$deplib"
-	        deplib=$func_resolve_sysroot_result
 	        func_dirname "$deplib" "" "."
-		dir=$func_dirname_result
+		dir="$func_dirname_result"
 		# We need an absolute path.
 		case $dir in
 		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
@@ -7066,8 +5924,8 @@ func_mode_link ()
                       if test -z "$darwin_install_name"; then
                           darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
                       fi
-		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
 		      path=
 		    fi
 		  fi
@@ -7100,7 +5958,7 @@ func_mode_link ()
 	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
 	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
 	else
-	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 	fi
       fi
       dependency_libs="$newdependency_libs"
@@ -7117,7 +5975,7 @@ func_mode_link ()
 	  for dir in $newlib_search_path; do
 	    case "$lib_search_path " in
 	    *" $dir "*) ;;
-	    *) func_append lib_search_path " $dir" ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
 	    esac
 	  done
 	  newlib_search_path=
@@ -7175,10 +6033,10 @@ func_mode_link ()
 	    -L*)
 	      case " $tmp_libs " in
 	      *" $deplib "*) ;;
-	      *) func_append tmp_libs " $deplib" ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
 	      esac
 	      ;;
-	    *) func_append tmp_libs " $deplib" ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
 	    esac
 	  done
 	  eval $var=\"$tmp_libs\"
@@ -7194,7 +6052,7 @@ func_mode_link ()
 	  ;;
 	esac
 	if test -n "$i" ; then
-	  func_append tmp_libs " $i"
+	  tmp_libs="$tmp_libs $i"
 	fi
       done
       dependency_libs=$tmp_libs
@@ -7235,7 +6093,7 @@ func_mode_link ()
       # Now set the variables for building old libraries.
       build_libtool_libs=no
       oldlibs="$output"
-      func_append objs "$old_deplibs"
+      objs="$objs$old_deplibs"
       ;;
 
     lib)
@@ -7268,10 +6126,10 @@ func_mode_link ()
 	if test "$deplibs_check_method" != pass_all; then
 	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
 	else
-	  echo
+	  $ECHO
 	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
 	  $ECHO "*** objects $objs is not portable!"
-	  func_append libobjs " $objs"
+	  libobjs="$libobjs $objs"
 	fi
       fi
 
@@ -7330,14 +6188,13 @@ func_mode_link ()
 	  # which has an extra 1 added just for fun
 	  #
 	  case $version_type in
-	  # correct linux to gnu/linux during the next big refactor
 	  darwin|linux|osf|windows|none)
 	    func_arith $number_major + $number_minor
 	    current=$func_arith_result
 	    age="$number_minor"
 	    revision="$number_revision"
 	    ;;
-	  freebsd-aout|freebsd-elf|qnx|sunos)
+	  freebsd-aout|freebsd-elf|sunos)
 	    current="$number_major"
 	    revision="$number_minor"
 	    age="0"
@@ -7447,7 +6304,7 @@ func_mode_link ()
 	  versuffix="$major.$revision"
 	  ;;
 
-	linux) # correct to gnu/linux during the next big refactor
+	linux)
 	  func_arith $current - $age
 	  major=.$func_arith_result
 	  versuffix="$major.$age.$revision"
@@ -7470,7 +6327,7 @@ func_mode_link ()
 	  done
 
 	  # Make executables depend on our current version.
-	  func_append verstring ":${current}.0"
+	  verstring="$verstring:${current}.0"
 	  ;;
 
 	qnx)
@@ -7538,10 +6395,10 @@ func_mode_link ()
       fi
 
       func_generate_dlsyms "$libname" "$libname" "yes"
-      func_append libobjs " $symfileobj"
+      libobjs="$libobjs $symfileobj"
       test "X$libobjs" = "X " && libobjs=
 
-      if test "$opt_mode" != relink; then
+      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=
@@ -7557,7 +6414,7 @@ func_mode_link ()
 		   continue
 		 fi
 	       fi
-	       func_append removelist " $p"
+	       removelist="$removelist $p"
 	       ;;
 	    *) ;;
 	  esac
@@ -7568,28 +6425,27 @@ func_mode_link ()
 
       # Now set the variables for building old libraries.
       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-	func_append oldlibs " $output_objdir/$libname.$libext"
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
 
 	# Transform .lo files to .o files.
-	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+	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 "s% $path % %g"`
-      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
-      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+      #	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
+      #	deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
       #done
 
       if test -n "$xrpath"; then
 	# If the user specified any rpath flags, then add them.
 	temp_xrpath=
 	for libdir in $xrpath; do
-	  func_replace_sysroot "$libdir"
-	  func_append temp_xrpath " -R$func_replace_sysroot_result"
+	  temp_xrpath="$temp_xrpath -R$libdir"
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) func_append finalize_rpath " $libdir" ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
 	  esac
 	done
 	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
@@ -7603,7 +6459,7 @@ func_mode_link ()
       for lib in $old_dlfiles; do
 	case " $dlprefiles $dlfiles " in
 	*" $lib "*) ;;
-	*) func_append dlfiles " $lib" ;;
+	*) dlfiles="$dlfiles $lib" ;;
 	esac
       done
 
@@ -7613,19 +6469,19 @@ func_mode_link ()
       for lib in $old_dlprefiles; do
 	case "$dlprefiles " in
 	*" $lib "*) ;;
-	*) func_append dlprefiles " $lib" ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
 	esac
       done
 
       if test "$build_libtool_libs" = yes; then
 	if test -n "$rpath"; then
 	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
 	    # these systems don't actually have a c library (as such)!
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C library is in the System framework
-	    func_append deplibs " System.ltframework"
+	    deplibs="$deplibs System.ltframework"
 	    ;;
 	  *-*-netbsd*)
 	    # Don't link with libc until the a.out ld.so is fixed.
@@ -7642,7 +6498,7 @@ func_mode_link ()
 	  *)
 	    # Add libc to deplibs on all other systems if necessary.
 	    if test "$build_libtool_need_lc" = "yes"; then
-	      func_append deplibs " -lc"
+	      deplibs="$deplibs -lc"
 	    fi
 	    ;;
 	  esac
@@ -7691,7 +6547,7 @@ EOF
 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		  case " $predeps $postdeps " in
 		  *" $i "*)
-		    func_append newdeplibs " $i"
+		    newdeplibs="$newdeplibs $i"
 		    i=""
 		    ;;
 		  esac
@@ -7702,21 +6558,21 @@ EOF
 		  set dummy $deplib_matches; shift
 		  deplib_match=$1
 		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		    func_append newdeplibs " $i"
+		    newdeplibs="$newdeplibs $i"
 		  else
 		    droppeddeps=yes
-		    echo
+		    $ECHO
 		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		    echo "*** I have the capability to make that library automatically link in when"
-		    echo "*** you link to this library.  But I can only do this if you have a"
-		    echo "*** shared version of the library, which I believe you do not have"
-		    echo "*** because a test_compile did reveal that the linker did not use it for"
-		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		    $ECHO "*** I have the capability to make that library automatically link in when"
+		    $ECHO "*** you link to this library.  But I can only do this if you have a"
+		    $ECHO "*** shared version of the library, which I believe you do not have"
+		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
+		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
 		  fi
 		fi
 		;;
 	      *)
-		func_append newdeplibs " $i"
+		newdeplibs="$newdeplibs $i"
 		;;
 	      esac
 	    done
@@ -7734,7 +6590,7 @@ EOF
 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		    case " $predeps $postdeps " in
 		    *" $i "*)
-		      func_append newdeplibs " $i"
+		      newdeplibs="$newdeplibs $i"
 		      i=""
 		      ;;
 		    esac
@@ -7745,29 +6601,29 @@ EOF
 		    set dummy $deplib_matches; shift
 		    deplib_match=$1
 		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      func_append newdeplibs " $i"
+		      newdeplibs="$newdeplibs $i"
 		    else
 		      droppeddeps=yes
-		      echo
+		      $ECHO
 		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-		      echo "*** I have the capability to make that library automatically link in when"
-		      echo "*** you link to this library.  But I can only do this if you have a"
-		      echo "*** shared version of the library, which you do not appear to have"
-		      echo "*** because a test_compile did reveal that the linker did not use this one"
-		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		      $ECHO "*** I have the capability to make that library automatically link in when"
+		      $ECHO "*** you link to this library.  But I can only do this if you have a"
+		      $ECHO "*** shared version of the library, which you do not appear to have"
+		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
+		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
 		    fi
 		  fi
 		else
 		  droppeddeps=yes
-		  echo
+		  $ECHO
 		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
-		  echo "*** make it link in!  You will probably need to install it or some"
-		  echo "*** library that it depends on before this library will be fully"
-		  echo "*** functional.  Installing it before continuing would be even better."
+		  $ECHO "*** make it link in!  You will probably need to install it or some"
+		  $ECHO "*** library that it depends on before this library will be fully"
+		  $ECHO "*** functional.  Installing it before continuing would be even better."
 		fi
 		;;
 	      *)
-		func_append newdeplibs " $i"
+		newdeplibs="$newdeplibs $i"
 		;;
 	      esac
 	    done
@@ -7784,27 +6640,15 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  func_append newdeplibs " $a_deplib"
+		  newdeplibs="$newdeplibs $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
 	      fi
 	      if test -n "$a_deplib" ; then
 		libname=`eval "\\$ECHO \"$libname_spec\""`
-		if test -n "$file_magic_glob"; then
-		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
-		else
-		  libnameglob=$libname
-		fi
-		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  if test "$want_nocaseglob" = yes; then
-		    shopt -s nocaseglob
-		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
-		    $nocaseglob
-		  else
-		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
-		  fi
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 		  for potent_lib in $potential_libs; do
 		      # Follow soft links.
 		      if ls -lLd "$potent_lib" 2>/dev/null |
@@ -7821,13 +6665,13 @@ EOF
 			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
 			case $potliblink in
 			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
 			esac
 		      done
 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
 			 $SED -e 10q |
 			 $EGREP "$file_magic_regex" > /dev/null; then
-			func_append newdeplibs " $a_deplib"
+			newdeplibs="$newdeplibs $a_deplib"
 			a_deplib=""
 			break 2
 		      fi
@@ -7836,12 +6680,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		echo
+		$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"
+		$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
@@ -7852,7 +6696,7 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      func_append newdeplibs " $a_deplib"
+	      newdeplibs="$newdeplibs $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
@@ -7868,7 +6712,7 @@ EOF
 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
-		  func_append newdeplibs " $a_deplib"
+		  newdeplibs="$newdeplibs $a_deplib"
 		  a_deplib=""
 		  ;;
 		esac
@@ -7879,9 +6723,9 @@ EOF
 		  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 | \
+		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
 		       $EGREP "$match_pattern_regex" > /dev/null; then
-		      func_append newdeplibs " $a_deplib"
+		      newdeplibs="$newdeplibs $a_deplib"
 		      a_deplib=""
 		      break 2
 		    fi
@@ -7890,12 +6734,12 @@ EOF
 	      fi
 	      if test -n "$a_deplib" ; then
 		droppeddeps=yes
-		echo
+		$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"
+		$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
@@ -7906,32 +6750,32 @@ EOF
 	      ;;
 	    *)
 	      # Add a -L argument.
-	      func_append newdeplibs " $a_deplib"
+	      newdeplibs="$newdeplibs $a_deplib"
 	      ;;
 	    esac
 	  done # Gone through all deplibs.
 	  ;;
 	none | unknown | *)
 	  newdeplibs=""
-	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+	  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 " $tmp_deplibs" | $SED "s,$i,,"`
+	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
 	    done
 	  fi
-	  case $tmp_deplibs in
-	  *[!\	\ ]*)
-	    echo
+	  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."
+	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
 	    else
-	      echo "*** Warning: inter-library dependencies are not known to be supported."
+	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
 	    fi
-	    echo "*** All declared inter-library dependencies are being dropped."
+	    $ECHO "*** All declared inter-library dependencies are being dropped."
 	    droppeddeps=yes
-	    ;;
-	  esac
+	  fi
 	  ;;
 	esac
 	versuffix=$versuffix_save
@@ -7943,23 +6787,23 @@ EOF
 	case $host in
 	*-*-rhapsody* | *-*-darwin1.[012])
 	  # On Rhapsody replace the C library with the System framework
-	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
 	  ;;
 	esac
 
 	if test "$droppeddeps" = yes; then
 	  if test "$module" = yes; then
-	    echo
-	    echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $ECHO
+	    $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."
+	    $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."
+	      $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"
@@ -7969,16 +6813,16 @@ EOF
 	      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."
+	    $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."
+	      $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
@@ -7995,9 +6839,9 @@ EOF
       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
       case $host in
 	*-*-darwin*)
-	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 	  ;;
       esac
 
@@ -8010,7 +6854,7 @@ EOF
 	*)
 	  case " $deplibs " in
 	  *" -L$path/$objdir "*)
-	    func_append new_libs " -L$path/$objdir" ;;
+	    new_libs="$new_libs -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -8020,10 +6864,10 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) func_append new_libs " $deplib" ;;
+	  *) new_libs="$new_libs $deplib" ;;
 	  esac
 	  ;;
-	*) func_append new_libs " $deplib" ;;
+	*) new_libs="$new_libs $deplib" ;;
 	esac
       done
       deplibs="$new_libs"
@@ -8035,22 +6879,15 @@ EOF
 
       # Test again, we may have decided not to build it any more
       if test "$build_libtool_libs" = yes; then
-	# Remove ${wl} instances when linking with ld.
-	# FIXME: should test the right _cmds variable.
-	case $archive_cmds in
-	  *\$LD\ *) wl= ;;
-        esac
 	if test "$hardcode_into_libs" = yes; then
 	  # Hardcode the library paths
 	  hardcode_libdirs=
 	  dep_rpath=
 	  rpath="$finalize_rpath"
-	  test "$opt_mode" != relink && rpath="$compile_rpath$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
-		func_replace_sysroot "$libdir"
-		libdir=$func_replace_sysroot_result
 		if test -z "$hardcode_libdirs"; then
 		  hardcode_libdirs="$libdir"
 		else
@@ -8059,18 +6896,18 @@ EOF
 		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		    ;;
 		  *)
-		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 		    ;;
 		  esac
 		fi
 	      else
 		eval flag=\"$hardcode_libdir_flag_spec\"
-		func_append dep_rpath " $flag"
+		dep_rpath="$dep_rpath $flag"
 	      fi
 	    elif test -n "$runpath_var"; then
 	      case "$perm_rpath " in
 	      *" $libdir "*) ;;
-	      *) func_append perm_rpath " $libdir" ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
 	      esac
 	    fi
 	  done
@@ -8078,13 +6915,17 @@ EOF
 	  if test -n "$hardcode_libdir_separator" &&
 	     test -n "$hardcode_libdirs"; then
 	    libdir="$hardcode_libdirs"
-	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+	    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
-	      func_append rpath "$dir:"
+	      rpath="$rpath$dir:"
 	    done
 	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
 	  fi
@@ -8092,7 +6933,7 @@ EOF
 	fi
 
 	shlibpath="$finalize_shlibpath"
-	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
 	if test -n "$shlibpath"; then
 	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
 	fi
@@ -8118,18 +6959,18 @@ EOF
 	linknames=
 	for link
 	do
-	  func_append linknames " $link"
+	  linknames="$linknames $link"
 	done
 
 	# Use standard objects if they are pic
-	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
 	test "X$libobjs" = "X " && libobjs=
 
 	delfiles=
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
 	  export_symbols="$output_objdir/$libname.uexp"
-	  func_append delfiles " $export_symbols"
+	  delfiles="$delfiles $export_symbols"
 	fi
 
 	orig_export_symbols=
@@ -8160,45 +7001,13 @@ EOF
 	    $opt_dry_run || $RM $export_symbols
 	    cmds=$export_symbols_cmds
 	    save_ifs="$IFS"; IFS='~'
-	    for cmd1 in $cmds; do
+	    for cmd in $cmds; do
 	      IFS="$save_ifs"
-	      # Take the normal branch if the nm_file_list_spec branch
-	      # doesn't work or if tool conversion is not needed.
-	      case $nm_file_list_spec~$to_tool_file_cmd in
-		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
-		  try_normal_branch=yes
-		  eval cmd=\"$cmd1\"
-		  func_len " $cmd"
-		  len=$func_len_result
-		  ;;
-		*)
-		  try_normal_branch=no
-		  ;;
-	      esac
-	      if test "$try_normal_branch" = yes \
-		 && { test "$len" -lt "$max_cmd_len" \
-		      || test "$max_cmd_len" -le -1; }
-	      then
-		func_show_eval "$cmd" 'exit $?'
-		skipped_export=false
-	      elif test -n "$nm_file_list_spec"; then
-		func_basename "$output"
-		output_la=$func_basename_result
-		save_libobjs=$libobjs
-		save_output=$output
-		output=${output_objdir}/${output_la}.nm
-		func_to_tool_file "$output"
-		libobjs=$nm_file_list_spec$func_to_tool_file_result
-		func_append delfiles " $output"
-		func_verbose "creating $NM input file list: $output"
-		for obj in $save_libobjs; do
-		  func_to_tool_file "$obj"
-		  $ECHO "$func_to_tool_file_result"
-		done > "$output"
-		eval cmd=\"$cmd1\"
+	      eval cmd=\"$cmd\"
+	      func_len " $cmd"
+	      len=$func_len_result
+	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 		func_show_eval "$cmd" 'exit $?'
-		output=$save_output
-		libobjs=$save_libobjs
 		skipped_export=false
 	      else
 		# The command line is too long to execute in one step.
@@ -8220,7 +7029,7 @@ EOF
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  tmp_export_symbols="$export_symbols"
 	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
 	fi
 
 	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
@@ -8232,7 +7041,7 @@ EOF
 	  # global variables. join(1) would be nice here, but unfortunately
 	  # isn't a blessed tool.
 	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
 	  export_symbols=$output_objdir/$libname.def
 	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	fi
@@ -8242,7 +7051,7 @@ EOF
 	  case " $convenience " in
 	  *" $test_deplib "*) ;;
 	  *)
-	    func_append tmp_deplibs " $test_deplib"
+	    tmp_deplibs="$tmp_deplibs $test_deplib"
 	    ;;
 	  esac
 	done
@@ -8262,21 +7071,21 @@ EOF
 	    test "X$libobjs" = "X " && libobjs=
 	  else
 	    gentop="$output_objdir/${outputname}x"
-	    func_append generated " $gentop"
+	    generated="$generated $gentop"
 
 	    func_extract_archives $gentop $convenience
-	    func_append libobjs " $func_extract_archives_result"
+	    libobjs="$libobjs $func_extract_archives_result"
 	    test "X$libobjs" = "X " && libobjs=
 	  fi
 	fi
 
 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
 	  eval flag=\"$thread_safe_flag_spec\"
-	  func_append linker_flags " $flag"
+	  linker_flags="$linker_flags $flag"
 	fi
 
 	# Make a backup of the uninstalled library when relinking
-	if test "$opt_mode" = relink; then
+	if test "$mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
 	fi
 
@@ -8321,8 +7130,7 @@ EOF
 	    save_libobjs=$libobjs
 	  fi
 	  save_output=$output
-	  func_basename "$output"
-	  output_la=$func_basename_result
+	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
 
 	  # Clear the reloadable object creation command queue and
 	  # initialize k to one.
@@ -8335,16 +7143,13 @@ EOF
 	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
 	    output=${output_objdir}/${output_la}.lnkscript
 	    func_verbose "creating GNU ld script: $output"
-	    echo 'INPUT (' > $output
+	    $ECHO 'INPUT (' > $output
 	    for obj in $save_libobjs
 	    do
-	      func_to_tool_file "$obj"
-	      $ECHO "$func_to_tool_file_result" >> $output
+	      $ECHO "$obj" >> $output
 	    done
-	    echo ')' >> $output
-	    func_append delfiles " $output"
-	    func_to_tool_file "$output"
-	    output=$func_to_tool_file_result
+	    $ECHO ')' >> $output
+	    delfiles="$delfiles $output"
 	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
 	    output=${output_objdir}/${output_la}.lnk
 	    func_verbose "creating linker input file list: $output"
@@ -8358,12 +7163,10 @@ EOF
 	    fi
 	    for obj
 	    do
-	      func_to_tool_file "$obj"
-	      $ECHO "$func_to_tool_file_result" >> $output
+	      $ECHO "$obj" >> $output
 	    done
-	    func_append delfiles " $output"
-	    func_to_tool_file "$output"
-	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+	    delfiles="$delfiles $output"
+	    output=$firstobj\"$file_list_spec$output\"
 	  else
 	    if test -n "$save_libobjs"; then
 	      func_verbose "creating reloadable object files..."
@@ -8387,19 +7190,17 @@ EOF
 		  # command to the queue.
 		  if test "$k" -eq 1 ; then
 		    # The first file doesn't have a previous command to add.
-		    reload_objs=$objlist
-		    eval concat_cmds=\"$reload_cmds\"
+		    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
 		  else
 		    # All subsequent reloadable object files will link in
 		    # the last one created.
-		    reload_objs="$objlist $last_robj"
-		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+		    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
 		  fi
 		  last_robj=$output_objdir/$output_la-${k}.$objext
 		  func_arith $k + 1
 		  k=$func_arith_result
 		  output=$output_objdir/$output_la-${k}.$objext
-		  objlist=" $obj"
+		  objlist=$obj
 		  func_len " $last_robj"
 		  func_arith $len0 + $func_len_result
 		  len=$func_arith_result
@@ -8409,12 +7210,11 @@ EOF
 	      # reloadable object file.  All subsequent reloadable object
 	      # files will link in the last one created.
 	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      reload_objs="$objlist $last_robj"
-	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+	      eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
 	      if test -n "$last_robj"; then
 	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
 	      fi
-	      func_append delfiles " $output"
+	      delfiles="$delfiles $output"
 
 	    else
 	      output=
@@ -8448,7 +7248,7 @@ EOF
 		lt_exit=$?
 
 		# Restore the uninstalled library and exit
-		if test "$opt_mode" = relink; then
+		if test "$mode" = relink; then
 		  ( cd "$output_objdir" && \
 		    $RM "${realname}T" && \
 		    $MV "${realname}U" "$realname" )
@@ -8469,7 +7269,7 @@ EOF
 	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	      tmp_export_symbols="$export_symbols"
 	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	      $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
 	    fi
 
 	    if test -n "$orig_export_symbols"; then
@@ -8481,7 +7281,7 @@ EOF
 	      # global variables. join(1) would be nice here, but unfortunately
 	      # isn't a blessed tool.
 	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
-	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
 	      export_symbols=$output_objdir/$libname.def
 	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	    fi
@@ -8522,10 +7322,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  func_append generated " $gentop"
+	  generated="$generated $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  func_append libobjs " $func_extract_archives_result"
+	  libobjs="$libobjs $func_extract_archives_result"
 	  test "X$libobjs" = "X " && libobjs=
 	fi
 
@@ -8541,7 +7341,7 @@ EOF
 	    lt_exit=$?
 
 	    # Restore the uninstalled library and exit
-	    if test "$opt_mode" = relink; then
+	    if test "$mode" = relink; then
 	      ( cd "$output_objdir" && \
 	        $RM "${realname}T" && \
 		$MV "${realname}U" "$realname" )
@@ -8553,7 +7353,7 @@ EOF
 	IFS="$save_ifs"
 
 	# Restore the uninstalled library and exit
-	if test "$opt_mode" = relink; then
+	if test "$mode" = relink; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
 
 	  if test -n "$convenience"; then
@@ -8634,21 +7434,18 @@ EOF
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
 	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+	  reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
 	else
 	  gentop="$output_objdir/${obj}x"
-	  func_append generated " $gentop"
+	  generated="$generated $gentop"
 
 	  func_extract_archives $gentop $convenience
 	  reload_conv_objs="$reload_objs $func_extract_archives_result"
 	fi
       fi
 
-      # If we're not building shared, we need to use non_pic_objs
-      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
-
       # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
 
       output="$obj"
       func_execute_cmds "$reload_cmds" 'exit $?'
@@ -8708,8 +7505,8 @@ EOF
       case $host in
       *-*-rhapsody* | *-*-darwin1.[012])
 	# On Rhapsody replace the C library is the System framework
-	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
-	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
 	;;
       esac
 
@@ -8720,14 +7517,14 @@ EOF
 	if test "$tagname" = CXX ; then
 	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
 	    10.[0123])
-	      func_append compile_command " ${wl}-bind_at_load"
-	      func_append finalize_command " ${wl}-bind_at_load"
+	      compile_command="$compile_command ${wl}-bind_at_load"
+	      finalize_command="$finalize_command ${wl}-bind_at_load"
 	    ;;
 	  esac
 	fi
 	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
-	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
 	;;
       esac
 
@@ -8741,7 +7538,7 @@ EOF
 	*)
 	  case " $compile_deplibs " in
 	  *" -L$path/$objdir "*)
-	    func_append new_libs " -L$path/$objdir" ;;
+	    new_libs="$new_libs -L$path/$objdir" ;;
 	  esac
 	  ;;
 	esac
@@ -8751,17 +7548,17 @@ EOF
 	-L*)
 	  case " $new_libs " in
 	  *" $deplib "*) ;;
-	  *) func_append new_libs " $deplib" ;;
+	  *) new_libs="$new_libs $deplib" ;;
 	  esac
 	  ;;
-	*) func_append new_libs " $deplib" ;;
+	*) new_libs="$new_libs $deplib" ;;
 	esac
       done
       compile_deplibs="$new_libs"
 
 
-      func_append compile_command " $compile_deplibs"
-      func_append finalize_command " $finalize_deplibs"
+      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.
@@ -8769,7 +7566,7 @@ EOF
 	  # This is the magic to use -rpath.
 	  case "$finalize_rpath " in
 	  *" $libdir "*) ;;
-	  *) func_append finalize_rpath " $libdir" ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
 	  esac
 	done
       fi
@@ -8788,18 +7585,18 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    func_append rpath " $flag"
+	    rpath="$rpath $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) func_append perm_rpath " $libdir" ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
 	  esac
 	fi
 	case $host in
@@ -8808,12 +7605,12 @@ EOF
 	  case :$dllsearchpath: in
 	  *":$libdir:"*) ;;
 	  ::) dllsearchpath=$libdir;;
-	  *) func_append dllsearchpath ":$libdir";;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
 	  esac
 	  case :$dllsearchpath: in
 	  *":$testbindir:"*) ;;
 	  ::) dllsearchpath=$testbindir;;
-	  *) func_append dllsearchpath ":$testbindir";;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
 	  esac
 	  ;;
 	esac
@@ -8839,18 +7636,18 @@ EOF
 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
 		;;
 	      *)
-		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
 		;;
 	      esac
 	    fi
 	  else
 	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    func_append rpath " $flag"
+	    rpath="$rpath $flag"
 	  fi
 	elif test -n "$runpath_var"; then
 	  case "$finalize_perm_rpath " in
 	  *" $libdir "*) ;;
-	  *) func_append finalize_perm_rpath " $libdir" ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
 	  esac
 	fi
       done
@@ -8864,8 +7661,8 @@ EOF
 
       if test -n "$libobjs" && test "$build_old_libs" = yes; then
 	# Transform all the library objects into standard objects.
-	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
-	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
       fi
 
       func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
@@ -8877,15 +7674,15 @@ EOF
 
       wrappers_required=yes
       case $host in
-      *cegcc* | *mingw32ce*)
-        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
-        wrappers_required=no
-        ;;
       *cygwin* | *mingw* )
         if test "$build_libtool_libs" != yes; then
           wrappers_required=no
         fi
         ;;
+      *cegcc)
+        # Disable wrappers for cegcc, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
       *)
         if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
           wrappers_required=no
@@ -8894,19 +7691,13 @@ EOF
       esac
       if test "$wrappers_required" = no; then
 	# Replace the output file specification.
-	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 	link_command="$compile_command$compile_rpath"
 
 	# We have no uninstalled library dependencies, so finalize right now.
 	exit_status=0
 	func_show_eval "$link_command" 'exit_status=$?'
 
-	if test -n "$postlink_cmds"; then
-	  func_to_tool_file "$output"
-	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
-	  func_execute_cmds "$postlink_cmds" 'exit $?'
-	fi
-
 	# Delete the generated files.
 	if test -f "$output_objdir/${outputname}S.${objext}"; then
 	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
@@ -8929,7 +7720,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $perm_rpath; do
-	    func_append rpath "$dir:"
+	    rpath="$rpath$dir:"
 	  done
 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -8937,7 +7728,7 @@ EOF
 	  # We should set the runpath_var.
 	  rpath=
 	  for dir in $finalize_perm_rpath; do
-	    func_append rpath "$dir:"
+	    rpath="$rpath$dir:"
 	  done
 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
 	fi
@@ -8947,18 +7738,11 @@ EOF
 	# 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 "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 	# Delete the old output file.
 	$opt_dry_run || $RM $output
 	# Link the executable and exit
 	func_show_eval "$link_command" 'exit $?'
-
-	if test -n "$postlink_cmds"; then
-	  func_to_tool_file "$output"
-	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
-	  func_execute_cmds "$postlink_cmds" 'exit $?'
-	fi
-
 	exit $EXIT_SUCCESS
       fi
 
@@ -8973,7 +7757,7 @@ EOF
 	if test "$fast_install" != no; then
 	  link_command="$finalize_var$compile_command$finalize_rpath"
 	  if test "$fast_install" = yes; then
-	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+	    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=
@@ -8985,19 +7769,13 @@ EOF
       fi
 
       # Replace the output file specification.
-      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
 
       # Delete the old output files.
       $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
       func_show_eval "$link_command" 'exit $?'
 
-      if test -n "$postlink_cmds"; then
-	func_to_tool_file "$output_objdir/$outputname"
-	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
-	func_execute_cmds "$postlink_cmds" 'exit $?'
-      fi
-
       # Now create the wrapper script.
       func_verbose "creating $output"
 
@@ -9015,7 +7793,18 @@ EOF
 	  fi
 	done
 	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+	relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $ECHO for shipping.
+      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
+	case $progpath in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+	esac
+	qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
       fi
 
       # Only actually do things if not in dry run mode.
@@ -9095,7 +7884,7 @@ EOF
 	else
 	  oldobjs="$old_deplibs $non_pic_objects"
 	  if test "$preload" = yes && test -f "$symfileobj"; then
-	    func_append oldobjs " $symfileobj"
+	    oldobjs="$oldobjs $symfileobj"
 	  fi
 	fi
 	addlibs="$old_convenience"
@@ -9103,10 +7892,10 @@ EOF
 
       if test -n "$addlibs"; then
 	gentop="$output_objdir/${outputname}x"
-	func_append generated " $gentop"
+	generated="$generated $gentop"
 
 	func_extract_archives $gentop $addlibs
-	func_append oldobjs " $func_extract_archives_result"
+	oldobjs="$oldobjs $func_extract_archives_result"
       fi
 
       # Do each command in the archive commands.
@@ -9117,10 +7906,10 @@ EOF
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
 	  gentop="$output_objdir/${outputname}x"
-	  func_append generated " $gentop"
+	  generated="$generated $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
-	  func_append oldobjs " $func_extract_archives_result"
+	  oldobjs="$oldobjs $func_extract_archives_result"
 	fi
 
 	# POSIX demands no paths to be encoded in archives.  We have
@@ -9136,9 +7925,9 @@ EOF
 	    done | sort | sort -uc >/dev/null 2>&1); then
 	  :
 	else
-	  echo "copying selected object files to avoid basename conflicts..."
+	  $ECHO "copying selected object files to avoid basename conflicts..."
 	  gentop="$output_objdir/${outputname}x"
-	  func_append generated " $gentop"
+	  generated="$generated $gentop"
 	  func_mkdir_p "$gentop"
 	  save_oldobjs=$oldobjs
 	  oldobjs=
@@ -9162,30 +7951,18 @@ EOF
 		esac
 	      done
 	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
-	      func_append oldobjs " $gentop/$newobj"
+	      oldobjs="$oldobjs $gentop/$newobj"
 	      ;;
-	    *) func_append oldobjs " $obj" ;;
+	    *) oldobjs="$oldobjs $obj" ;;
 	    esac
 	  done
 	fi
-	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
-	tool_oldlib=$func_to_tool_file_result
 	eval cmds=\"$old_archive_cmds\"
 
 	func_len " $cmds"
 	len=$func_len_result
 	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
 	  cmds=$old_archive_cmds
-	elif test -n "$archiver_list_spec"; then
-	  func_verbose "using command file archive linking..."
-	  for obj in $oldobjs
-	  do
-	    func_to_tool_file "$obj"
-	    $ECHO "$func_to_tool_file_result"
-	  done > $output_objdir/$libname.libcmd
-	  func_to_tool_file "$output_objdir/$libname.libcmd"
-	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
-	  cmds=$old_archive_cmds
 	else
 	  # the command line is too long to link in one step, link in parts
 	  func_verbose "using piecewise archive linking..."
@@ -9259,7 +8036,7 @@ EOF
       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 "$relink_command" | $SED "$sed_quote_subst"`
+      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
       if test "$hardcode_automatic" = yes ; then
 	relink_command=
       fi
@@ -9279,23 +8056,12 @@ EOF
 	      *.la)
 		func_basename "$deplib"
 		name="$func_basename_result"
-		func_resolve_sysroot "$deplib"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$deplib' is not a valid libtool archive"
-		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
-		;;
-	      -L*)
-		func_stripname -L '' "$deplib"
-		func_replace_sysroot "$func_stripname_result"
-		func_append newdependency_libs " -L$func_replace_sysroot_result"
+		newdependency_libs="$newdependency_libs $libdir/$name"
 		;;
-	      -R*)
-		func_stripname -R '' "$deplib"
-		func_replace_sysroot "$func_stripname_result"
-		func_append newdependency_libs " -R$func_replace_sysroot_result"
-		;;
-	      *) func_append newdependency_libs " $deplib" ;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
 	      esac
 	    done
 	    dependency_libs="$newdependency_libs"
@@ -9309,9 +8075,9 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+		newdlfiles="$newdlfiles $libdir/$name"
 		;;
-	      *) func_append newdlfiles " $lib" ;;
+	      *) newdlfiles="$newdlfiles $lib" ;;
 	      esac
 	    done
 	    dlfiles="$newdlfiles"
@@ -9328,7 +8094,7 @@ EOF
 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
 		  func_fatal_error "\`$lib' is not a valid libtool archive"
-		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+		newdlprefiles="$newdlprefiles $libdir/$name"
 		;;
 	      esac
 	    done
@@ -9340,7 +8106,7 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      func_append newdlfiles " $abs"
+	      newdlfiles="$newdlfiles $abs"
 	    done
 	    dlfiles="$newdlfiles"
 	    newdlprefiles=
@@ -9349,33 +8115,15 @@ EOF
 		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
-	      func_append newdlprefiles " $abs"
+	      newdlprefiles="$newdlprefiles $abs"
 	    done
 	    dlprefiles="$newdlprefiles"
 	  fi
 	  $RM $output
 	  # place dlname in correct position for cygwin
-	  # In fact, it would be nice if we could use this code for all target
-	  # systems that can't hard-code library paths into their executables
-	  # and that have no shared library path variable independent of PATH,
-	  # but it turns out we can't easily determine that from inspecting
-	  # libtool variables, so we have to hard-code the OSs to which it
-	  # applies here; at the moment, that means platforms that use the PE
-	  # object format with DLL files.  See the long comment at the top of
-	  # tests/bindir.at for full details.
 	  tdlname=$dlname
 	  case $host,$output,$installed,$module,$dlname in
-	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
-	      # If a -bindir argument was supplied, place the dll there.
-	      if test "x$bindir" != x ;
-	      then
-		func_relative_path "$install_libdir" "$bindir"
-		tdlname=$func_relative_path_result$dlname
-	      else
-		# Otherwise fall back on heuristic.
-		tdlname=../bin/$dlname
-	      fi
-	      ;;
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
 	  esac
 	  $ECHO > $output "\
 # $outputname - a libtool library file
@@ -9434,7 +8182,7 @@ relink_command=\"$relink_command\""
     exit $EXIT_SUCCESS
 }
 
-{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+{ test "$mode" = link || test "$mode" = relink; } &&
     func_mode_link ${1+"$@"}
 
 
@@ -9454,9 +8202,9 @@ func_mode_uninstall ()
     for arg
     do
       case $arg in
-      -f) func_append RM " $arg"; rmforce=yes ;;
-      -*) func_append RM " $arg" ;;
-      *) func_append files " $arg" ;;
+      -f) RM="$RM $arg"; rmforce=yes ;;
+      -*) RM="$RM $arg" ;;
+      *) files="$files $arg" ;;
       esac
     done
 
@@ -9465,23 +8213,24 @@ func_mode_uninstall ()
 
     rmdirs=
 
+    origobjdir="$objdir"
     for file in $files; do
       func_dirname "$file" "" "."
       dir="$func_dirname_result"
       if test "X$dir" = X.; then
-	odir="$objdir"
+	objdir="$origobjdir"
       else
-	odir="$dir/$objdir"
+	objdir="$dir/$origobjdir"
       fi
       func_basename "$file"
       name="$func_basename_result"
-      test "$opt_mode" = uninstall && odir="$dir"
+      test "$mode" = uninstall && objdir="$dir"
 
-      # Remember odir for removal later, being careful to avoid duplicates
-      if test "$opt_mode" = clean; then
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
 	case " $rmdirs " in
-	  *" $odir "*) ;;
-	  *) func_append rmdirs " $odir" ;;
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
 	esac
       fi
 
@@ -9507,17 +8256,18 @@ func_mode_uninstall ()
 
 	  # Delete the libtool libraries and symlinks.
 	  for n in $library_names; do
-	    func_append rmfiles " $odir/$n"
+	    rmfiles="$rmfiles $objdir/$n"
 	  done
-	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
 
-	  case "$opt_mode" in
+	  case "$mode" in
 	  clean)
-	    case " $library_names " in
+	    case "  $library_names " in
+	    # "  " in the beginning catches empty $dlname
 	    *" $dlname "*) ;;
-	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
 	    esac
-	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 	    ;;
 	  uninstall)
 	    if test -n "$library_names"; then
@@ -9545,19 +8295,19 @@ func_mode_uninstall ()
 	  # Add PIC object to the list of files to remove.
 	  if test -n "$pic_object" &&
 	     test "$pic_object" != none; then
-	    func_append rmfiles " $dir/$pic_object"
+	    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
-	    func_append rmfiles " $dir/$non_pic_object"
+	    rmfiles="$rmfiles $dir/$non_pic_object"
 	  fi
 	fi
 	;;
 
       *)
-	if test "$opt_mode" = clean ; then
+	if test "$mode" = clean ; then
 	  noexename=$name
 	  case $file in
 	  *.exe)
@@ -9567,7 +8317,7 @@ func_mode_uninstall ()
 	    noexename=$func_stripname_result
 	    # $file with .exe has already been added to rmfiles,
 	    # add $file without .exe
-	    func_append rmfiles " $file"
+	    rmfiles="$rmfiles $file"
 	    ;;
 	  esac
 	  # Do a test to see if this is a libtool program.
@@ -9576,7 +8326,7 @@ func_mode_uninstall ()
 	      func_ltwrapper_scriptname "$file"
 	      relink_command=
 	      func_source $func_ltwrapper_scriptname_result
-	      func_append rmfiles " $func_ltwrapper_scriptname_result"
+	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
 	    else
 	      relink_command=
 	      func_source $dir/$noexename
@@ -9584,12 +8334,12 @@ func_mode_uninstall ()
 
 	    # note $name still contains .exe if it was in $file originally
 	    # as does the version of $file that was added into $rmfiles
-	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
 	    if test "$fast_install" = yes && test -n "$relink_command"; then
-	      func_append rmfiles " $odir/lt-$name"
+	      rmfiles="$rmfiles $objdir/lt-$name"
 	    fi
 	    if test "X$noexename" != "X$name" ; then
-	      func_append rmfiles " $odir/lt-${noexename}.c"
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
 	    fi
 	  fi
 	fi
@@ -9597,6 +8347,7 @@ func_mode_uninstall ()
       esac
       func_show_eval "$RM $rmfiles" 'exit_status=1'
     done
+    objdir="$origobjdir"
 
     # Try to remove the ${objdir}s in the directories where we deleted files
     for dir in $rmdirs; do
@@ -9608,16 +8359,16 @@ func_mode_uninstall ()
     exit $exit_status
 }
 
-{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+{ test "$mode" = uninstall || test "$mode" = clean; } &&
     func_mode_uninstall ${1+"$@"}
 
-test -z "$opt_mode" && {
+test -z "$mode" && {
   help="$generic_help"
   func_fatal_help "you must specify a MODE"
 }
 
 test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$opt_mode'"
+  func_fatal_help "invalid operation mode \`$mode'"
 
 if test -n "$exec_cmd"; then
   eval exec "$exec_cmd"
diff --git a/config/ltoptions.m4 b/config/ltoptions.m4
new file mode 100644
index 0000000..34151a3
--- /dev/null
+++ b/config/ltoptions.m4
@@ -0,0 +1,368 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [0], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/config/ltsugar.m4 b/config/ltsugar.m4
new file mode 100644
index 0000000..9000a05
--- /dev/null
+++ b/config/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/config/ltversion.m4 b/config/ltversion.m4
new file mode 100644
index 0000000..f3c5309
--- /dev/null
+++ b/config/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# Generated from ltversion.in.
+
+# serial 3017 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.2.6b'
+macro_revision='1.3017'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/config/lt~obsolete.m4 b/config/lt~obsolete.m4
new file mode 100644
index 0000000..637bb20
--- /dev/null
+++ b/config/lt~obsolete.m4
@@ -0,0 +1,92 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 4 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_RC],		[AC_DEFUN([AC_LIBTOOL_RC])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
diff --git a/config/missing b/config/missing
index 86a8fc3..28055d2 100755
--- a/config/missing
+++ b/config/missing
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2012-01-06.13; # UTC
+scriptversion=2009-04-28.21; # UTC
 
 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# 2008, 2009 Free Software Foundation, Inc.
 # Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
@@ -84,6 +84,7 @@ Supported PROGRAM values:
   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]
 
 Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
@@ -121,6 +122,15 @@ case $1 in
     # 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.
@@ -216,7 +226,7 @@ WARNING: \`$1' $msg.  You should only need it if
          \`Bison' from any GNU archive site."
     rm -f y.tab.c y.tab.h
     if test $# -ne 1; then
-        eval LASTARG=\${$#}
+        eval LASTARG="\${$#}"
 	case $LASTARG in
 	*.y)
 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
@@ -246,7 +256,7 @@ WARNING: \`$1' is $msg.  You should only need it if
          \`Flex' from any GNU archive site."
     rm -f lex.yy.c
     if test $# -ne 1; then
-        eval LASTARG=\${$#}
+        eval LASTARG="\${$#}"
 	case $LASTARG in
 	*.l)
 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
@@ -308,6 +318,41 @@ WARNING: \`$1' is $msg.  You should only need it if
     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.
diff --git a/config/osmvsel.m4 b/config/osmvsel.m4
index 6c98c07..87e1d74 100644
--- a/config/osmvsel.m4
+++ b/config/osmvsel.m4
@@ -183,6 +183,7 @@ AC_DEFUN([OPENIB_OSM_CONSOLE_SOCKET_SEL], [
 # --- BEGIN OPENIB_OSM_CONSOLE_SOCKET_SEL ---
 
 dnl Console over a loopback socket is default if libwrap is available
+AC_MSG_CHECKING([to enable console loopback])
 AC_ARG_ENABLE(console-loopback,
 [  --enable-console-loopback Enable a console socket on the loopback interface, requires tcp_wrappers (default yes)],
 [case $enableval in
@@ -190,6 +191,7 @@ AC_ARG_ENABLE(console-loopback,
      no)  console_loopback=no ;;
    esac],
    console_loopback=yes)
+AC_MSG_RESULT([$console_loopback])
 
 if test $console_loopback = yes; then
 AC_CHECK_LIB(wrap, request_init, [], [console_loopback=no
@@ -202,6 +204,7 @@ if test $console_loopback = yes; then
 fi
 
 dnl Console over a socket connection
+AC_MSG_CHECKING([to enable console socket])
 AC_ARG_ENABLE(console-socket,
 [  --enable-console-socket Enable a console socket, requires --enable-console-loopback (default no)],
 [case $enableval in
@@ -209,6 +212,8 @@ AC_ARG_ENABLE(console-socket,
      no)  console_socket=no ;;
    esac],
    console_socket=no)
+AC_MSG_RESULT([$console_socket])
+
 if test $console_socket = yes; then
   if test $console_loopback = no; then
     AC_MSG_ERROR([--enable-console-socket requires --enable-console-loopback])
@@ -228,6 +233,7 @@ AC_DEFUN([OPENIB_OSM_PERF_MGR_SEL], [
 # --- BEGIN OPENIB_OSM_PERF_MGR_SEL ---
 
 dnl enable the perf-mgr
+AC_MSG_CHECKING([to enable perf mgr])
 AC_ARG_ENABLE(perf-mgr,
 [  --enable-perf-mgr Enable the performance manager (default yes)],
    [case $enableval in
@@ -235,6 +241,9 @@ AC_ARG_ENABLE(perf-mgr,
      no)  perf_mgr=no ;;
    esac],
    perf_mgr=yes)
+AC_MSG_RESULT([$perf_mgr])
+
+AC_MSG_CHECKING([to enable perf mgr profiling])
 AC_ARG_ENABLE(perf-mgr-profile,
 [  --enable-perf-mgr-profile Enable the performance manager profiling (default no)],
 	[case $enableval in
@@ -242,6 +251,8 @@ AC_ARG_ENABLE(perf-mgr-profile,
 	no)  perf_mgr_profile=no ;;
 	esac],
 	perf_mgr_profile=no)
+AC_MSG_RESULT([$perf_mgr_profile])
+
 if test $perf_mgr = yes; then
   AC_DEFINE(ENABLE_OSM_PERF_MGR,
 	1,
@@ -261,6 +272,7 @@ AC_DEFUN([OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL], [
 # --- BEGIN OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL ---
 
 dnl enable the default-event-plugin
+AC_MSG_CHECKING([to enable default event plugin])
 AC_ARG_ENABLE(default-event-plugin,
 [  --enable-default-event-plugin  Enable a default event plugin "osmeventplugin" (default no)],
    [case $enableval in
@@ -268,6 +280,8 @@ AC_ARG_ENABLE(default-event-plugin,
      no)  default_event_plugin=no ;;
    esac],
    default_event_plugin=no)
+AC_MSG_RESULT([$default_event_plugin])
+
 if test $default_event_plugin = yes; then
   AC_DEFINE(ENABLE_OSM_DEFAULT_EVENT_PLUGIN,
 	    1,
diff --git a/config/ylwrap b/config/ylwrap
index 9253635..84d5634 100755
--- a/config/ylwrap
+++ b/config/ylwrap
@@ -1,10 +1,10 @@
 #! /bin/sh
 # ylwrap - wrapper for lex/yacc invocations.
 
-scriptversion=2011-08-25.18; # UTC
+scriptversion=2009-04-28.21; # UTC
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
-# 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+# 2007, 2009 Free Software Foundation, Inc.
 #
 # Written by Tom Tromey <tromey at cygnus.com>.
 #
@@ -99,11 +99,7 @@ esac
 # FIXME: add hostname here for parallel makes that run commands on
 # other machines.  But that might take us over the 14-char limit.
 dirname=ylwrap$$
-do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
-trap "ret=129; $do_exit" 1
-trap "ret=130; $do_exit" 2
-trap "ret=141; $do_exit" 13
-trap "ret=143; $do_exit" 15
+trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
 mkdir $dirname || exit 1
 
 cd $dirname
@@ -137,19 +133,19 @@ if test $ret -eq 0; then
     # Handle y_tab.c and y_tab.h output by DOS
     if test $y_tab_nodot = "yes"; then
       if test $from = "y.tab.c"; then
-        from="y_tab.c"
+    	from="y_tab.c"
       else
-        if test $from = "y.tab.h"; then
-          from="y_tab.h"
-        fi
+    	if test $from = "y.tab.h"; then
+    	  from="y_tab.h"
+    	fi
       fi
     fi
     if test -f "$from"; then
       # If $2 is an absolute path name, then just use that,
       # otherwise prepend `../'.
       case "$2" in
-        [\\/]* | ?:[\\/]*) target="$2";;
-        *) target="../$2";;
+    	[\\/]* | ?:[\\/]*) target="$2";;
+    	*) target="../$2";;
       esac
 
       # We do not want to overwrite a header file if it hasn't
@@ -159,8 +155,8 @@ if test $ret -eq 0; then
       # Makefile.  Divert the output of all other files to a temporary
       # file so we can compare them to existing versions.
       if test $first = no; then
-        realtarget="$target"
-        target="tmp-`echo $target | sed s/.*[\\/]//g`"
+	realtarget="$target"
+	target="tmp-`echo $target | sed s/.*[\\/]//g`"
       fi
       # Edit out `#line' or `#' directives.
       #
@@ -184,10 +180,10 @@ if test $ret -eq 0; then
 
       # Check whether header files must be updated.
       if test $first = no; then
-        if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
-          echo "$2" is unchanged
-          rm -f "$target"
-        else
+	if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
+	  echo "$2" is unchanged
+	  rm -f "$target"
+	else
           echo updating "$2"
           mv -f "$target" "$realtarget"
         fi
diff --git a/configure b/configure
index 800421c..7be8a3b 100755
--- a/configure
+++ b/configure
@@ -1,13 +1,11 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for opensm 3.3.15.
+# Generated by GNU Autoconf 2.69 for opensm 3.3.17.
 #
 # Report bugs to <linux-rdma at vger.kernel.org>.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -136,6 +134,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -169,19 +192,12 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
   test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-
-  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
-    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
-    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
-    PATH=/empty FPATH=/empty; export PATH FPATH
-    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
-      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1
 test \$(( 1 + 1 )) = 2 || exit 1"
   if (eval "$as_required") 2>/dev/null; then :
   as_have_required=yes
@@ -222,21 +238,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-	# neutralization value for shells without unset; and this also
-	# works around shells that cannot unset nonexistent variables.
-	# Preserve -v and -x to the replacement shell.
-	BASH_ENV=/dev/null
-	ENV=/dev/null
-	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-	export CONFIG_SHELL
-	case $- in # ((((
-	  *v*x* | *x*v* ) as_opts=-vx ;;
-	  *v* ) as_opts=-v ;;
-	  *x* ) as_opts=-x ;;
-	  * ) as_opts= ;;
-	esac
-	exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -339,6 +359,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -460,6 +488,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -494,16 +526,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -515,28 +547,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -544,8 +556,155 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 # Sed expression to map a string onto a valid variable name.
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
+
+
+# Check that we are running under the correct shell.
 SHELL=${CONFIG_SHELL-/bin/sh}
 
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<_LT_EOF
+$*
+_LT_EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+  if test "X${echo_test_string+set}" != Xset; then
+    # find a string as large as possible, as long as the shell can cope with it
+    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+      then
+        break
+      fi
+    done
+  fi
+
+  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+     test "X$echo_testing_string" = "X$echo_test_string"; then
+    :
+  else
+    # The Solaris, AIX, and Digital Unix default echo programs unquote
+    # backslashes.  This makes it impossible to quote backslashes using
+    #   echo "$something" | sed 's/\\/\\\\/g'
+    #
+    # So, first we look for a working echo in the user's PATH.
+
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for dir in $PATH /usr/ucb; do
+      IFS="$lt_save_ifs"
+      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        ECHO="$dir/echo"
+        break
+      fi
+    done
+    IFS="$lt_save_ifs"
+
+    if test "X$ECHO" = Xecho; then
+      # We didn't find a better echo, so look for alternatives.
+      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        # This shell has a builtin print -r that does the trick.
+        ECHO='print -r'
+      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+	   test "X$CONFIG_SHELL" != X/bin/ksh; then
+        # If we have ksh, try running configure again with it.
+        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+        export ORIGINAL_CONFIG_SHELL
+        CONFIG_SHELL=/bin/ksh
+        export CONFIG_SHELL
+        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+      else
+        # Try using printf.
+        ECHO='printf %s\n'
+        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	  # Cool, printf works
+	  :
+        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	  export CONFIG_SHELL
+	  SHELL="$CONFIG_SHELL"
+	  export SHELL
+	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
+        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
+        else
+	  # maybe with a smaller string...
+	  prev=:
+
+	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+	    then
+	      break
+	    fi
+	    prev="$cmd"
+	  done
+
+	  if test "$prev" != 'sed 50q "$0"'; then
+	    echo_test_string=`eval $prev`
+	    export echo_test_string
+	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	  else
+	    # Oops.  We lost completely, so just stick with echo.
+	    ECHO=echo
+	  fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
 
 test -n "$DJDIR" || exec 7<&0 </dev/null
 exec 6>&1
@@ -570,8 +729,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='opensm'
 PACKAGE_TARNAME='opensm'
-PACKAGE_VERSION='3.3.15'
-PACKAGE_STRING='opensm 3.3.15'
+PACKAGE_VERSION='3.3.17'
+PACKAGE_STRING='opensm 3.3.17'
 PACKAGE_BUGREPORT='linux-rdma at vger.kernel.org'
 PACKAGE_URL=''
 
@@ -653,11 +812,9 @@ OTOOL
 LIPO
 NMEDIT
 DSYMUTIL
-MANIFEST_TOOL
+lt_ECHO
 RANLIB
-ac_ct_AR
 AR
-DLLTOOL
 OBJDUMP
 LN_S
 NM
@@ -680,7 +837,6 @@ LIBTOOL
 am__fastdepCC_FALSE
 am__fastdepCC_TRUE
 CCDEPMODE
-am__nodep
 AMDEPBACKSLASH
 AMDEP_FALSE
 AMDEP_TRUE
@@ -694,6 +850,9 @@ CPPFLAGS
 LDFLAGS
 CFLAGS
 CC
+DEFAULT_STOP
+DEFAULT_START
+RDMA_SERVICE
 TARBALL
 RELEASE
 am__untar
@@ -760,13 +919,13 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
+with_rdma_service
 enable_dependency_tracking
 enable_shared
 enable_static
 with_pic
 enable_fast_install
 with_gnu_ld
-with_sysroot
 enable_libtool_lock
 enable_debug
 enable_libcheck
@@ -1254,8 +1413,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1341,7 +1498,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures opensm 3.3.15 to adapt to many kinds of systems.
+\`configure' configures opensm 3.3.17 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1411,7 +1568,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of opensm 3.3.15:";;
+     short | recursive ) echo "Configuration of opensm 3.3.17:";;
    esac
   cat <<\_ACEOF
 
@@ -1437,11 +1594,14 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
+  --with-rdma-service=name
+                          name of the RDMA service: "rdma" when using
+                          /etc/init.d/rdma to start RDMA services; "openibd"
+                          when using /etc/init.d/openibd to start RDMA
+                          services [default=${default_rdma_service}]
+  --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-  --with-sysroot=DIR Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).
   --with-opensm-conf-sub-dir=dir
                           define a directory name for opensm's conf files
                           <sysconfdir>/<dir> (default "opensm")
@@ -1555,10 +1715,10 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-opensm configure 3.3.15
-generated by GNU Autoconf 2.68
+opensm configure 3.3.17
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1634,7 +1794,7 @@ $as_echo "$ac_try_echo"; } >&5
 	 test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
 	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
+	 test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -1978,8 +2138,8 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by opensm $as_me 3.3.15, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+It was created by opensm $as_me 3.3.17, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -2398,7 +2558,7 @@ case $as_dir/ in #((
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
 	  if test $ac_prog = install &&
 	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
 	    # AIX install.  It has an incompatible calling convention.
@@ -2567,7 +2727,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2607,7 +2767,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2658,7 +2818,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_prog in mkdir gmkdir; do
 	 for ac_exec_ext in '' $ac_executable_extensions; do
-	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
 	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
 	     'mkdir (GNU coreutils) '* | \
 	     'mkdir (coreutils) '* | \
@@ -2711,7 +2871,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_AWK="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2797,7 +2957,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='opensm'
- VERSION='3.3.15'
+ VERSION='3.3.17'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2827,11 +2987,11 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
-# Always define AMTAR for backward compatibility.  Yes, it's still used
-# in the wild :-(  We should find a proper way to deprecate it ...
-AMTAR='$${TAR-tar}'
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
 
-am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
 
 
 
@@ -2843,6 +3003,29 @@ RELEASE=${RELEASE:-unknown}
 TARBALL=${TARBALL:-${PACKAGE}-${VERSION}.tar.gz}
 
 
+default_rdma_service=openibd
+
+# Check whether --with-rdma_service was given.
+if test "${with_rdma_service+set}" = set; then :
+  withval=$with_rdma_service;
+fi
+
+RDMA_SERVICE=${with_rdma_service:-${default_rdma_service}}
+
+
+if { rpm -q sles-release || rpm -q openSUSE-release; } >/dev/null 2>&1; then
+   default_stop="0 1 4 6"
+else
+   default_stop="0 1 6"
+fi
+
+default_start="null"
+
+DEFAULT_START=$default_start
+
+DEFAULT_STOP=$default_stop
+
+
 
 $as_echo "#define _OSM_CONFIG_H_ 1" >>confdefs.h
 
@@ -2907,7 +3090,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2947,7 +3130,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3000,7 +3183,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3041,7 +3224,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -3099,7 +3282,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3143,7 +3326,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -3589,8 +3772,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3726,7 +3908,6 @@ fi
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
-  am__nodep='_no'
 fi
  if test "x$enable_dependency_tracking" != xno; then
   AMDEP_TRUE=
@@ -3751,7 +3932,6 @@ else
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
-  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -3811,7 +3991,7 @@ else
 	break
       fi
       ;;
-    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+    msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -3874,8 +4054,8 @@ esac
 
 
 
-macro_version='2.4.2'
-macro_revision='1.3337'
+macro_version='2.2.6b'
+macro_revision='1.3017'
 
 
 
@@ -3962,75 +4142,6 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
-ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
-$as_echo_n "checking how to print strings... " >&6; }
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
-   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
-  ECHO='printf %s\n'
-else
-  # Use this function as a fallback that always works.
-  func_fallback_echo ()
-  {
-    eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-  }
-  ECHO='func_fallback_echo'
-fi
-
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO ""
-}
-
-case "$ECHO" in
-  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
-$as_echo "printf" >&6; } ;;
-  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
-$as_echo "print -r" >&6; } ;;
-  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
-$as_echo "cat" >&6; } ;;
-esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
 if ${ac_cv_path_SED+:} false; then :
@@ -4053,7 +4164,7 @@ do
     for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+      as_fn_executable_p "$ac_path_SED" || continue
 # Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
@@ -4129,7 +4240,7 @@ do
     for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+      as_fn_executable_p "$ac_path_GREP" || continue
 # Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
@@ -4195,7 +4306,7 @@ do
     for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+      as_fn_executable_p "$ac_path_EGREP" || continue
 # Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
@@ -4262,7 +4373,7 @@ do
     for ac_prog in fgrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+      as_fn_executable_p "$ac_path_FGREP" || continue
 # Check for GNU ac_path_FGREP and select it if it is found.
   # Check for GNU $ac_path_FGREP
 case `"$ac_path_FGREP" --version 2>&1` in
@@ -4496,11 +4607,8 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  if test -n "$DUMPBIN"; then :
-    # Let the user override the test.
-  else
-    if test -n "$ac_tool_prefix"; then
-  for ac_prog in dumpbin "link -dump"
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
@@ -4518,7 +4626,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4544,7 +4652,7 @@ fi
 fi
 if test -z "$DUMPBIN"; then
   ac_ct_DUMPBIN=$DUMPBIN
-  for ac_prog in dumpbin "link -dump"
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -4562,7 +4670,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -4599,15 +4707,6 @@ esac
   fi
 fi
 
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
-    *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
-      ;;
-    *)
-      DUMPBIN=:
-      ;;
-    esac
-  fi
 
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -4627,13 +4726,13 @@ if ${lt_cv_nm_interface+:} false; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4729: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4732: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+  (eval echo "\"\$as_me:4735: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -4690,11 +4789,6 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  mint*)
-    # On MiNT this can take a long time and run out of memory.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -4720,11 +4814,6 @@ else
     lt_cv_sys_max_cmd_len=196608
     ;;
 
-  os2*)
-    # The test takes a long time on OS/2.
-    lt_cv_sys_max_cmd_len=8192
-    ;;
-
   osf*)
     # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
     # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -4764,8 +4853,8 @@ else
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
-	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -4807,8 +4896,8 @@ $as_echo_n "checking whether the shell understands some XSI constructs... " >&6;
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
@@ -4857,80 +4946,6 @@ esac
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
-$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
-if ${lt_cv_to_host_file_cmd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
-        ;;
-    esac
-    ;;
-  *-*-cygwin* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
-        ;;
-      *-*-cygwin* )
-        lt_cv_to_host_file_cmd=func_convert_file_noop
-        ;;
-      * ) # otherwise, assume *nix
-        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
-        ;;
-    esac
-    ;;
-  * ) # unhandled hosts (and "normal" native builds)
-    lt_cv_to_host_file_cmd=func_convert_file_noop
-    ;;
-esac
-
-fi
-
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
-$as_echo "$lt_cv_to_host_file_cmd" >&6; }
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
-$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
-if ${lt_cv_to_tool_file_cmd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  #assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
-  *-*-mingw* )
-    case $build in
-      *-*-mingw* ) # actually msys
-        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
-        ;;
-    esac
-    ;;
-esac
-
-fi
-
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
-$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
-
-
-
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
 $as_echo_n "checking for $LD option to reload object files... " >&6; }
 if ${lt_cv_ld_reload_flag+:} false; then :
@@ -4947,11 +4962,6 @@ case $reload_flag in
 esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
-  cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
-      reload_cmds=false
-    fi
-    ;;
   darwin*)
     if test "$GCC" = yes; then
       reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -4986,7 +4996,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5026,7 +5036,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OBJDUMP="objdump"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5115,18 +5125,16 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+  if ( file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    # Keep this pattern in sync with the one in func_win32_libid.
-    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc*)
+cegcc)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -5156,10 +5164,6 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-haiku*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -5168,11 +5172,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -5193,8 +5197,8 @@ irix5* | irix6* | nonstopux*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -5275,21 +5279,6 @@ esac
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
 $as_echo "$lt_cv_deplibs_check_method" >&6; }
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
-  case $host_os in
-  mingw* | pw32*)
-    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
-      want_nocaseglob=yes
-    else
-      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
-    fi
-    ;;
-  esac
-fi
-
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -5305,26 +5294,16 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 
 
-
-
-
-
-
-
-
-
-
-
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DLLTOOL+:} false; then :
+if ${ac_cv_prog_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$DLLTOOL"; then
-  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -5332,8 +5311,8 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5343,10 +5322,10 @@ IFS=$as_save_IFS
 
 fi
 fi
-DLLTOOL=$ac_cv_prog_DLLTOOL
-if test -n "$DLLTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
-$as_echo "$DLLTOOL" >&6; }
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -5354,17 +5333,17 @@ fi
 
 
 fi
-if test -z "$ac_cv_prog_DLLTOOL"; then
-  ac_ct_DLLTOOL=$DLLTOOL
-  # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_DLLTOOL"; then
-  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -5372,8 +5351,8 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_AR="ar"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5383,17 +5362,17 @@ IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
-if test -n "$ac_ct_DLLTOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
-$as_echo "$ac_ct_DLLTOOL" >&6; }
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_DLLTOOL" = x; then
-    DLLTOOL="false"
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
@@ -5401,16 +5380,14 @@ yes:)
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    DLLTOOL=$ac_ct_DLLTOOL
+    AR=$ac_ct_AR
   fi
 else
-  DLLTOOL="$ac_cv_prog_DLLTOOL"
+  AR="$ac_cv_prog_AR"
 fi
 
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-
-
-
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
 
 
 
@@ -5418,57 +5395,20 @@ test -z "$DLLTOOL" && DLLTOOL=dlltool
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
-$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
-if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
-  case `$DLLTOOL --help 2>&1` in
-  *--identify-strict*)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
-    ;;
-  *)
-    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
-    ;;
-  esac
-  ;;
-*)
-  # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
-  ;;
-esac
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
-$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-
-
-
 
 
 
 
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in ar
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AR+:} false; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$AR"; then
-  ac_cv_prog_AR="$AR" # Let the user override the test.
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -5476,8 +5416,8 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -5487,179 +5427,10 @@ IFS=$as_save_IFS
 
 fi
 fi
-AR=$ac_cv_prog_AR
-if test -n "$AR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
-$as_echo "$AR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-    test -n "$AR" && break
-  done
-fi
-if test -z "$AR"; then
-  ac_ct_AR=$AR
-  for ac_prog in ar
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AR+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_AR"; then
-  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_AR="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_AR=$ac_cv_prog_ac_ct_AR
-if test -n "$ac_ct_AR"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  test -n "$ac_ct_AR" && break
-done
-
-  if test "x$ac_ct_AR" = x; then
-    AR="false"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    AR=$ac_ct_AR
-  fi
-fi
-
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
-$as_echo_n "checking for archiver @FILE support... " >&6; }
-if ${lt_cv_ar_at_file+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ar_at_file=no
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  echo conftest.$ac_objext > conftest.lst
-      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
-      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
-  (eval $lt_ar_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-      if test "$ac_status" -eq 0; then
-	# Ensure the archiver fails upon bogus file names.
-	rm -f conftest.$ac_objext libconftest.a
-	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
-  (eval $lt_ar_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-	if test "$ac_status" -ne 0; then
-          lt_cv_ar_at_file=@
-        fi
-      fi
-      rm -f conftest.* libconftest.a
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
-$as_echo "$lt_cv_ar_at_file" >&6; }
-
-if test "x$lt_cv_ar_at_file" = xno; then
-  archiver_list_spec=
-else
-  archiver_list_spec=$lt_cv_ar_at_file
-fi
-
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -5685,7 +5456,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_STRIP="strip"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5744,7 +5515,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5784,7 +5555,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -5834,27 +5605,15 @@ old_postuninstall_cmds=
 if test -n "$RANLIB"; then
   case $host_os in
   openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
 
-case $host_os in
-  darwin*)
-    lock_old_archive_extraction=yes ;;
-  *)
-    lock_old_archive_extraction=no ;;
-esac
-
-
-
-
-
-
 
 
 
@@ -5962,8 +5721,8 @@ esac
 lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -5987,7 +5746,6 @@ for ac_symprfx in "" "_"; do
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK '"\
 "     {last_section=section; section=\$ 3};"\
-"     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
@@ -6000,7 +5758,6 @@ for ac_symprfx in "" "_"; do
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
   fi
-  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
 
   # Check to see that the pipe works correctly.
   pipe_works=no
@@ -6026,8 +5783,8 @@ _LT_EOF
   test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
-  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; } && test -s "$nlist"; then
@@ -6042,18 +5799,6 @@ _LT_EOF
       if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
-   relocations are performed -- see ld's documentation on pseudo-relocs.  */
-# define LT_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data.  */
-# define LT_DLSYM_CONST
-#else
-# define LT_DLSYM_CONST const
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -6065,7 +5810,7 @@ _LT_EOF
 	  cat <<_LT_EOF >> conftest.$ac_ext
 
 /* The mapping between symbol names and symbols.  */
-LT_DLSYM_CONST struct {
+const struct {
   const char *name;
   void       *address;
 }
@@ -6091,8 +5836,8 @@ static const void *lt_preloaded_setup() {
 _LT_EOF
 	  # Now try linking the two files.
 	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_globsym_save_LIBS=$LIBS
-	  lt_globsym_save_CFLAGS=$CFLAGS
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
 	  LIBS="conftstm.$ac_objext"
 	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
 	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
@@ -6102,8 +5847,8 @@ _LT_EOF
   test $ac_status = 0; } && test -s conftest${ac_exeext}; then
 	    pipe_works=yes
 	  fi
-	  LIBS=$lt_globsym_save_LIBS
-	  CFLAGS=$lt_globsym_save_CFLAGS
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
 	else
 	  echo "cannot find nm_test_func in $nlist" >&5
 	fi
@@ -6140,17 +5885,6 @@ else
 $as_echo "ok" >&6; }
 fi
 
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-  nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
-  nm_file_list_spec='@'
-fi
-
-
-
-
-
 
 
 
@@ -6173,43 +5907,6 @@ fi
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
-$as_echo_n "checking for sysroot... " >&6; }
-
-# Check whether --with-sysroot was given.
-if test "${with_sysroot+set}" = set; then :
-  withval=$with_sysroot;
-else
-  with_sysroot=no
-fi
-
-
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
-   if test "$GCC" = yes; then
-     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
-   fi
-   ;; #(
- /*)
-   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
-   ;; #(
- no|'')
-   ;; #(
- *)
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
-$as_echo "${with_sysroot}" >&6; }
-   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
-   ;;
-esac
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
-$as_echo "${lt_sysroot:-no}" >&6; }
-
-
-
-
-
 # Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
@@ -6241,7 +5938,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  echo '#line 5941 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -6376,7 +6073,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
     CFLAGS="$SAVE_CFLAGS"
   fi
   ;;
-*-*solaris*)
+sparc*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -6387,20 +6084,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
-      yes*)
-        case $host in
-        i?86-*-solaris*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        sparc*-*-solaris*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-        esac
-        # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
-        if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
-        fi
-        ;;
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
       *)
 	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
 	  LD="${LD-ld} -64"
@@ -6416,123 +6100,6 @@ esac
 
 need_locks="$enable_libtool_lock"
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
-set dummy ${ac_tool_prefix}mt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$MANIFEST_TOOL"; then
-  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
-if test -n "$MANIFEST_TOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
-$as_echo "$MANIFEST_TOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
-  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
-  # Extract the first word of "mt", so it can be a program name with args.
-set dummy mt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_MANIFEST_TOOL"; then
-  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
-if test -n "$ac_ct_MANIFEST_TOOL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
-$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_MANIFEST_TOOL" = x; then
-    MANIFEST_TOOL=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
-  fi
-else
-  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
-fi
-
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
-$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
-if ${lt_cv_path_mainfest_tool+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_path_mainfest_tool=no
-  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
-  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
-  cat conftest.err >&5
-  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
-    lt_cv_path_mainfest_tool=yes
-  fi
-  rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
-$as_echo "$lt_cv_path_mainfest_tool" >&6; }
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
-  MANIFEST_TOOL=:
-fi
-
-
-
-
-
 
   case $host_os in
     rhapsody* | darwin*)
@@ -6553,7 +6120,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6593,7 +6160,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6645,7 +6212,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6685,7 +6252,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_NMEDIT="nmedit"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6737,7 +6304,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6777,7 +6344,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_LIPO="lipo"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6829,7 +6396,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6869,7 +6436,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL="otool"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6921,7 +6488,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -6961,7 +6528,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_OTOOL64="otool64"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -7040,13 +6607,7 @@ else
 	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
 	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
         _lt_result=$?
-	# If there is a non-empty error log, and "single_module"
-	# appears in it, assume the flag caused a linker warning
-        if test -s conftest.err && $GREP single_module conftest.err; then
-	  cat conftest.err >&5
-	# Otherwise, if the output was created with a 0 exit code from
-	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&5
@@ -7057,7 +6618,6 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
 $as_echo "$lt_cv_apple_cc_single_mod" >&6; }
-
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
 if ${lt_cv_ld_exported_symbols_list+:} false; then :
@@ -7090,41 +6650,6 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
-$as_echo_n "checking for -force_load linker flag... " >&6; }
-if ${lt_cv_ld_force_load+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_ld_force_load=no
-      cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
-      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
-      echo "$AR cru libconftest.a conftest.o" >&5
-      $AR cru libconftest.a conftest.o 2>&5
-      echo "$RANLIB libconftest.a" >&5
-      $RANLIB libconftest.a 2>&5
-      cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
-      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
-      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
-      _lt_result=$?
-      if test -s conftest.err && $GREP force_load conftest.err; then
-	cat conftest.err >&5
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
-	lt_cv_ld_force_load=yes
-      else
-	cat conftest.err >&5
-      fi
-        rm -f conftest.err libconftest.a conftest conftest.c
-        rm -rf conftest.dSYM
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
-$as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -7152,7 +6677,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+    if test "$DSYMUTIL" != ":"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -7442,8 +6967,6 @@ done
 
 
 
-
-
 # Set options
 
 
@@ -7519,22 +7042,7 @@ fi
 
 # Check whether --with-pic was given.
 if test "${with_pic+set}" = set; then :
-  withval=$with_pic; lt_p=${PACKAGE-default}
-    case $withval in
-    yes|no) pic_mode=$withval ;;
-    *)
-      pic_mode=default
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
-	if test "X$lt_pkg" = "X$lt_p"; then
-	  pic_mode=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+  withval=$with_pic; pic_mode="$withval"
 else
   pic_mode=default
 fi
@@ -7611,11 +7119,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
 
 
-
-
-
-
-
 test -z "$LN_S" && LN_S="ln -s"
 
 
@@ -7665,6 +7168,19 @@ _ACEOF
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
 case $host_os in
 aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
@@ -7677,6 +7193,23 @@ aix3*)
   ;;
 esac
 
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -7705,7 +7238,7 @@ for cc_temp in $compiler""; do
     *) break;;
   esac
 done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
 
 # Only perform the check for file, if the check method requires it
@@ -7905,17 +7438,16 @@ _lt_linker_boilerplate=`cat conftest.err`
 $RM -r conftest*
 
 
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
 if test -n "$compiler"; then
 
 lt_prog_compiler_no_builtin_flag=
 
 if test "$GCC" = yes; then
-  case $cc_basename in
-  nvcc*)
-    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
-  *)
-    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
-  esac
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
@@ -7935,15 +7467,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7470: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:7474: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
@@ -7972,6 +7504,8 @@ fi
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -8019,12 +7553,6 @@ lt_prog_compiler_static=
       lt_prog_compiler_pic='-fno-common'
       ;;
 
-    haiku*)
-      # PIC is the default for Haiku.
-      # The "-static" flag exists, but is broken.
-      lt_prog_compiler_static=
-      ;;
-
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -8067,15 +7595,6 @@ lt_prog_compiler_static=
       lt_prog_compiler_pic='-fPIC'
       ;;
     esac
-
-    case $cc_basename in
-    nvcc*) # Cuda Compiler Driver 2.2
-      lt_prog_compiler_wl='-Xlinker '
-      if test -n "$lt_prog_compiler_pic"; then
-        lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
-      fi
-      ;;
-    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -8117,7 +7636,7 @@ lt_prog_compiler_static=
       lt_prog_compiler_static='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    linux* | k*bsd*-gnu)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -8138,13 +7657,7 @@ lt_prog_compiler_static=
 	lt_prog_compiler_pic='--shared'
 	lt_prog_compiler_static='--static'
 	;;
-      nagfor*)
-	# NAG Fortran compiler
-	lt_prog_compiler_wl='-Wl,-Wl,,'
-	lt_prog_compiler_pic='-PIC'
-	lt_prog_compiler_static='-Bstatic'
-	;;
-      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+      pgcc* | pgf77* | pgf90* | pgf95*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
 	lt_prog_compiler_wl='-Wl,'
@@ -8156,40 +7669,25 @@ lt_prog_compiler_static=
         # All Alpha code is PIC.
         lt_prog_compiler_static='-non_shared'
         ;;
-      xl* | bgxl* | bgf* | mpixl*)
-	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+      xl*)
+	# IBM XL C 8.0/Fortran 10.1 on PPC
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-qpic'
 	lt_prog_compiler_static='-qstaticlink'
 	;;
       *)
 	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
-	  ;;
-	*Sun\ F* | *Sun*Fortran*)
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Qoption ld '
-	  ;;
 	*Sun\ C*)
 	  # Sun C 5.9
 	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
 	  lt_prog_compiler_wl='-Wl,'
 	  ;;
-        *Intel*\ [CF]*Compiler*)
-	  lt_prog_compiler_wl='-Wl,'
-	  lt_prog_compiler_pic='-fPIC'
-	  lt_prog_compiler_static='-static'
-	  ;;
-	*Portland\ Group*)
-	  lt_prog_compiler_wl='-Wl,'
-	  lt_prog_compiler_pic='-fpic'
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
 	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
 	  ;;
 	esac
 	;;
@@ -8221,7 +7719,7 @@ lt_prog_compiler_static=
       lt_prog_compiler_pic='-KPIC'
       lt_prog_compiler_static='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+      f77* | f90* | f95*)
 	lt_prog_compiler_wl='-Qoption ld ';;
       *)
 	lt_prog_compiler_wl='-Wl,';;
@@ -8278,17 +7776,13 @@ case $host_os in
     lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
     ;;
 esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+
+
+
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
-$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
-if ${lt_cv_prog_compiler_pic+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
-$as_echo "$lt_cv_prog_compiler_pic" >&6; }
-lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
 #
 # Check to make sure the PIC flag actually works.
@@ -8312,15 +7806,15 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7809: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:7813: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works=yes
@@ -8349,11 +7843,6 @@ fi
 
 
 
-
-
-
-
-
 #
 # Check to make sure the static flag actually works.
 #
@@ -8373,7 +7862,7 @@ else
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&5
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          lt_cv_prog_compiler_static_works=yes
@@ -8422,16 +7911,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7914: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:7918: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -8477,16 +7966,16 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7969: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   echo "$as_me:7973: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -8552,6 +8041,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   hardcode_direct=no
   hardcode_direct_absolute=no
   hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
   hardcode_libdir_separator=
   hardcode_minus_L=no
   hardcode_shlibpath_var=unsupported
@@ -8598,33 +8088,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   esac
 
   ld_shlibs=yes
-
-  # On some targets, GNU ld is compatible enough with the native linker
-  # that we're better off using the native interface for both.
-  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
-    case $host_os in
-      aix*)
-	# The AIX port of GNU ld has always aspired to compatibility
-	# with the native linker.  However, as the warning in the GNU ld
-	# block says, versions before 2.19.5* couldn't really create working
-	# shared libraries, regardless of the interface used.
-	case `$LD -v 2>&1` in
-	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
-	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
-	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
-	  *)
-	    lt_use_gnu_ld_interface=yes
-	    ;;
-	esac
-	;;
-      *)
-	lt_use_gnu_ld_interface=yes
-	;;
-    esac
-  fi
-
-  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -8642,7 +8106,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     fi
     supports_anon_versioning=no
     case `$LD -v 2>&1` in
-      *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
       *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
@@ -8658,12 +8121,11 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to install binutils
-*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
-*** You will then need to restart the configuration process.
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
 
 _LT_EOF
       fi
@@ -8699,12 +8161,10 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
-      export_dynamic_flag_spec='${wl}--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
-      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
         archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
@@ -8722,11 +8182,6 @@ _LT_EOF
       fi
       ;;
 
-    haiku*)
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      link_all_deplibs=yes
-      ;;
-
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
@@ -8742,7 +8197,7 @@ _LT_EOF
       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
 	case $cc_basename in
@@ -8752,16 +8207,15 @@ _LT_EOF
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
 	 && test "$tmp_diet" = no
       then
-	tmp_addflag=' $pic_flag'
+	tmp_addflag=
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
-	pgf77* | pgf90* | pgf95* | pgfortran*)
-					# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -8772,17 +8226,13 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
-	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
-	nvcc*)	# Cuda Compiler Driver 2.2
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
-	  compiler_needs_object=yes
-	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
 	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
@@ -8798,16 +8248,17 @@ _LT_EOF
         fi
 
 	case $cc_basename in
-	xlf* | bgf* | bgxlf* | mpixlf*)
+	xlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  hardcode_libdir_flag_spec=
+	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
 	  if test "x$supports_anon_versioning" = xyes; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
 	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
 	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -8821,8 +8272,8 @@ _LT_EOF
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -8840,8 +8291,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8887,8 +8338,8 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -8928,10 +8379,8 @@ _LT_EOF
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
 	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
 	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
@@ -9018,13 +8467,7 @@ _LT_EOF
 	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath_+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -9037,32 +8480,25 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath_
-fi
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
 	if test "$host_cpu" = ia64; then
 	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
@@ -9071,13 +8507,7 @@ fi
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 if test "${lt_cv_aix_libpath+set}" = set; then
-  aix_libpath=$lt_cv_aix_libpath
-else
-  if ${lt_cv_aix_libpath_+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -9090,42 +8520,30 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
 
-  lt_aix_libpath_sed='
-      /Import File Strings/,/^$/ {
-	  /^0/ {
-	      s/^0  *\([^ ]*\) *$/\1/
-	      p
-	  }
-      }'
-  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  # Check for a 64-bit object if we didn't find anything.
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-  fi
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
-  fi
-
-fi
-
-  aix_libpath=$lt_cv_aix_libpath_
-fi
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
 	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
 	  no_undefined_flag=' ${wl}-bernotok'
 	  allow_undefined_flag=' ${wl}-berok'
-	  if test "$with_gnu_ld" = yes; then
-	    # We only use this code for GNU lds that support --whole-archive.
-	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	  else
-	    # Exported symbols can be pulled into shared objects from archives
-	    whole_archive_flag_spec='$convenience'
-	  fi
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec='$convenience'
 	  archive_cmds_need_lc=yes
 	  # This is similar to how AIX traditionally builds its shared libraries.
 	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -9157,64 +8575,20 @@ fi
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
       # no search path for DLLs.
-      case $cc_basename in
-      cl*)
-	# Native MSVC
-	hardcode_libdir_flag_spec=' '
-	allow_undefined_flag=unsupported
-	always_export_symbols=yes
-	file_list_spec='@'
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
-	# The linker will not automatically build a static lib if we build a DLL.
-	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
-	enable_shared_with_static_runtimes=yes
-	exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
-	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
-	# Don't use ranlib
-	old_postinstall_cmds='chmod 644 $oldlib'
-	postlink_cmds='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
-	;;
-      *)
-	# Assume MSVC wrapper
-	hardcode_libdir_flag_spec=' '
-	allow_undefined_flag=unsupported
-	# Tell ltmain to make .lib files, not .a files.
-	libext=lib
-	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
-	# FIXME: Setting linknames here is a bad hack.
-	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
-	# The linker will automatically build a .lib file if we build a DLL.
-	old_archive_from_new_cmds='true'
-	# FIXME: Should let the user specify the lib program.
-	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-	enable_shared_with_static_runtimes=yes
-	;;
-      esac
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_from_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
       ;;
 
     darwin* | rhapsody*)
@@ -9224,12 +8598,7 @@ fi
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-
-  else
-    whole_archive_flag_spec=''
-  fi
+  whole_archive_flag_spec=''
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -9237,7 +8606,7 @@ fi
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=func_echo_all
+    output_verbose_link_cmd=echo
     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -9255,6 +8624,10 @@ fi
       hardcode_shlibpath_var=no
       ;;
 
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
     # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
     # support.  Future versions do this automatically, but an explicit c++rt0.o
     # does not break anything, and helps significantly (at the cost of a little
@@ -9267,7 +8640,7 @@ fi
       ;;
 
     # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2.*)
+    freebsd2*)
       archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
       hardcode_minus_L=yes
@@ -9276,7 +8649,7 @@ fi
 
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
     freebsd* | dragonfly*)
-      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
       hardcode_libdir_flag_spec='-R$libdir'
       hardcode_direct=yes
       hardcode_shlibpath_var=no
@@ -9284,7 +8657,7 @@ fi
 
     hpux9*)
       if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       else
 	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
@@ -9299,13 +8672,14 @@ fi
       ;;
 
     hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
       if test "$with_gnu_ld" = no; then
 	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld='+b $libdir'
 	hardcode_libdir_separator=:
 	hardcode_direct=yes
 	hardcode_direct_absolute=yes
@@ -9317,16 +8691,16 @@ fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
 	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
@@ -9338,46 +8712,7 @@ fi
 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-
-	  # Older versions of the 11.00 compiler do not understand -b yet
-	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
-	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
-$as_echo_n "checking if $CC understands -b... " >&6; }
-if ${lt_cv_prog_compiler__b+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_prog_compiler__b=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS -b"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler__b=yes
-       fi
-     else
-       lt_cv_prog_compiler__b=yes
-     fi
-   fi
-   $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
-$as_echo "$lt_cv_prog_compiler__b" >&6; }
-
-if test x"$lt_cv_prog_compiler__b" = xyes; then
-    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-else
-    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-fi
-
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       fi
@@ -9405,39 +8740,26 @@ fi
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
-	# This should be the same for all languages, so no per-tag cache variable.
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
-$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
-if ${lt_cv_irix_exported_symbol+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-int foo (void) { return 0; }
+int foo(void) {}
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  lt_cv_irix_exported_symbol=yes
-else
-  lt_cv_irix_exported_symbol=no
+  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-           LDFLAGS="$save_LDFLAGS"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
-$as_echo "$lt_cv_irix_exported_symbol" >&6; }
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
-	fi
+        LDFLAGS="$save_LDFLAGS"
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -9499,17 +8821,17 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
       hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
@@ -9519,13 +8841,13 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
 	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
 	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -9538,9 +8860,9 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       no_undefined_flag=' -z defs'
       if test "$GCC" = yes; then
 	wlarc='${wl}'
-	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
@@ -9728,50 +9050,44 @@ x|xyes)
       # to ld, don't add -lc before -lgcc.
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
-if ${lt_cv_archive_cmds_need_lc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  $RM conftest*
-	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } 2>conftest.err; then
-	  soname=conftest
-	  lib=conftest
-	  libobjs=conftest.$ac_objext
-	  deplibs=
-	  wl=$lt_prog_compiler_wl
-	  pic_flag=$lt_prog_compiler_pic
-	  compiler_flags=-v
-	  linker_flags=-v
-	  verstring=
-	  output_objdir=.
-	  libname=conftest
-	  lt_save_allow_undefined_flag=$allow_undefined_flag
-	  allow_undefined_flag=
-	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
-  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-	  then
-	    lt_cv_archive_cmds_need_lc=no
-	  else
-	    lt_cv_archive_cmds_need_lc=yes
-	  fi
-	  allow_undefined_flag=$lt_save_allow_undefined_flag
-	else
-	  cat conftest.err 1>&5
-	fi
-	$RM conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
-$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
-      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+	pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+        then
+	  archive_cmds_need_lc=no
+        else
+	  archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
       ;;
     esac
   fi
@@ -9929,6 +9245,11 @@ esac
 
 
 
+
+
+
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
@@ -9937,23 +9258,16 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
-  case $lt_search_path_spec in
-  *\;*)
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
-    ;;
-  *)
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
-    ;;
-  esac
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -9966,7 +9280,7 @@ if test "$GCC" = yes; then
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -9986,13 +9300,7 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[lt_foo]++; }
   if (lt_freq[lt_foo] == 1) { print lt_foo; }
 }'`
-  # AWK program above erroneously prepends '/' to C:/dos/paths
-  # for these hosts.
-  case $host_os in
-    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
-  esac
-  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi
@@ -10018,7 +9326,7 @@ need_version=unknown
 
 case $host_os in
 aix3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
@@ -10027,7 +9335,7 @@ aix3*)
   ;;
 
 aix[4-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
@@ -10080,7 +9388,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -10092,7 +9400,7 @@ beos*)
   ;;
 
 bsdi[45]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
@@ -10111,9 +9419,8 @@ cygwin* | mingw* | pw32* | cegcc*)
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$cc_basename in
-  yes,*)
-    # gcc
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -10134,83 +9441,36 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-
-      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    dynamic_linker='Win32 ld.exe'
-    ;;
-
-  *,cl*)
-    # Native MSVC
-    libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
-
-    case $build_os in
-    mingw*)
-      sys_lib_search_path_spec=
-      lt_save_ifs=$IFS
-      IFS=';'
-      for lt_path in $LIB
-      do
-        IFS=$lt_save_ifs
-        # Let DOS variable expansion print the short 8.3 style file name.
-        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
-        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
-      done
-      IFS=$lt_save_ifs
-      # Convert to MSYS style.
-      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
-      ;;
-    cygwin*)
-      # Convert to unix form, then to dos form, then back to unix form
-      # but this time dos style (no spaces!) so that the unix form looks
-      # like /cygdrive/c/PROGRA~1:/cygdr...
-      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
-      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
-      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
-      ;;
-    *)
-      sys_lib_search_path_spec="$LIB"
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
       if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH.
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
       else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
       fi
-      # FIXME: find the short name or the path components, as spaces are
-      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
-
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $RM \$dlpath'
-    shlibpath_overrides_runpath=yes
-    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
-    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    dynamic_linker='Win32 ld.exe'
     ;;
   esac
+  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -10231,7 +9491,7 @@ darwin* | rhapsody*)
   ;;
 
 dgux*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -10239,6 +9499,10 @@ dgux*)
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
 freebsd* | dragonfly*)
   # DragonFly does not have aout.  When/if they implement a new
   # versioning mechanism, adjust this.
@@ -10246,7 +9510,7 @@ freebsd* | dragonfly*)
     objformat=`/usr/bin/objformat`
   else
     case $host_os in
-    freebsd[23].*) objformat=aout ;;
+    freebsd[123]*) objformat=aout ;;
     *) objformat=elf ;;
     esac
   fi
@@ -10264,7 +9528,7 @@ freebsd* | dragonfly*)
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
-  freebsd2.*)
+  freebsd2*)
     shlibpath_overrides_runpath=yes
     ;;
   freebsd3.[01]* | freebsdelf3.[01]*)
@@ -10284,26 +9548,12 @@ freebsd* | dragonfly*)
   ;;
 
 gnu*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-haiku*)
-  version_type=linux # correct to gnu/linux during the next big refactor
-  need_lib_prefix=no
-  need_version=no
-  dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -10349,14 +9599,12 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
   postinstall_cmds='chmod 555 $lib'
-  # or fails outright, so override atomically:
-  install_override_mode=555
   ;;
 
 interix[3-9]*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -10372,7 +9620,7 @@ irix5* | irix6* | nonstopux*)
     nonstopux*) version_type=nonstopux ;;
     *)
 	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux # correct to gnu/linux during the next big refactor
+		version_type=linux
 	else
 		version_type=irix
 	fi ;;
@@ -10409,9 +9657,9 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
-  version_type=linux # correct to gnu/linux during the next big refactor
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10419,17 +9667,12 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
-
   # Some binutils ld are patched to set DT_RUNPATH
-  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  lt_cv_shlibpath_overrides_runpath=no
-    save_LDFLAGS=$LDFLAGS
-    save_libdir=$libdir
-    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
-	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -10442,17 +9685,13 @@ main ()
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
-  lt_cv_shlibpath_overrides_runpath=yes
+  shlibpath_overrides_runpath=yes
 fi
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-    LDFLAGS=$save_LDFLAGS
-    libdir=$save_libdir
-
-fi
-
-  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -10464,9 +9703,8 @@ fi
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
-
   fi
 
   # We used to test for /lib/ld.so.1 and disable shared libraries on
@@ -10497,7 +9735,7 @@ netbsd*)
   ;;
 
 newsos6)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
@@ -10566,7 +9804,7 @@ rdos*)
   ;;
 
 solaris*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10591,7 +9829,7 @@ sunos4*)
   ;;
 
 sysv4 | sysv4.3*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -10615,7 +9853,7 @@ sysv4 | sysv4.3*)
 
 sysv4*MP*)
   if test -d /usr/nec ;then
-    version_type=linux # correct to gnu/linux during the next big refactor
+    version_type=linux
     library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
     soname_spec='$libname${shared_ext}.$major'
     shlibpath_var=LD_LIBRARY_PATH
@@ -10646,7 +9884,7 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 
 tpf*)
   # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   need_lib_prefix=no
   need_version=no
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -10656,7 +9894,7 @@ tpf*)
   ;;
 
 uts4*)
-  version_type=linux # correct to gnu/linux during the next big refactor
+  version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
@@ -10768,11 +10006,6 @@ fi
 
 
 
-
-
-
-
-
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
 $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
@@ -11103,7 +10336,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line $LINENO "configure"
+#line 10339 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11144,13 +10377,7 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 42; }
+void fnord() { int i=42;}
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -11159,11 +10386,7 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else
-        {
-	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
-          else puts (dlerror ());
-	}
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
       /* dlclose (self); */
     }
   else
@@ -11209,7 +10432,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line $LINENO "configure"
+#line 10435 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11250,13 +10473,7 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
-   correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
-#endif
-
-int fnord () { return 42; }
+void fnord() { int i=42;}
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -11265,11 +10482,7 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else
-        {
-	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
-          else puts (dlerror ());
-	}
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
       /* dlclose (self); */
     }
   else
@@ -11438,8 +10651,6 @@ CC="$lt_save_CC"
 
 
 
-
-
         ac_config_commands="$ac_config_commands libtool"
 
 
@@ -11509,7 +10720,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_YACC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -11552,7 +10763,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_LEX="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -11584,7 +10795,8 @@ a { ECHO; }
 b { REJECT; }
 c { yymore (); }
 d { yyless (1); }
-e { yyless (input () != 0); }
+e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument.  */
+    yyless ((input () != 0)); }
 f { unput (yytext[0]); }
 . { BEGIN INITIAL; }
 %%
@@ -11711,7 +10923,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog__YACC_="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -11759,7 +10971,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog__LEX_="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -11895,11 +11107,11 @@ else
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
+
 #ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
+  /* Ultrix mips cc rejects this sort of thing.  */
   typedef int charset[2];
-  const charset cs;
+  const charset cs = { 0, 0 };
   /* SunOS 4.1.1 cc rejects this.  */
   char const *const *pcpcc;
   char **ppc;
@@ -11916,8 +11128,9 @@ main ()
   ++pcpcc;
   ppc = (char**) pcpcc;
   pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
+  { /* SCO 3.2v4 cc rejects this sort of thing.  */
+    char tx;
+    char *t = &tx;
     char const *s = 0 ? (char *) 0 : (char const *) 0;
 
     *t++ = 0;
@@ -11933,10 +11146,10 @@ main ()
     iptr p = 0;
     ++p;
   }
-  { /* AIX XL C 1.02.0.0 rejects this saying
+  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
        "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
+    struct s { int j; const int *ap[3]; } bx;
+    struct s *b = &bx; b->j = 5;
   }
   { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
     const int foo = 10;
@@ -12133,6 +11346,35 @@ $as_echo "#define volatile /**/" >>confdefs.h
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler supports __builtin_expect" >&5
+$as_echo_n "checking if the compiler supports __builtin_expect... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+ return __builtin_expect(1, 1) ? 1 : 0
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+   have_builtin_expect=yes
+		   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+   have_builtin_expect=no
+		   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if test "x_$have_builtin_expect" = "x_yes" ; then
+
+$as_echo "#define HAVE_BUILTIN_EXPECT 1" >>confdefs.h
+
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ld accepts --version-script" >&5
 $as_echo_n "checking whether ld accepts --version-script... " >&6; }
 if ${ac_cv_version_script+:} false; then :
@@ -12191,6 +11433,8 @@ fi
 
 # --- BEGIN OPENIB_OSM_CONSOLE_SOCKET_SEL ---
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to enable console loopback" >&5
+$as_echo_n "checking to enable console loopback... " >&6; }
 # Check whether --enable-console-loopback was given.
 if test "${enable_console_loopback+set}" = set; then :
   enableval=$enable_console_loopback; case $enableval in
@@ -12201,6 +11445,8 @@ else
   console_loopback=yes
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $console_loopback" >&5
+$as_echo "$console_loopback" >&6; }
 
 if test $console_loopback = yes; then
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for request_init in -lwrap" >&5
@@ -12259,6 +11505,8 @@ $as_echo "#define ENABLE_OSM_CONSOLE_LOOPBACK 1" >>confdefs.h
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to enable console socket" >&5
+$as_echo_n "checking to enable console socket... " >&6; }
 # Check whether --enable-console-socket was given.
 if test "${enable_console_socket+set}" = set; then :
   enableval=$enable_console_socket; case $enableval in
@@ -12269,6 +11517,9 @@ else
   console_socket=no
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $console_socket" >&5
+$as_echo "$console_socket" >&6; }
+
 if test $console_socket = yes; then
   if test $console_loopback = no; then
     as_fn_error $? "--enable-console-socket requires --enable-console-loopback" "$LINENO" 5
@@ -12284,6 +11535,8 @@ fi
 
 # --- BEGIN OPENIB_OSM_PERF_MGR_SEL ---
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to enable perf mgr" >&5
+$as_echo_n "checking to enable perf mgr... " >&6; }
 # Check whether --enable-perf-mgr was given.
 if test "${enable_perf_mgr+set}" = set; then :
   enableval=$enable_perf_mgr; case $enableval in
@@ -12294,6 +11547,11 @@ else
   perf_mgr=yes
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perf_mgr" >&5
+$as_echo "$perf_mgr" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to enable perf mgr profiling" >&5
+$as_echo_n "checking to enable perf mgr profiling... " >&6; }
 # Check whether --enable-perf-mgr-profile was given.
 if test "${enable_perf_mgr_profile+set}" = set; then :
   enableval=$enable_perf_mgr_profile; case $enableval in
@@ -12304,6 +11562,9 @@ else
   perf_mgr_profile=no
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $perf_mgr_profile" >&5
+$as_echo "$perf_mgr_profile" >&6; }
+
 if test $perf_mgr = yes; then
 
 $as_echo "#define ENABLE_OSM_PERF_MGR 1" >>confdefs.h
@@ -12504,6 +11765,8 @@ _ACEOF
 
 # --- BEGIN OPENIB_OSM_DEFAULT_EVENT_PLUGIN_SEL ---
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to enable default event plugin" >&5
+$as_echo_n "checking to enable default event plugin... " >&6; }
 # Check whether --enable-default-event-plugin was given.
 if test "${enable_default_event_plugin+set}" = set; then :
   enableval=$enable_default_event_plugin; case $enableval in
@@ -12514,6 +11777,9 @@ else
   default_event_plugin=no
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $default_event_plugin" >&5
+$as_echo "$default_event_plugin" >&6; }
+
 if test $default_event_plugin = yes; then
 
 $as_echo "#define ENABLE_OSM_DEFAULT_EVENT_PLUGIN 1" >>confdefs.h
@@ -13321,16 +12587,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -13390,28 +12656,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-	test -d "$1/.";
-      else
-	case $1 in #(
-	-*)set "./$1";;
-	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-	???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -13432,8 +12686,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by opensm $as_me 3.3.15, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+This file was extended by opensm $as_me 3.3.17, which was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -13498,11 +12752,11 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-opensm config.status 3.3.15
-configured by $0, generated by GNU Autoconf 2.68,
+opensm config.status 3.3.17
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -13593,7 +12847,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
@@ -13627,154 +12881,131 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 sed_quote_subst='$sed_quote_subst'
 double_quote_subst='$double_quote_subst'
 delay_variable_subst='$delay_variable_subst'
-macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
-enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
-SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
-ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
-PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
-host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
-host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
-host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
-build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
-build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
-build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
-SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
-Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
-GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
-EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
-FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
-LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
-NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
-LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
-exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
-lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
-lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
-file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
-want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
-DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
-sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
-AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
-archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
-STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
-lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
-CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
-compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
-GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
-nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
-lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
-objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
-need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
-MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
-LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
-libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
-postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
-need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
-version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
-install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
-striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
+LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
 
 LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-\$1
-_LTECHO_EOF'
-}
-
 # Quote evaled strings.
-for var in SHELL \
-ECHO \
-PATH_SEPARATOR \
-SED \
+for var in SED \
 GREP \
 EGREP \
 FGREP \
@@ -13787,13 +13018,8 @@ reload_flag \
 OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
-file_magic_glob \
-want_nocaseglob \
-DLLTOOL \
-sharedlib_from_linklib_cmd \
 AR \
 AR_FLAGS \
-archiver_list_spec \
 STRIP \
 RANLIB \
 CC \
@@ -13803,14 +13029,14 @@ lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-nm_file_list_spec \
+SHELL \
+ECHO \
 lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_pic \
 lt_prog_compiler_wl \
+lt_prog_compiler_pic \
 lt_prog_compiler_static \
 lt_cv_prog_compiler_c_o \
 need_locks \
-MANIFEST_TOOL \
 DSYMUTIL \
 NMEDIT \
 LIPO \
@@ -13824,7 +13050,9 @@ with_gnu_ld \
 allow_undefined_flag \
 no_undefined_flag \
 hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
 hardcode_libdir_separator \
+fix_srcfile_path \
 exclude_expsyms \
 include_expsyms \
 file_list_spec \
@@ -13832,13 +13060,12 @@ variables_saved_for_relink \
 libname_spec \
 library_names_spec \
 soname_spec \
-install_override_mode \
 finish_eval \
 old_striplib \
 striplib; do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13860,15 +13087,14 @@ module_cmds \
 module_expsym_cmds \
 export_symbols_cmds \
 prelink_cmds \
-postlink_cmds \
 postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
 sys_lib_dlsearch_path_spec; do
-    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -13876,6 +13102,12 @@ sys_lib_dlsearch_path_spec; do
     esac
 done
 
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+  ;;
+esac
+
 ac_aux_dir='$ac_aux_dir'
 xsi_shell='$xsi_shell'
 lt_shell_append='$lt_shell_append'
@@ -14634,8 +13866,7 @@ $as_echo X"$file" |
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -14683,15 +13914,6 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# An echo program that protects backslashes.
-ECHO=$lt_ECHO
-
-# The PATH separator for the build system.
-PATH_SEPARATOR=$lt_PATH_SEPARATOR
-
 # The host system.
 host_alias=$host_alias
 host=$host
@@ -14741,11 +13963,9 @@ SP2NL=$lt_lt_SP2NL
 # turn newlines into spaces.
 NL2SP=$lt_lt_NL2SP
 
-# convert \$build file names to \$host format.
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-
-# convert \$build files to toolchain format.
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
 
 # An object symbol dumper.
 OBJDUMP=$lt_OBJDUMP
@@ -14753,30 +13973,13 @@ OBJDUMP=$lt_OBJDUMP
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method = "file_magic".
+# Command to use when deplibs_check_method == "file_magic".
 file_magic_cmd=$lt_file_magic_cmd
 
-# How to find potential files when deplibs_check_method = "file_magic".
-file_magic_glob=$lt_file_magic_glob
-
-# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
-want_nocaseglob=$lt_want_nocaseglob
-
-# DLL creation program.
-DLLTOOL=$lt_DLLTOOL
-
-# Command to associate shared and link libraries.
-sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
-
 # The archiver.
 AR=$lt_AR
-
-# Flags to create an archive.
 AR_FLAGS=$lt_AR_FLAGS
 
-# How to feed a file listing to the archiver.
-archiver_list_spec=$lt_archiver_list_spec
-
 # A symbol stripping program.
 STRIP=$lt_STRIP
 
@@ -14785,9 +13988,6 @@ RANLIB=$lt_RANLIB
 old_postinstall_cmds=$lt_old_postinstall_cmds
 old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
-# Whether to use a lock for old archive extraction.
-lock_old_archive_extraction=$lock_old_archive_extraction
-
 # A C compiler.
 LTCC=$lt_CC
 
@@ -14806,24 +14006,21 @@ global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
-# Specify filename containing input files for \$NM.
-nm_file_list_spec=$lt_nm_file_list_spec
-
-# The root where to search for dependent libraries,and in which our libraries should be installed.
-lt_sysroot=$lt_sysroot
-
 # The name of the directory that contains temporary libtool files.
 objdir=$objdir
 
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
 # Used to examine libraries when file_magic_cmd begins with "file".
 MAGIC_CMD=$MAGIC_CMD
 
 # Must we lock files when doing compilation?
 need_locks=$lt_need_locks
 
-# Manifest tool.
-MANIFEST_TOOL=$lt_MANIFEST_TOOL
-
 # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
 DSYMUTIL=$lt_DSYMUTIL
 
@@ -14880,9 +14077,6 @@ library_names_spec=$lt_library_names_spec
 # The coded name of the library, if different from the real name.
 soname_spec=$lt_soname_spec
 
-# Permission mode override for installation of shared libraries.
-install_override_mode=$lt_install_override_mode
-
 # Command to use after installation of a shared archive.
 postinstall_cmds=$lt_postinstall_cmds
 
@@ -14922,10 +14116,6 @@ striplib=$lt_striplib
 # The linker used to build libraries.
 LD=$lt_LD
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
-
 # Commands used to build an old-style archive.
 old_archive_cmds=$lt_old_archive_cmds
 
@@ -14938,12 +14128,12 @@ with_gcc=$GCC
 # Compiler flag to turn off builtin functions.
 no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic
-
 # How to pass a linker flag through the compiler.
 wl=$lt_lt_prog_compiler_wl
 
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
 # Compiler flag to prevent dynamic linking.
 link_static_flag=$lt_lt_prog_compiler_static
 
@@ -14993,6 +14183,10 @@ no_undefined_flag=$lt_no_undefined_flag
 # This must work even if \$libdir does not exist
 hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
@@ -15026,6 +14220,9 @@ inherit_rpath=$inherit_rpath
 # Whether libtool must link a program against all its dependency libraries.
 link_all_deplibs=$link_all_deplibs
 
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
 # Set to "yes" if exported symbols are required.
 always_export_symbols=$always_export_symbols
 
@@ -15041,9 +14238,6 @@ include_expsyms=$lt_include_expsyms
 # Commands necessary for linking programs (against libraries) with templates.
 prelink_cmds=$lt_prelink_cmds
 
-# Commands necessary for finishing linking programs.
-postlink_cmds=$lt_postlink_cmds
-
 # Specify filename containing input files.
 file_list_spec=$lt_file_list_spec
 
@@ -15076,169 +14270,212 @@ ltmain="$ac_aux_dir/ltmain.sh"
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" \
-     || (rm -f "$cfgfile"; exit 1)
-
-  if test x"$xsi_shell" = xyes; then
-  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
-func_dirname ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_basename ()$/,/^} # func_basename /c\
-func_basename ()\
-{\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
-func_dirname_and_basename ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
-func_stripname ()\
-{\
-\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
-\    # positional parameters, so assign one to ordinary parameter first.\
-\    func_stripname_result=${3}\
-\    func_stripname_result=${func_stripname_result#"${1}"}\
-\    func_stripname_result=${func_stripname_result%"${2}"}\
-} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
-func_split_long_opt ()\
-{\
-\    func_split_long_opt_name=${1%%=*}\
-\    func_split_long_opt_arg=${1#*=}\
-} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
-func_split_short_opt ()\
-{\
-\    func_split_short_opt_arg=${1#??}\
-\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
-} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
-func_lo2o ()\
-{\
-\    case ${1} in\
-\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
-\      *)    func_lo2o_result=${1} ;;\
-\    esac\
-} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_xform ()$/,/^} # func_xform /c\
-func_xform ()\
-{\
-    func_xform_result=${1%.*}.lo\
-} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_arith ()$/,/^} # func_arith /c\
-func_arith ()\
-{\
-    func_arith_result=$(( $* ))\
-} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_len ()$/,/^} # func_len /c\
-func_len ()\
-{\
-    func_len_result=${#1}\
-} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  sed -e '/^func_append ()$/,/^} # func_append /c\
-func_append ()\
-{\
-    eval "${1}+=\\${2}"\
-} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
-func_append_quoted ()\
-{\
-\    func_quote_for_eval "${2}"\
-\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
-} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
-$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
-fi
-
-
-   mv -f "$cfgfile" "$ofile" ||
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+  func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=${1%%=*}
+  func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  case ${1} in
+    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+    *)    func_lo2o_result=${1} ;;
+  esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=${#1}
+}
+
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+  esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=`expr "$@"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$1+=\$2"
+}
+_LT_EOF
+    ;;
+  *)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$1=\$$1\$2"
+}
+
+_LT_EOF
+    ;;
+  esac
+
+
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
 
diff --git a/configure.in b/configure.in
index e48c066..9158aec 100644
--- a/configure.in
+++ b/configure.in
@@ -1,7 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.57)
-AC_INIT(opensm, 3.3.15, linux-rdma at vger.kernel.org)
+AC_INIT(opensm, 3.3.17, linux-rdma at vger.kernel.org)
 AC_CONFIG_SRCDIR([opensm/osm_opensm.c])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_MACRO_DIR(config)
@@ -11,6 +11,23 @@ AM_INIT_AUTOMAKE
 AC_SUBST(RELEASE, ${RELEASE:-unknown})
 AC_SUBST(TARBALL, ${TARBALL:-${PACKAGE}-${VERSION}.tar.gz})
 
+default_rdma_service=openibd
+AC_ARG_WITH([rdma_service],
+    AC_HELP_STRING([--with-rdma-service=name],
+                   [name of the RDMA service: "rdma" when using /etc/init.d/rdma to start RDMA services; "openibd" when using /etc/init.d/openibd to start RDMA services [default=${default_rdma_service}]]))
+AC_SUBST(RDMA_SERVICE, ${with_rdma_service:-${default_rdma_service}})
+
+if { rpm -q sles-release || rpm -q openSUSE-release; } >/dev/null 2>&1; then
+   default_stop="0 1 4 6"
+else
+   default_stop="0 1 6"
+fi
+
+default_start="null"
+
+AC_SUBST(DEFAULT_START, $default_start)
+AC_SUBST(DEFAULT_STOP, $default_stop)
+
 dnl NOTE: AC_DEFINE's and AC_DEFINE_UNQUOTED's which are used in header files
 dnl       MUST have a corresponding entry in include/opensm/osm_config.h.in to
 dnl       ensure plugin compatibility.
@@ -56,6 +73,17 @@ AC_HEADER_TIME
 AC_STRUCT_TM
 AC_C_VOLATILE
 
+dnl See if we have __builtin_expect
+AC_MSG_CHECKING([if the compiler supports __builtin_expect])
+AC_TRY_COMPILE(, [ return __builtin_expect(1, 1) ? 1 : 0],
+		 [ have_builtin_expect=yes
+		   AC_MSG_RESULT([yes]) ],
+		 [ have_builtin_expect=no
+		   AC_MSG_RESULT([no])  ])
+if test "x_$have_builtin_expect" = "x_yes" ; then
+	AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], [Define to 1 if the compiler supports __builtin_expect.])
+fi
+
 dnl We use --version-script with ld if possible
 AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
 if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
diff --git a/doc/opensm_release_notes-3.3.txt b/doc/opensm_release_notes-3.3.txt
index 6440c51..7172d79 100644
--- a/doc/opensm_release_notes-3.3.txt
+++ b/doc/opensm_release_notes-3.3.txt
@@ -3,14 +3,14 @@
 
 Version: OpenSM 3.3.x
 Repo:    git://git.openfabrics.org/~alexnetes/opensm.git
-Date:    Aug 2012
+Date:    Jan 2014
 
 1 Overview
 ----------
 This document describes the contents of the OpenSM 3.3 release.
 OpenSM is an InfiniBand compliant Subnet Manager and Administration,
 and runs on top of OpenIB. The OpenSM version for this release
-is opensm-3.3.15.
+is opensm-3.3.17.
 
 This document includes the following sections:
 1 This Overview section (describing new features and software
@@ -323,10 +323,99 @@ b3b1861 opensm: osm_subnet.c: Updated patch to add error-reporting to the parsin
 cd8a708 opensm/man/opensm.8.in: Add description for OSM_LOG_SYS logging flag
 1308e5c opensm/osm_console.c: Add display of FDR10 ports to portstatus_parse
 f4722b0 opensm: Reset client reregistration when receiving handover
+5fdb0b9 opensm/configure.in: Remove Default-Start from opensmd init script
+b966100 opensm/osm_sm_state_mgr.c: Start sweep immedeately when recieving HANDOVER in DISCOVERING state
+4349c07 opensm: Add physp_p discovery count support
+d706cbf opensm/osm_sm_mad_ctrl.c: Upon receiving trap repress we should decrease qp0_mads_outstanding_on_wire
+e1e4706 opensm: Revert "opensm/osm_ucast_ftree: When roots are not connected, update hop count but not lft"
+7a49366 opensm: Changed #if to #ifdef when using ENABLE_OSM_PERF_MGR_PROFILE
+34af1a5 opensm/osm_torus.c: torus routing should fail with VLCap 1 on switch external ports
+2b8940b opensm/osm_torus.c: In dump_torus, make sure switch is present before dumping
+2364e8e opensm: Add better error output when parsing node name maps
+7204287 opensm/osm_sa_mcmember_record.c: Only use scope from MC group in copy_from_create_mc_rec
+4eb0f69 opensm/osm_dump.c: Remove incorrect assert
+1ddb44b OpenSM: dfsssp - moved paths from one to another VL might be counted multiple times
+a0a9eea OpenSM: DFSSSP does not find LIDs due to wrong byte order (v2)
+13fd952 OpenSM: dfsssp - avoid unnecessary nested loop in vltable_print for OSM_LOG_INFO
+1cbed64 OpenSM: dfsssp - change the port traversal for sssp
+c2f0bb9 OpenSM: dfsssp - add support for base/enhanced switch port
+64873ff OpenSM: dfsssp ignores differences in the lmc value
+162493e opensm/osm_req.c: In req_determine_mkey, use osm_physp APIs
+fc53bdc opensm/osm_torus.c: Dump torus when OSM_LOG_ROUTING specified
+434afa6 opensm/torus: Add configuration for max_changes to report
+35bcddf opensm/osm_torus.c: Consolidate some parsing with parse_unsigned
+3f3d26f opensm/osm_prtn_config.c: Insert autogenerated pkey into MGID for IPoIB
+d80ca1e opensm/osm_port_info_rcv.c: Don't modify subnet minimal values when PortState DOWN
+f97a2e9 opensm/osm_ucast_ftree.c: Eliminate unneeded NULL pointer checks prior to calls to free
+8a77f23 opensm/osm_ucast_ftree.c: Remove duplicate free in fabric_create_leaf_switch_array
+338a67b opensm/osm_subnet.c: Improve error messages in subn_validate_neighbor
+0a1c9bf opensm/osm_req.c: In req_determine_mkey, add more info when ERR 1107 occurs
+b974ca3 opensm/osm_torus.c: Improve some misconfiguration error messages
+e986d57 opensm/osm_torus.c: Minor simplification to check_qos_config
+95b6f83 opensm: Update doc for changes to torus routing for, endport support
+998fb43 opensm/osm_torus.c: Add copyright
+268d327 opensm/osm_torus.c: Improve QoS configuration
+d1d2de5 opensm: Update doc for changes to torus routing for CA, support
+a362b5b opensm/osm_torus.c: Require only 2 data VLs supported (PortInfo.VLCap) and use VLs 0-1 on CA links
+3f536ae opensm: Add routing specific update_vlarb hook routine
+a2415f3 Add Per Module Logging support for Congestion Manager
+a6d3694 opensm: clean up error message, function name is printed by logging code
+2cf8078 opensm/osm_sa_mcmember_record.c: Return proper scope for query with valid SA key
+c1a206e opensm: update performance manager documentation
+f204e9c opensm: Protect against spurious wakeups when calling cl_event_wait_on
+7db5c75 opensm/osm_subnet.c: Only parameters that marked with can_update flag should be updated during conf file rescan
+282714a /etc/init.d/opensmd: Improve systemd integration
+8b116d7 opensm/osm_trap_rcv.c: Eliminate unneeded trap_rcv_process_response routine
+4008c2f opensm.spec.in: Improve portability
+01ab744 Make it possible to enable opensm with chkconfig
+c68ae63 Add command-line option --pidfile
+ffb9a82 opensm/osm_torus.c: Check fabric minimum data VLs on switch external ports
+d0258f3 opensm: Track minimum value in the fabric for data VLs supported on switch external ports
+36159c2 opensm/osm_torus.c: Cosmetic formatting change
+dba3f92 opensm/osm_helper.c: Add some missing new lines to log message output
+94468b5 opensm/osm_ucast_updn.c: Add error codes to a couple of log messages
+86a203b Correct option names in opensm man page
+3482438 opensm/osm_sa.h: Cosmetic commentary change
+824e1f0 opensm/ib_types.h: Commentary and cosmetic formatting change
+3711e8a opensm/complib/cl_spinlock.h: Remove some unimplemented routines
+0c3f57f opensm/osm_torus.c: Add error code to error log message
+8e6dfbd opensm: Add .gitignore
+6248495 opensm/osm_port_info_rcv.c: use PF() hint on fatal conditions
+dff5927 opensm/osm_port_info_rcv.c: check received local_port_num
+b7b1505 opensm/libvendor/osm_vendor_ibumad.c: validate response MAD properties
+c215eea opensm/libvendor/osm_vendor_ibumad.c:rename "mad" to "p_mad" to indicate pointer
+e00f67b opensm/libvendor/osm_vendor_ibumad_sa.c: use wrapper function instead of direct access
+ebc772c opensm/osm_node_info_rcv.c: using "PF" hint for all the fatal conditions
+e2f06cd opensm/complib: define macros for for "if" statements with branch prediction hints
+0e33c11 opensm/configure.in: check that compiler supports __builtin_expect()
+2cb1854 OpenSM: Add new Mellanox OUI
+8e5fc57 opensm: osm_pkey: Remove unused variables
+e96a933 opensm: Manage ports that do not support congestion control
+fbb74ca opensm: improve search common pkeys.
+db34e30 opensm/osm_vendor_ibumad.c: Add management class to error log message
+ba36f81 opensm/perfmgr/console: add 'pm sweep'
+f118668 opensm/osm_sa: Improve SA record response handling (osm_sa_respond)
+b09ac65 opensm/osm_sa_informinfo.c: Add trusted support for InformInfo/InformInfoRecord
+5b2390e dfsssp: optimization for dedicated compute and IO nodes
+33f4f17 Add new option for guid_routing_order_no_scatter
+a5f54f1 osm_ucast_mgr.c: After applying guid_order options, add nodes sorted
+by neighbor switch load
+5a97c78 Try default partition config if parsing partitions.conf fails
+cc5fa17 Add support for synchronizing in memory files with storage
+9853841 Implement atomic update operation for sa_db_file
+3e146fa Add option to disable M_Key lookup
+51b187b Add flags to OSM_EVENT_ID_UCAST_ROUTING_DONE
+c97bd7b Permit toggling log flush from console
+8395084 OpenSM: dfsssp - add support for multicast
+96eafa0 ftree: Allow defining only io_guids file and consider rest of nodes as
+CN nodes
+6cd6114 opensm: Add support for LFT changed event
+b73c378 opensm/perfmgr; add support for PortCountersExtended NOIETF
+70f5820 opensm/perfmgr: Issue PortCountersExtended query when supported
 
 1.3 Library API Changes
 
-  None
+de02954 osm_trap_rcv.c: Log DR path to node when trap 128
 
 1.4 Software Dependencies
 
@@ -465,6 +554,117 @@ ae1bcdd opensm/osm_lid_mgr.c: Allow switch lids to be non LMC aligned
 9ad844f Fix ucast cache crash, when switch doesn't have valid phys ports
 07aa9fa opensm: fix crash in osm_ucast_mgr
 076bd38 opensm/osm_ucast_cache.c: fix crash in ucast cache when switch with lid 0 dropped
+9cbb8af opensm/osm_ucast_ftree.c: fix opensm segfault in osm_ucast_ftree.c
+edd0552 opensm/osm_qos_policy.c: fix segmentation fault on
+	osm_qos_policy_match_rule_destroy (osm_qos_policy.c)
+dec1109 DFSSSP: fix a memory leak in dfsssp_build_graph
+d5fe528 opensm/osm_req.c: In req_determine_mkey, fix DR algorithm
+a46b33e opensm: fix crash in DFSSSP routing engine on reroute
+d2312af opensm/osm_link_mgr.c: Fix sending PortInfo(Set) with AM SMSupportExtendedSpeeds
+	bit set for switch base port 0
+06ae82c opensm/osm_link_mgr.c: Set AM SMSupportExtendedSpeeds bit if port
+	supports ExtPortInfo
+b2cd2d7 opensm/osm_ucast_ftree.c: Fix unranked nodes bug in FTree
+8384156 opensm/osm_torus.c: Fix crash in torus_update_osm_vlarb
+0ff054a osm_trap_rcv.c: Removed unneeded lock when disabling port
+e7c4ec3 osm_trap_rcv.c: Minimize time holding RW lock for SystemImageGUID
+changed trap 145
+1418f8a osm_trap_rcv.c: In trap_rcv_process_request, change locking strategy
+280a2ac osm_trap_rcv.c: fix locking in trap_rcv_process_request()
+a45e311 osm_db_files.c: Minor improvement to fix in previous commit
+86cf679666f49f6073c1ddf2b9ff644a41537a57
+86cf679 osm_db_files.c: Fix issue introduced in commit
+aaa7b1e67ec6e5fc2a10accf46d538f9d47c6323
+ed7be1a Add client_rereg flag to Port Info context
+413e4fa osm_trap_rcv.c: fix race condition during sweep
+90a7960 osm_ucast_file.c: Fix crash when port is invalid in LFT file
+a1ccf88 osm_sa_path_record.c: path_sl may return SL different from requested
+SL
+8f3f7d0 osm_sm_state_mgr.c: Fix race condition during
+sm_state_mgr_send_master_sm_info_req
+b1b1b37 Fix minhop population in fabric with duplicate lids
+ed9de4c osm_mcast_mgr.c: Fix wrong comparison in mcast_mgr_subdivide()
+c5d5faa Only rewrite db files during heavy sweep when there is a real change
+9aa6dcd osm_drop_mgr.c: fix timeouts on Get Pkey from ext switch ports
+361c014 Fix dropping node after setPkey mad
+2585f58 Improve memory consumption of pkey manager by using cl_map for
+accum_pkeys
+754bd75 osm_opensm.c: When exiting, update SADB only in MASTER state
+3cc0a3e Fix timeout handling for pkeyGet for sw port 0
+189a39d Fix possible use of lid 0 when sending set PortInfo after failure of
+the first PortInfo set
+6d1d1a4 Fix handling of get P_KeyTable on timeout
+df385e8 osm_ucast_cache.c: Fix memory leak in ucast_cache
+79ba877 osm_link_mgr.c: active_transition parameter in PortInfo(Set) context
+may not be initialized
+b442062 Resend trap 144 when detecting remote MASTER SM with lower priority
+49ea151 osm_pkey.c: Fix find common pkey bug fix
+e3aa9e8 dfsssp: send multicast forwarding tables to switches
+4a39fb1 dfsssp: send multicast forwarding tables to switches
+d5f6e25 osm_sa_mcmember_record.c: Fix incorrect comparison of IPv6 MGID when
+searching for SNM MLID
+908c524 osm_guid_mgr.c: Fix GUIDInfo SET function
+e8bf592 Clean up event subscriptions if a port goes away
+7c9afa0 Improve m_key lookup
+807d9ed osm_trap_rcv.c: Fix locking in aging callback
+eb294d5 osm_lid_mgr.c: Don't configure MTU and LMC for base SP0
+a47e5d0 complib/cl_event_wheel.c: Roundup timeout to nearest msec
+2a8c474 complib: Fix memory leak in cl_thread_pool_destroy function
+1960fbc osm_trap_rcv.c: Fix crash in babbling port feature
+1872d11 osm_sa_sminfo_record.c: fix sminfo sa query returns all sminfo records
+when filtering by LID in osm_smir_rcv_process
+b92f25a osm_ucast_cache.c : Fix dereference null return value
+21765ad When SM fails to load/parse root_guids file use MinHop heuristics
+7c21c14 Fix shift pattern support in FTREE routing for native ftree topologies
+35f4419 osm_ucast_ftree.c: fix dereferencing null variable
+4d36d6d osm_ucast_ftree.c : fix dereferencing null variable
+49f1a71 opensm: fix possible double free in osm_ucast_ftree.c
+2695128 Fix fat-tree routing for CAs with more than 1 connected port
+42558d6 osm_sm_state_mgr.c Don't clear IS_SM bit when changing state to
+NOT_ACTIVE
+21a5b5f DFSSSP - workaround for better VL balancing
+b42ae68 osm_console_io.c Memory leak when closing console
+bcf00cb osm_ucast_dfsssp.c: Fix memory leak in dfsssp_do_dijkstra_routing
+f42a232 Fix segfault in osm_mgrp_delete_port()
+1a94326 osm_sa_multipath_record.c Use aliasGUIDs when building responses
+943a40a opensm: Fix Q_Key, TClass and limited keys parsing warnings in
+partitions.conf
+0fc6e8b osm_lid_mgr.c: Fix duplicate LID assignment after SM port down
+becc27e osm_sa_mad_ctrl.c: Drop incoming SA queries when shutting down
+dbeb7a7 Change LFT event to be per block/per switch rather than just per
+switch
+25c088a Setup SM port GUID in subnet object as soon as it is known
+92c502a osm_sa_mcmember_record.c: On join and leave, validate subnet prefix in
+port GID
+c0602ed opensm/osm_port_info_rcv.c: Fix min_sw_data_vls calculation
+2d8df36 opensm/osm_sw_info_rcv.c: Fix double release of lock in
+osm_si_rcv_process
+e7435ef opensm/osm_torus.c: avoid the possibility of following stale ->priv
+pointers
+904a555 opensm/perfmgr: fix access to shared sweep_state variable
+1458263 opensm/perfmgr: don't clear data counters in PortCounters when
+ExtendedPortCounters is supported
+b6d0001 opensm/perfmgr: issue ClassPortInfo as first query to each port.
+e1af1ce opensm/osm_console.c: Use ib_port_info_get_link_speed_ext_enabled
+2ba9919 opensm/osm_console.c: Do not perform portstatus checks on down ports
+5c45f60 opensm/osm_console.c: Support portstatus output for unenabled
+width/speed
+1947644 opensm/osm_qos_policy.c: fix memory leak when parsing policy file
+9358164 opensm/osm_sa_multipath_record.c: Validate required components are
+indicated
+fbe0d02 opensm/osm_sa_multipath_record.c: Make sure either none or both
+ServiceID parameters are supplied
+f929ac1 opensm/osm_sa_path_record.c: Make sure either none or both ServiceID
+parameters are supplied
+43efbc2 opensm/osm_sa_multipath_record.c: Fix seg fault in
+mpr_rcv_get_apm_paths
+250802d opensm/osm_qos_policy.c: Fix source & destination GUID policy check
+9f231a8 libvendor/osm_vendor_ibumad.c: fix mad validation in case of multipath
+record response
+2be4e20 opensm/perfmgr: update node name when Node Description is received
+from node
+f37bf3c opensm/perfmgr: skip data counters when only printing errors
+8412591 opensm/perfmgr: mark/report time of last counter update
 
 4.2 Other Bug Fixes
 
@@ -942,6 +1142,145 @@ e24ff39 Fix Pkey enforcement configuration
 3c9b81d OpenSM/osm_prtn_config.c: Fix non-initialized pointer usage
 28a40a2 Fix logging messages about op_vls and mtu mismatch
 5e672a6 Fix memory leak on dfsssp_context_destroy()
+3a87fa2 opensm/osm_req.c: fix first sweep m_key search algorithm
+2108431 opensm: fix default cc_max_outstanding_mads assignment
+dae214f opensm/osm_log.h: fix function documentation
+1cf0bb9 opensm/osm_congestion_control.c: fix use-after-free found by coverity
+ab5af49 opensm/osm_ucast_dfsssp.c : fix dereference before null check
+b6a2f6a opensm/osm_ucast_dfsssp.c : fix dereference null return value
+df66c1f opensm: Fix incorrect use of sizeof
+c58a416 opensm/osm_dump.c: Fix output port on SL2VL table for non switch nodes
+8af5bce opensm/osm_sa_slvl_record.c: Fix out port for CAs and routers
+18a77f9 opensm/osm_torus.c: Fix memory leak
+4ccbdc1 Fix -Wformat-security warnings with clang
+c762389 Fix -Wtautological-compare warnings with clang
+9e6dd8f Fix linker error with clang with -O < 2
+27da5eb opensm/include/osm_opensm.h: Fix commentary typo
+b9067ba opensm/include/complib/cl_packon.h: Fix some commentary typos
+e522f74 opensm/osm_perfmgr_db.c: Fix output error due to possible 32bit int overflow
+6f94c4c opensm: Fix signed vs unsigned int comparison
+2ea2cf3 opensm/osm_vl15intf.c: Fix commentary typo
+f396936 opensm/complib/cl_atomic_osd.h: Fix long standing bug in cl_atomic_sub
+606157c osmtest/osmt_multicast.c: Fix 02BF error
+03d55f6 opensm/osm_sw_info_rcv.c: Fixed locking issue on osm_get_node_by_guid error
+d7e4da1 opensm: Use IB_PATH_SELECTOR_EXACTLY rather than harded coded constant
+735c86d opensm/osm_sa_informinfo.c: Fix infr_rcv_respond to only copy InformInfo
+074ec5a osm_perfmgr.h: Cosmetic formatting changes
+05af776 osm_drop_mgr.c: Add missing assert
+de254f9 osm_opensm.c: Add missing ERR number
+b1e58bb osmeventplugin: Fix compile warning
+48c9f43 osm_prtn_config.c: Some changes to osm_prtn_config_parse_file
+6321afa osm_subnet.c: Cosmetic change to config file output
+aaa7b1e osm_db_files.c: Some minor fixes/improvements to osm_db_store
+3cae07c osm_perfmgr.c: Cosmetic formatting changes
+07b24a3 osm_port_info_rcv.c: Reset client reregister bit only on a response to
+SET
+84c9832 osm_ucast_ftree.c: replace assert with error return value
+1c0f0 osm_sa_path_record.c: Improve ERR 1F1D to show the pkey specified in
+PathQuery
+94e99a8 osm_mcast_mgr.c: Removed mcast_mgr_purge_tree_node due to code
+duplication
+929934e osm_pkey.[h c]: Remove dead function osm_pkey_tbl_clear_accum_pkeys
+bf42ec8 osm_mtree.c: Cosmetic change in osm_mtree_destroy function
+7e96f32 osm_sm_state_mgr.c: Fix handling of polling retry number
+78d87b9 osm_mcast_mgr.c: fixed missing error message number
+a1df1d7 osm_state_mgr.c: Fix error print in state_mgr_check_tbl_consistency()
+1441937 osm_mcast_mgr.c Add block number to error message
+edd5e74 Redundant remove() function call during db file generation
+dcb2df0 osm_link_mgr.c: Fix uninitialized value (physp0)
+7160cce osm_link_mgr.c: Fix uninitialized value (physp0)
+5aa4ea3 osm_link_mgr.c: fix uninitialized variable usage
+cf014ec reduce log level for missing partition configuration file.
+d3aeae8 osmtest: Handle other than default subnet prefix
+181c863 osm_vendor_ibumad.c: Improve ERR 5430 log message
+7321689 osm_state_mgr.c Add info to some error messages
+0fc753d osm_sa_path_record.c: Eliminate extraneous space in 1F1A log message
+18b3be9 Use trap number defines rather than actual trap numbers
+270a700 osm_db_files.c: Add osm_db_domain_init failure handling into test
+program
+2b82c1c Handle memory allocation failure in osm_db_domain_init()
+8284132 Use after free in osm_prtn_delete
+e186b4a osm_sa_guidinfo_record.c: False duplicate GUID error messages
+d95d461 osm_sa_informinfo.c Add attribute info to log messages
+94789a8 osm_port_info_rcv.c Issue a log message if we cannot read the MKey of
+a port
+b67db2b osm_helper.c: Fix out-of-bounds read
+ef86015 osm_db_files.c : Fix resource leak guid2lid parser
+4a2d2d8 osm_subnet.c: Fix memory leak caused by commit
+dc0760cb8088fbe079e19682570a884ba01e94ff
+168eaeb osm_db_files.c: Fix memory leak when deleting entries from osm db
+edfaddc osm_ucast_dfsssp.c: Fix some typos
+e1804f4 dfsssp - add missing and change existing return values
+d5ef9af update man page and usage explanation for --lfts_file
+6fdd844 osm_sa_path_record.c: Fix rate setting issue in SA PR handling
+4d6925c osm_vendor_ibumad.c: Fix explicit null derefenced issue found by
+coverity
+2d67f3e opensm/osm_db_pack.c: Removed uneeded asserts
+09e1e7e libvendor/osm_pkt_randomizer.c: Fix broken compilation with vendor sim
+6ff99aa complib/cl_event_wheel.c: Add print of num_regs in cl_event_wheel_dump
+a3957f2 complib/cl_event_wheel.c: Fix duplicate error codes
+ceb4041 Fix test scenario in cl_event_wheel
+5824714 osmeventplugin/osmeventplugin.c: Add Mellanox copyright
+7186965 osm_event_plugin.h: Add Mellanox copyright
+cd3b715 osmtest: Make the "-guid" option's argument mandatory
+0154977 complib/cl_event_wheel.h: Some cosmetic fixes
+b78b1d5 osm_sa_mcmember_record.c validate_requested_mgid returning boolean
+58ee065 osm_ucast_mgr.c: Fix extra copy in set_lft_block routine
+5bf6e72 osm_ucast_mgr.c: Fix duplicated code for fallback routing engine
+2e5966e osm_sm_state_mgr.c Trivial log changes
+aed1675 Log changes related to event subscription and forwarding
+75bba51 Minor log formatting changes
+16b4dfc Some log changes
+51f87ee Add attribute information to SA request error messages
+abd47cc osm_sa_mcmember_record.c Reduce number of error messages the for same
+event
+ae9d7e7 Add trap details to notice log message
+886de5d ib_types.h: Fix commentary typo
+234401b cl_threadpool.h: Remove vestigial mention of cl_thread_pool_construct
+e20f37a osm_subnet.c Remove empty syslog message
+898e9a3 osm_ucast_lash.c: Cosmetic formatting change
+6d0413d opensm/osm_ucast_dfsssp.c: Fix unused variable in update_mcft()
+583d4cf osm_console_io.c: Handle another write-strings issue
+cbbe385 osm_sa_mcmember_record.c: Improve debug log message in validate_modify
+4f835ae osm_congestion_control.c: Simplify some code
+23ebbe9 osm_log.c: Remove unneeded initialization in osm_log
+550fdeb osm_lid_mgr.c: Some commentary fixes/updates
+1d50845 opensm: Add configure output messages for several configure options
+91384ed osm_lid_mgr.c: Fix a couple of commentary typos
+a238800 ib_types.h: Trap 144 PortInfo:CapabilityMask2 changed bit definition
+564b6eb opensm: fix dfsssp uninitialized value
+395157e opensm/osm_node.h: Fix some commentary typos
+664494a opensm: Fix issues causing const warnings for strings
+8840f82 opensm/osm_switch.h: Cosmetic change
+1a06167 opensm/man/osmtest.8: Add option for using full world path queries
+eb43f7e opensm/osm_torus.c: clarify log messages on stale priv pointers
+1f7ceb8 opensm/osmtest: fix debug build
+dc0760c opensm/osm_subnet.c: Miscellaneous minor fixes
+4924ea7 osmtest: Add support for full world path records back as option
+6f1a67e osmtest/osmtest.c: Minor reordering of code in
+osmtest_write_all_path_recs
+e9556df opensm/osmtest.c: half_world_query when creating inventory file
+81d3ea3 opensm/osm_subnet.c: Change default for perfmgr_query_cpi to FALSE
+309317d opensm/osm_ucast_ftree.c: Fix invalid debug output message
+d0a8532 opensm/perfmgr: clean up: break out redirect processing from
+pc_recv_process
+ef32e12 opensm: make osm_pr_rcv_get_end_points, osm_pr_rcv_process_pair,
+osm_pr_rcv_process_half public
+7723c07 opensm: make osm_get_path_params public
+7ac18bb opensm/osm_perfmgr.c: Cosmetic changes
+fe52571 opensm/perfmgr: add failed port guid to error message
+8b67a1c opensm/osm_req.c: Better implementation of req_determine_mkey
+37eecc8 opensm/libibvendor: osm_vendor_get_all_port_attr include sm_sl value
+in port attribute struct
+8ac930e osmtest/osmt_multicast.c: Fix IPoIB MC group recognition
+5a33cc6 osmtest/osmt_multicast.c: Fix commentary typo
+186a598 opensm/osm_sa_multipath_record.c: Fix commentary typo
+4cb3751 osm_dump.c: Fix typo in dump_lid_matrix
+a0deac6 opensm/osm_dump.c: Fix enhanced switch port 0 handling in
+print_node_report
+abbbe8a opensm/ib_types.h: Add missing IB_MPR_COMPMASK_SERVICEID define
+505d48b opensm/osm_torus.c: Cosmetic formatting changes
+dc44d48 opensm/ib_types.h: Add missing IB_PR_COMPMASK_SERVICEID define
 
 * Other less critical or visible bugs were also fixed.
 
diff --git a/doc/partition-config.txt b/doc/partition-config.txt
index f49d473..3581ef6 100644
--- a/doc/partition-config.txt
+++ b/doc/partition-config.txt
@@ -94,11 +94,11 @@ General file format:
 			    mgid.  Furthermore specifying multiple scope
 			    settings will result in multiple MC groups
 			    being created.
-        qkey=<val>      - specifies the Q_Key for this MC group
+        Q_Key=<val>     - specifies the Q_Key for this MC group
                           (default: 0x0b1b for IP groups, 0 for other groups)
                           WARNING: changing this for the broadcast group may
 			           break IPoIB on client nodes!!!
-        tclass=<val>    - specifies tclass for this MC group
+        TClass=<val>    - specifies tclass for this MC group
                           (default is 0)
         FlowLabel=<val> - specifies FlowLabel for this MC group
                           (default is 0)
diff --git a/doc/performance-manager-HOWTO.txt b/doc/performance-manager-HOWTO.txt
index 11f4185..7471c6f 100644
--- a/doc/performance-manager-HOWTO.txt
+++ b/doc/performance-manager-HOWTO.txt
@@ -45,23 +45,13 @@ Using the Performance Manager consists of 3 steps:
 Step 1: Compile in support for the Performance Manager
 ------------------------------------------------------
 
-Because of the performance manager's experimental status, it is not enabled at
-compile time by default.  (This will hopefully soon change as more people use
-it and confirm that it does not break things...  ;-)  The configure option is
-"--enable-perf-mgr".
-
 At this time it is really best to enable the console socket option as well.
-OpenSM can be run in an "interactive" mode.  But with the console socket option
-turned on one can also make a connection to a running OpenSM.  The console
-option is "--enable-console-socket".  This option requires the use of
-tcp_wrappers to ensure security.  Please be aware of your configuration for
-tcp_wrappers as the commands presented in the console can affect the operation
-of your subnet.
-
-The following configure line includes turning on the performance manager as
-well as the console:
-
-	./configure --enable-perf-mgr --enable-console-socket
+OpenSM can be run in an "interactive" mode.  But with the console socket
+option turned on one can also make a connection to a running OpenSM.  By
+default only "loopback" is enabled with the console with socket being a
+compile time option.  Regardless, please be aware of your network security
+configuration for as the commands presented in the console can affect the
+operation of your subnet.
 
 
 Step 2: Enable the perfmgr and console in opensm.conf
@@ -83,23 +73,14 @@ the opensm.conf config file.  (Default location is
 Also enable the console socket and configure the port for it to listen to if
 desired.
 
-	# console [off|local|socket]
+	# console [off|local|loopback]
 	console socket
 
 	# Telnet port for console (default 10000)
 	console_port 10000
 
-As noted above you also need to set up tcp_wrappers to prevent unauthorized
-users from connecting to the console.[*]
-
-	[*] As an alternate you can use the loopback mode but I noticed when
-	writing this (OpenSM v3.1.10; OFED 1.3) that there are some bugs in
-	specifying the loopback mode in the opensm.conf file.  Look for this to
-	be fixed in newer versions.
+	"local" is only useful if you run OpenSM in the foreground.
 
-	[**] Also you could use "local" but this is only useful if you run
-	OpenSM in the foreground of a terminal.  As OpenSM is usually started
-	as a daemon I left this out as an option.
 
 Step 3: retrieve data which has been collected
 ----------------------------------------------
diff --git a/include/Makefile.in b/include/Makefile.in
index 1f453f0..5a2cc1b 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -37,8 +37,12 @@ subdir = include
 DIST_COMMON = $(nobase_pkginclude_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
-	$(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+	$(top_srcdir)/config/ltoptions.m4 \
+	$(top_srcdir)/config/ltsugar.m4 \
+	$(top_srcdir)/config/ltversion.m4 \
+	$(top_srcdir)/config/lt~obsolete.m4 \
+	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -75,12 +79,6 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
 am__installdirs = "$(DESTDIR)$(pkgincludedir)"
 HEADERS = $(nobase_pkginclude_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
@@ -132,9 +130,10 @@ CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
+DEFAULT_START = @DEFAULT_START@
+DEFAULT_STOP = @DEFAULT_STOP@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -161,7 +160,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -188,6 +186,7 @@ PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
+RDMA_SERVICE = @RDMA_SERVICE@
 RELEASE = @RELEASE@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -204,7 +203,6 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -237,6 +235,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -317,8 +316,10 @@ $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
 $(am__aclocal_m4_deps):
 
 config.h: stamp-h1
-	@if test ! -f $@; then rm -f stamp-h1; else :; fi
-	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+	@if test ! -f $@; then \
+	  rm -f stamp-h1; \
+	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+	else :; fi
 
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
@@ -356,7 +357,9 @@ uninstall-nobase_pkgincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(nobase_pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
 	$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
-	dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -569,15 +572,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/include/complib/cl_atomic_osd.h b/include/complib/cl_atomic_osd.h
index 4df9618..822c19d 100644
--- a/include/complib/cl_atomic_osd.h
+++ b/include/complib/cl_atomic_osd.h
@@ -96,7 +96,7 @@ cl_atomic_sub(IN atomic32_t * const p_value, IN const int32_t decrement)
 	int32_t new_val;
 
 	cl_spinlock_acquire(&cl_atomic_spinlock);
-	new_val = *p_value + decrement;
+	new_val = *p_value - decrement;
 	*p_value = new_val;
 	cl_spinlock_release(&cl_atomic_spinlock);
 	return (new_val);
diff --git a/include/complib/cl_event_wheel.h b/include/complib/cl_event_wheel.h
index ac02242..4883353 100644
--- a/include/complib/cl_event_wheel.h
+++ b/include/complib/cl_event_wheel.h
@@ -35,7 +35,7 @@
 
 /*
  * Abstract:
- * 	Declaration of event wheel abstraction.
+ *	Declaration of event wheel abstraction.
  */
 
 #ifndef _CL_EVENT_WHEEL_H_
@@ -62,11 +62,11 @@ BEGIN_C_DECLS
 *
 * DESCRIPTION
 *	The Event_Wheel provides a facility for registering delayed events
-*	and getting called once they timeout.
+*  and getting called once they timeout.
 *
 *	The Event_Wheel functions operate on a cl_event_wheel_t structure
-*	which should be treated as opaque and should be manipulated
-*	only through the provided functions.
+*  which should be treated as opaque and should be manipulated
+*  only through the provided functions.
 *
 * SEE ALSO
 *	Structures:
@@ -85,8 +85,8 @@ BEGIN_C_DECLS
 *
 * DESCRIPTION
 *	This typedef defines the prototype for client functions invoked
-*	by the Event_Wheel.  The Event_Wheel calls the corresponding
-*	client function when the specific item has aged.
+*  by the Event_Wheel.  The Event_Wheel calls the corresponding
+*  client function when the specific item has aged.
 *
 * SYNOPSIS
 */
@@ -95,12 +95,12 @@ typedef uint64_t
 			       IN uint32_t num_regs, IN void *context);
 /*
 * PARAMETERS
-*  key
-*     [in] The key used for registering the item in the call to
-*     cl_event_wheel_reg
+*	key
+*		[in] The key used for registering the item in the call to
+*		cl_event_wheel_reg.
 *
-*  num_regs
-*     [in] The number of times this event was registered (pushed in time).
+*	num_regs
+*		[in] The number of times this event was registered (pushed in time).
 *
 *	context
 *		[in] Client specific context specified in a call to
@@ -113,8 +113,8 @@ typedef uint64_t
 *
 * NOTES
 *	This typedef provides a function prototype reference for
-*	the function provided by Event_Wheel clients as a parameter
-*	to the cl_event_wheel_reg function.
+*  the function provided by Event_Wheel clients as a parameter
+*  to the cl_event_wheel_reg function.
 *
 * SEE ALSO
 *	Event_Wheel, cl_event_wheel_reg
@@ -130,7 +130,7 @@ typedef uint64_t
 *	The Event_Wheel is thread safe.
 *
 *	The cl_event_wheel_t structure should be treated as opaque and should
-*	be manipulated only through the provided functions.
+*  be manipulated only through the provided functions.
 *
 * SYNOPSIS
 */
@@ -148,16 +148,16 @@ typedef struct _cl_event_wheel {
 *	lock
 *		Spinlock to guard internal structures.
 *
-*       p_external_lock
-*               Reference to external spinlock to guard internal structures
-*               if the event wheel is part of a larger object protected by its own lock
+*	p_external_lock
+*		Reference to external spinlock to guard internal structures
+*		if the event wheel is part of a larger object protected by its own lock
 *
 *	events_map
 *		A Map holding all registered event items by their key.
 *
-*  closing
-*     A flag indicating the event wheel is closing. This means that
-*     callbacks that are called when closing == TRUE should just be ignored.
+*	closing
+*		A flag indicating the event wheel is closing. This means that
+*		callbacks that are called when closing == TRUE should just be ignored.
 *
 *	events_wheel
 *		A list of the events sorted by expiration time.
@@ -193,23 +193,23 @@ typedef struct _cl_event_wheel_reg_info {
 } cl_event_wheel_reg_info_t;
 /*
 * FIELDS
-*  map_item
-*     The map item of this event
+*	map_item
+*		The map item of this event
 *
-*  list_item
-*     The sorted by aging time list item
+*	list_item
+*		The sorted by aging time list item
 *
-*  key
-*     The key by which one can find the event
+*	key
+*		The key by which one can find the event
 *
 *	pfn_aged_callback
 *		The clients Event-Aged callback
 *
-*  aging_time
-*     The delta time [msec] for which the event should age.
+*	aging_time
+*		The delta time [msec] for which the event should age.
 *
-*  num_regs
-*     The number of times the same event (key) was registered
+*	num_regs
+*		The number of times the same event (key) was registered
 *
 *	context
 *		Client's context for event-aged callback.
@@ -285,12 +285,12 @@ cl_event_wheel_init_ex(IN cl_event_wheel_t * const p_event_wheel,
 
 /*
 * PARAMETERS
-*  p_event_wheel
-*     [in] Pointer to a Event_Wheel.
+*	p_event_wheel
+*		[in] Pointer to a Event_Wheel.
 *
-*  p_external_lock
-*     [in] Reference to external spinlock to guard internal structures
-*          if the event wheel is part of a larger object protected by its own lock
+*	p_external_lock
+*		[in] Reference to external spinlock to guard internal structures
+*		if the event wheel is part of a larger object protected by its own lock
 *
 * RETURN VALUE
 *	CL_SUCCESS if the operation is successful.
@@ -375,8 +375,8 @@ cl_event_wheel_reg(IN cl_event_wheel_t * const p_event_wheel,
 *	key
 *		[in] The specifc Key by which events are registered.
 *
-*  aging_time_usec
-*     [in] The absolute time this event should age in usec
+*	aging_time_usec
+*		[in] The absolute time this event should age in usec
 *
 *	pfn_callback
 *		[in] Event Aging callback.  The Event_Wheel calls this
@@ -417,7 +417,7 @@ cl_event_wheel_unreg(IN cl_event_wheel_t * const p_event_wheel,
 *	This function does not return a value.
 *
 * NOTES
-*  After the event has aged it is automatically removed from
+*	After the event has aged it is automatically removed from
 *  the event wheel. So it should only be invoked when the need arises
 *  to remove existing events before they age.
 *
diff --git a/include/complib/cl_nodenamemap.h b/include/complib/cl_nodenamemap.h
index 97984b1..bfe290b 100644
--- a/include/complib/cl_nodenamemap.h
+++ b/include/complib/cl_nodenamemap.h
@@ -54,7 +54,7 @@ typedef cl_qmap_t nn_map_t;
  * Node name map interface.
  * It is OK to pass NULL for the node_name_map[_fp] parameters.
  */
-nn_map_t *open_node_name_map(char *node_name_map);
+nn_map_t *open_node_name_map(const char *node_name_map);
 void  close_node_name_map(nn_map_t *map);
 char *remap_node_name(nn_map_t *map, uint64_t target_guid, char *nodedesc);
 	/* NOTE: parameter "nodedesc" may be modified here. */
diff --git a/include/complib/cl_packon.h b/include/complib/cl_packon.h
index ffc8e11..e2e45b4 100644
--- a/include/complib/cl_packon.h
+++ b/include/complib/cl_packon.h
@@ -55,14 +55,14 @@
 *	not align properly for some platforms. Care must be taken when creating
 *	packed structures that the alignment rules for all platforms are followed.
 *
-*	To pack a structure, include ipackon.h before defining the structure, and
-*	include ipackoff.h after the structure definition.  Multiple structures
+*	To pack a structure, include cl_packon.h before defining the structure, and
+*	include cl_packoff.h after the structure definition.  Multiple structures
 *	can be packed between the two include statements if desired.
 *
 *	The structure definition itself must use the PACK_SUFFIX keyword.
 *
 * EXAMPLE
-*	#include <complib/ipackon.h>
+*	#include <complib/cl_packon.h>
 *
 *	typedef _my_struct_t
 *	{
@@ -71,7 +71,7 @@
 *	    uint16 small;
 *
 *	} PACK_SUFFIX my_struct_t;
-*	#include <complib/ipackoff.h>
+*	#include <complib/cl_packoff.h>
 *********/
 
 #ifndef PACK_SUFFIX
diff --git a/include/complib/cl_spinlock.h b/include/complib/cl_spinlock.h
index 1a04b56..4de6f26 100644
--- a/include/complib/cl_spinlock.h
+++ b/include/complib/cl_spinlock.h
@@ -73,7 +73,6 @@ BEGIN_C_DECLS
 *
 *	Manipulation
 *		cl_spinlock_acquire, cl_spinlock_release
-*		cl_spinlock_acquire_irq, cl_spinlock_release_irq
 *********/
 /****f* Component Library: Spinlock/cl_spinlock_construct
 * NAME
@@ -133,9 +132,7 @@ cl_status_t cl_spinlock_init(IN cl_spinlock_t * const p_spinlock);
 *
 * SEE ALSO
 *	Spinlock, cl_spinlock_construct, cl_spinlock_destroy,
-*	cl_spinlock_acquire, cl_spinlock_acquire_irq,
-*	cl_spinlock_release, cl_spinlock_release
-*	cl_spinlock_release_irq, cl_spinlock_release_irq
+*	cl_spinlock_acquire, cl_spinlock_release
 *********/
 
 /****f* Component Library: Spinlock/cl_spinlock_destroy
@@ -174,8 +171,7 @@ void cl_spinlock_destroy(IN cl_spinlock_t * const p_spinlock);
 *	The cl_spinlock_acquire function acquires a spin lock.
 *	This version of lock does not prevent an interrupt from
 *	occuring on the processor on which the code is being
-*	executed. To protect from an interrupt level resource
-*	use the cl_spinlock_acquire_irq function.
+*	executed.
 *
 * SYNOPSIS
 */
@@ -189,33 +185,7 @@ void cl_spinlock_acquire(IN cl_spinlock_t * const p_spinlock);
 *	This function does not return a value.
 *
 * SEE ALSO
-*	Spinlock, cl_spinlock_acquire_irq, cl_spinlock_release
-*	cl_spinlock_release_irq
-*********/
-
-/****f* Component Library: Spinlock/cl_spinlock_acquire_irq
-* NAME
-*	cl_spinlock_acquire_irq
-*
-* DESCRIPTION
-*	The cl_spinlock_acquire_irq function acquires a spin lock and protects
-*	the current processor from taking interrupts. If you need to protect
-*	a variable from an interrupt resource, use this version to acquire
-*	a lock.
-*
-* SYNOPSIS
-*/
-void cl_spinlock_acquire_irq(IN cl_spinlock_t * const p_spinlock);
-/*
-* PARAMETERS
-*	p_spin_lock
-*		[in] Pointer to a spin lock structure to acquire.
-*
-* RETURN VALUE
-*	This function does not return a value.
-*
-* SEE ALSO
-*	Spinlock, cl_spinlock_release_irq
+*	Spinlock, cl_spinlock_release
 *********/
 
 /****f* Component Library: Spinlock/cl_spinlock_release
@@ -243,30 +213,5 @@ void cl_spinlock_release(IN cl_spinlock_t * const p_spinlock);
 *	Spinlock, cl_spinlock_acquire
 *********/
 
-/****f* Component Library: Spinlock/cl_spinlock_release_irq
-* NAME
-*	cl_spinlock_release_irq
-*
-* DESCRIPTION
-*	The cl_spinlock_release_irq function releases a spin lock object.
-*
-* SYNOPSIS
-*/
-void cl_spinlock_release_irq(IN cl_spinlock_t * const p_spinlock);
-/*
-* PARAMETERS
-*	p_spin_lock
-*		[in] Pointer to a spin lock structure to release.
-*
-* RETURN VALUE
-*	This function does not return a value.
-*
-* NOTES
-*	Releases a spin lock after a call to cl_spinlock_acquire.
-*
-* SEE ALSO
-*	Spinlock, cl_spinlock_acquire_irq
-*********/
-
 END_C_DECLS
 #endif				/* _CL_SPINLOCK_H_ */
diff --git a/include/complib/cl_threadpool.h b/include/complib/cl_threadpool.h
index e9b2c78..3ee6cf4 100644
--- a/include/complib/cl_threadpool.h
+++ b/include/complib/cl_threadpool.h
@@ -74,7 +74,7 @@ BEGIN_C_DECLS
 *		cl_thread_pool_t
 *
 *	Initialization:
-*		cl_thread_pool_construct, cl_thread_pool_init, cl_thread_pool_destroy
+*		cl_thread_pool_init, cl_thread_pool_destroy
 *
 *	Manipulation
 *		cl_thread_pool_signal
@@ -177,7 +177,7 @@ cl_thread_pool_init(IN cl_thread_pool_t * const p_thread_pool,
 *	are processors in the system.
 *
 * SEE ALSO
-*	Thread Pool, cl_thread_pool_construct, cl_thread_pool_destroy,
+*	Thread Pool, cl_thread_pool_destroy,
 *	cl_thread_pool_signal, cl_pfn_thread_callback_t
 *********/
 
@@ -207,10 +207,10 @@ void cl_thread_pool_destroy(IN cl_thread_pool_t * const p_thread_pool);
 *	state is valid from the calling thread context.
 *
 *	This function should only be called after a call to
-*	cl_thread_pool_construct or cl_thread_pool_init.
+*	cl_thread_pool_init.
 *
 * SEE ALSO
-*	Thread Pool, cl_thread_pool_construct, cl_thread_pool_init
+*	Thread Pool, cl_thread_pool_init
 *********/
 
 /****f* Component Library: Thread Pool/cl_thread_pool_signal
diff --git a/include/complib/cl_types_osd.h b/include/complib/cl_types_osd.h
index ce1a452..2538913 100644
--- a/include/complib/cl_types_osd.h
+++ b/include/complib/cl_types_osd.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -64,6 +64,18 @@ BEGIN_C_DECLS
 #include <inttypes.h>
 #include <assert.h>
 #include <string.h>
+
+/*
+ * Branch prediction hints
+ */
+#if defined(HAVE_BUILTIN_EXPECT)
+#define PT(exp)    __builtin_expect( ((uintptr_t)(exp)), 1 )
+#define PF(exp)    __builtin_expect( ((uintptr_t)(exp)), 0 )
+#else
+#define PT(exp)    (exp)
+#define PF(exp)    (exp)
+#endif
+
 #if defined (_DEBUG_)
 #define CL_ASSERT	assert
 #else				/* _DEBUG_ */
diff --git a/include/config.h.in b/include/config.h.in
index 1053319..35f45f0 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -18,6 +18,9 @@
 /* Define as 1 if you want to enable the performance manager profiling code */
 #undef ENABLE_OSM_PERF_MGR_PROFILE
 
+/* Define to 1 if the compiler supports __builtin_expect. */
+#undef HAVE_BUILTIN_EXPECT
+
 /* Define a default node name map file */
 #undef HAVE_DEFAULT_NODENAME_MAP
 
diff --git a/include/iba/ib_types.h b/include/iba/ib_types.h
index c8d51ca..86fa07b 100644
--- a/include/iba/ib_types.h
+++ b/include/iba/ib_types.h
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -212,6 +213,7 @@ BEGIN_C_DECLS
 * SOURCE
 */
 #define IB_DEFAULT_SUBNET_PREFIX			(CL_HTON64(0xFE80000000000000ULL))
+#define IB_DEFAULT_SUBNET_PREFIX_HO			(0xFE80000000000000ULL)
 /**********/
 /****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX
 * NAME
@@ -2586,6 +2588,9 @@ typedef struct _ib_path_rec {
 #define  IB_PR_COMPMASK_PKTLIFETIMESELEC  (CL_HTON64(((uint64_t)1)<<20))
 #define  IB_PR_COMPMASK_PKTLIFETIME       (CL_HTON64(((uint64_t)1)<<21))
 
+#define  IB_PR_COMPMASK_SERVICEID (IB_PR_COMPMASK_SERVICEID_MSB | \
+				   IB_PR_COMPMASK_SERVICEID_LSB)
+
 /* Link Record Component Masks */
 #define IB_LR_COMPMASK_FROM_LID           (CL_HTON64(((uint64_t)1)<<0))
 #define IB_LR_COMPMASK_FROM_PORT          (CL_HTON64(((uint64_t)1)<<1))
@@ -2797,6 +2802,9 @@ typedef struct _ib_path_rec {
 #define IB_MPR_COMPMASK_DGIDCOUNT	(CL_HTON64(((uint64_t)1)<<20))
 #define IB_MPR_COMPMASK_SERVICEID_LSB	(CL_HTON64(((uint64_t)1)<<21))
 
+#define IB_MPR_COMPMASK_SERVICEID (IB_MPR_COMPMASK_SERVICEID_MSB | \
+				   IB_MPR_COMPMASK_SERVICEID_LSB)
+
 /* SMInfo Record Component Masks */
 #define IB_SMIR_COMPMASK_LID		(CL_HTON64(((uint64_t)1)<<0))
 #define IB_SMIR_COMPMASK_RESV0		(CL_HTON64(((uint64_t)1)<<1))
@@ -3400,7 +3408,7 @@ ib_path_rec_hop_limit(IN const ib_path_rec_t * const p_rec)
 *
 * DESCRIPTION
 *	ClassPortInfo CapabilityMask bits.
-*	Switch only: This bit will be set if the EnhacedPort0
+*	Switch only: This bit will be set if the EnhancedPort0
 *	supports CA Congestion Control (A10.4.3.1).
 *
 * SEE ALSO
@@ -6235,6 +6243,65 @@ ib_port_info_set_phy_and_overrun_err_thd(IN ib_port_info_t * const p_pi,
 * SEE ALSO
 *********/
 
+/****f* IBA Base: Types/ib_port_info_get_m_key
+* NAME
+*	ib_port_info_get_m_key
+*
+* DESCRIPTION
+*	Gets the M_Key
+*
+* SYNOPSIS
+*/
+static inline ib_net64_t OSM_API
+ib_port_info_get_m_key(IN const ib_port_info_t * const p_pi)
+{
+	return p_pi->m_key;
+}
+
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*
+* RETURN VALUES
+*	M_Key.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+/****f* IBA Base: Types/ib_port_info_set_m_key
+* NAME
+*	ib_port_info_set_m_key
+*
+* DESCRIPTION
+*	Sets the M_Key value
+*
+* SYNOPSIS
+*/
+static inline void OSM_API
+ib_port_info_set_m_key(IN ib_port_info_t * const p_pi, IN ib_net64_t m_key)
+{
+	p_pi->m_key = m_key;
+}
+
+/*
+* PARAMETERS
+*	p_pi
+*		[in] Pointer to a PortInfo attribute.
+*	m_key
+*		[in] M_Key value.
+*
+* RETURN VALUES
+*	None.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
+
 /****s* IBA Base: Types/ib_mlnx_ext_port_info_t
 * NAME
 *	ib_mlnx_ext_port_info_t
@@ -7613,6 +7680,23 @@ ib_member_set_join_state(IN OUT ib_member_rec_t * p_mc_rec,
 #define IB_NOTICE_TYPE_INFO				0x04
 #define IB_NOTICE_TYPE_EMPTY				0x7F
 
+#define SM_GID_IN_SERVICE_TRAP				64
+#define SM_GID_OUT_OF_SERVICE_TRAP			65
+#define SM_MGID_CREATED_TRAP				66
+#define SM_MGID_DESTROYED_TRAP				67
+#define SM_UNPATH_TRAP					68
+#define SM_REPATH_TRAP					69
+#define SM_LINK_STATE_CHANGED_TRAP			128
+#define SM_LINK_INTEGRITY_THRESHOLD_TRAP		129
+#define SM_BUFFER_OVERRUN_THRESHOLD_TRAP		130
+#define SM_WATCHDOG_TIMER_EXPIRED_TRAP			131
+#define SM_LOCAL_CHANGES_TRAP				144
+#define SM_SYS_IMG_GUID_CHANGED_TRAP			145
+#define SM_BAD_MKEY_TRAP				256
+#define SM_BAD_PKEY_TRAP				257
+#define SM_BAD_QKEY_TRAP				258
+#define SM_BAD_SWITCH_PKEY_TRAP				259
+
 #include <complib/cl_packon.h>
 typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
 {
@@ -7740,7 +7824,7 @@ typedef struct _ib_mad_notice_attr	// Total Size calc  Accumulated
  * Trap 144 masks
  */
 #define TRAP_144_MASK_OTHER_LOCAL_CHANGES      0x01
-#define TRAP_144_MASK_LINK_SPEED_EXT_ENABLE_CHG (CL_HTON16(0x0020))
+#define TRAP_144_MASK_CAPABILITY_MASK2_CHANGE  (CL_HTON16(0x0020))
 #define TRAP_144_MASK_HIERARCHY_INFO_CHANGE    (CL_HTON16(0x0010))
 #define TRAP_144_MASK_SM_PRIORITY_CHANGE       (CL_HTON16(0x0008))
 #define TRAP_144_MASK_LINK_SPEED_ENABLE_CHANGE (CL_HTON16(0x0004))
@@ -7765,10 +7849,10 @@ ib_notice_is_generic(IN const ib_mad_notice_attr_t * p_ntc)
 /*
 * PARAMETERS
 *	p_ntc
-*		[in] Pointer to  the notice MAD attribute
+*		[in] Pointer to the notice MAD attribute
 *
 * RETURN VALUES
-*	TRUE if mad is generic
+*	TRUE if notice MAD is generic
 *
 * SEE ALSO
 *	ib_mad_notice_attr_t
diff --git a/include/opensm/osm_base.h b/include/opensm/osm_base.h
index 9ae6e9f..be2dca3 100644
--- a/include/opensm/osm_base.h
+++ b/include/opensm/osm_base.h
@@ -1007,6 +1007,7 @@ typedef enum _osm_sm_signal {
 #define OSM_VENDOR_ID_HP4           0x00237D
 #define OSM_VENDOR_ID_OPENIB        0x001405
 #define OSM_VENDOR_ID_IBM2	    0x5CF3FC
+#define OSM_VENDOR_ID_MELLANOX2     0xF45214
 
 /* IPoIB Broadcast Defaults */
 #define OSM_IPOIB_BROADCAST_MGRP_QKEY 0x0b1b
diff --git a/include/opensm/osm_congestion_control.h b/include/opensm/osm_congestion_control.h
index 94e4ffb..78e4a64 100644
--- a/include/opensm/osm_congestion_control.h
+++ b/include/opensm/osm_congestion_control.h
@@ -67,6 +67,8 @@
 
 #define OSM_CC_DEFAULT_MAX_OUTSTANDING_QUERIES 500
 
+#define OSM_CC_TIMEOUT_COUNT_THRESHOLD 3
+
 /****s* OpenSM: CongestionControl/osm_congestion_control_t
 *  This object should be treated as opaque and should
 *  be manipulated only through the provided functions.
diff --git a/include/opensm/osm_db.h b/include/opensm/osm_db.h
index d05bfa0..e8860f3 100644
--- a/include/opensm/osm_db.h
+++ b/include/opensm/osm_db.h
@@ -212,7 +212,7 @@ int osm_db_init(IN osm_db_t * p_db, IN struct osm_log * p_log);
 *
 * SYNOPSIS
 */
-osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name);
+osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN const char *domain_name);
 /*
 * PARAMETERS
 *
@@ -288,7 +288,8 @@ int osm_db_clear(IN osm_db_domain_t * p_domain);
 *
 * SYNOPSIS
 */
-int osm_db_store(IN osm_db_domain_t * p_domain);
+int osm_db_store(IN osm_db_domain_t * p_domain,
+		 IN boolean_t fsync_high_avail_files);
 /*
 * PARAMETERS
 *
@@ -296,6 +297,10 @@ int osm_db_store(IN osm_db_domain_t * p_domain);
 *		[in] Pointer to the database domain object to restore from
 *		     persistent db
 *
+*	fsync_high_avail_files
+*		[in] Boolean that indicates whether or not to synchronize
+*		     in-memory high availability files with storage
+*
 * RETURN VALUES
 *	0 if successful 1 otherwize
 *
diff --git a/include/opensm/osm_event_plugin.h b/include/opensm/osm_event_plugin.h
index 6a99ed9..ca5a719 100644
--- a/include/opensm/osm_event_plugin.h
+++ b/include/opensm/osm_event_plugin.h
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2013 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2007 The Regents of the University of California.
  *
@@ -39,6 +40,7 @@
 #include <iba/ib_types.h>
 #include <complib/cl_qlist.h>
 #include <opensm/osm_config.h>
+#include <opensm/osm_switch.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -77,6 +79,7 @@ typedef enum {
 	OSM_EVENT_ID_UCAST_ROUTING_DONE,
 	OSM_EVENT_ID_STATE_CHANGE,
 	OSM_EVENT_ID_SA_DB_DUMPED,
+	OSM_EVENT_ID_LFT_CHANGE,
 	OSM_EVENT_ID_MAX
 } osm_epi_event_id_t;
 
@@ -86,6 +89,24 @@ typedef struct osm_epi_port_id {
 	char node_name[OSM_EPI_NODE_NAME_LEN];
 } osm_epi_port_id_t;
 
+typedef enum {
+	LFT_CHANGED_LFT_TOP = (1 << 0),
+	LFT_CHANGED_BLOCK = (1 << 1)
+} osm_epi_lft_change_flags_t;
+
+typedef enum {
+	UCAST_ROUTING_NONE,
+	UCAST_ROUTING_HEAVY_SWEEP,
+	UCAST_ROUTING_REROUTE
+} osm_epi_ucast_routing_flags_t;
+
+typedef struct osm_epi_lft_change_event {
+	osm_switch_t *p_sw;
+	osm_epi_lft_change_flags_t flags;
+	uint16_t lft_top;
+	uint32_t block_num;
+} osm_epi_lft_change_event_t;
+
 /** =========================================================================
  * Port error event
  * OSM_EVENT_ID_PORT_COUNTER
diff --git a/include/opensm/osm_file_ids.h b/include/opensm/osm_file_ids.h
index 713a0f9..e23710c 100644
--- a/include/opensm/osm_file_ids.h
+++ b/include/opensm/osm_file_ids.h
@@ -149,6 +149,7 @@ typedef enum _osm_file_ids_enum {
 	OSM_FILE_VL_ARB_RCV_C,
 	OSM_FILE_ST_C,
 	OSM_FILE_UCAST_DFSSSP_C,
+	OSM_FILE_CONGESTION_CONTROL_C,
 } osm_file_ids_enum;
 /***********/
 
diff --git a/include/opensm/osm_helper.h b/include/opensm/osm_helper.h
index bc4bad3..f7b92f6 100644
--- a/include/opensm/osm_helper.h
+++ b/include/opensm/osm_helper.h
@@ -622,6 +622,10 @@ void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_smp,
 void osm_dump_sa_mad_v2(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_smp,
 			IN const int file_id, IN osm_log_level_t level);
 
+void osm_dump_dr_path_as_buf(IN size_t max_len, IN const osm_dr_path_t * p_path,
+			     OUT char* buf);
+
+
 /****f* IBA Base: Types/osm_get_sm_signal_str
 * NAME
 *	osm_get_sm_signal_str
diff --git a/include/opensm/osm_inform.h b/include/opensm/osm_inform.h
index f737441..8cefc20 100644
--- a/include/opensm/osm_inform.h
+++ b/include/opensm/osm_inform.h
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -200,6 +201,35 @@ void osm_infr_insert_to_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
 void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
 			     IN osm_infr_t * p_infr);
 
+/****f* OpenSM: Inform Record/osm_infr_remove_subscriptions
+* NAME
+*	osm_infr_remove_subscriptions
+*
+* DESCRIPTION
+*	Remove all event subscriptions of a port
+*
+* SYNOPSIS
+*/
+ib_api_status_t
+osm_infr_remove_subscriptions(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
+			      IN ib_net64_t port_guid);
+/*
+* PARAMETERS
+*	p_subn
+*		[in] Pointer to the subnet object
+*
+*	p_log
+*		[in] Pointer to the log object
+*
+*	port_guid
+*		[in] PortGUID of the subscriber that should be removed
+*
+* RETURN
+*	CL_SUCCESS if port_guid had any subscriptions being removed
+*	CL_NOT_FOUND if port_guid did not have any active subscriptions
+* SEE ALSO
+*********/
+
 /****f* OpenSM: Inform Record/osm_report_notice
 * NAME
 *	osm_report_notice
diff --git a/include/opensm/osm_log.h b/include/opensm/osm_log.h
index 3247296..61ba750 100644
--- a/include/opensm/osm_log.h
+++ b/include/opensm/osm_log.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -427,7 +427,7 @@ static inline void osm_log_set_level(IN osm_log_t * p_log,
 *		[in] New level to set.
 *
 * RETURN VALUES
-*	Returns the current log level.
+*	This function does not return a value.
 *
 * NOTES
 *
diff --git a/include/opensm/osm_madw.h b/include/opensm/osm_madw.h
index afc3680..9fb7d5d 100644
--- a/include/opensm/osm_madw.h
+++ b/include/opensm/osm_madw.h
@@ -182,6 +182,7 @@ typedef struct osm_pi_context {
 	boolean_t set_method;
 	boolean_t light_sweep;
 	boolean_t active_transition;
+	boolean_t client_rereg;
 } osm_pi_context_t;
 /*********/
 
@@ -229,6 +230,7 @@ typedef struct osm_si_context {
 	ib_net64_t node_guid;
 	boolean_t set_method;
 	boolean_t light_sweep;
+	boolean_t lft_top_change;
 } osm_si_context_t;
 /*********/
 
@@ -334,7 +336,8 @@ typedef struct osm_perfmgr_context {
 	uint64_t node_guid;
 	uint16_t port;
 	uint8_t mad_method;	/* was this a get or a set */
-#if ENABLE_OSM_PERF_MGR_PROFILE
+	ib_net16_t mad_attr_id;
+#ifdef ENABLE_OSM_PERF_MGR_PROFILE
 	struct timeval query_start;
 #endif
 } osm_perfmgr_context_t;
diff --git a/include/complib/cl_types_osd.h b/include/opensm/osm_mcast_mgr.h
similarity index 66%
copy from include/complib/cl_types_osd.h
copy to include/opensm/osm_mcast_mgr.h
index ce1a452..291a478 100644
--- a/include/complib/cl_types_osd.h
+++ b/include/opensm/osm_mcast_mgr.h
@@ -1,7 +1,9 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
+ * Copyright (C) 2012-2013 Tokyo Institute of Technology. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -35,13 +37,13 @@
 
 /*
  * Abstract:
- *	Defines sized datatypes for Linux User mode
- *  exported sizes are int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t
- *  int64_t, uint64_t.
+ * 	Declaration of osm_mcast_work_obj_t.
+ * 	Provide access to a mcast function which searches the root swicth for
+ * 	a spanning tree.
  */
 
-#ifndef _CL_TYPES_OSD_H_
-#define _CL_TYPES_OSD_H_
+#ifndef _OSM_MCAST_MGR_H_
+#define _OSM_MCAST_MGR_H_
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -52,34 +54,19 @@
 #endif				/* __cplusplus */
 
 BEGIN_C_DECLS
-#if defined (_DEBUG_)
-#ifdef __IA64__
-#define cl_break() asm("   break 0")
-#else				/* __IA64__ */
-#define cl_break() asm("   int $3")
-#endif				/* __IA64__ */
-#else				/* _DEBUG_ */
-#define cl_break
-#endif
-#include <inttypes.h>
-#include <assert.h>
-#include <string.h>
-#if defined (_DEBUG_)
-#define CL_ASSERT	assert
-#else				/* _DEBUG_ */
-#define CL_ASSERT( __exp__ )
-#endif				/* _DEBUG_ */
-/*
- * Types not explicitly defined are native to the platform.
- */
-typedef int boolean_t;
-typedef volatile int32_t atomic32_t;
 
-#ifndef NULL
-#define NULL	(void*)0
-#endif
+typedef struct osm_mcast_work_obj {
+	cl_list_item_t list_item;
+	osm_port_t *p_port;
+	cl_map_item_t map_item;
+} osm_mcast_work_obj_t;
+
+int osm_mcast_make_port_list_and_map(cl_qlist_t * list, cl_qmap_t * map,
+				     osm_mgrp_box_t * mbox);
+
+void osm_mcast_drop_port_list(cl_qlist_t * list);
 
-#define UNUSED_PARAM( P )
+osm_switch_t * osm_mcast_mgr_find_root_switch(osm_sm_t * sm, cl_qlist_t * list);
 
 END_C_DECLS
-#endif				/* _CL_TYPES_OSD_H_ */
+#endif				/* _OSM_MCAST_MGR_H_ */
diff --git a/include/opensm/osm_multicast.h b/include/opensm/osm_multicast.h
index 11d789b..e192a72 100644
--- a/include/opensm/osm_multicast.h
+++ b/include/opensm/osm_multicast.h
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -447,7 +448,7 @@ void osm_mgrp_delete_port(IN osm_subn_t * subn, IN osm_log_t * log,
 * SEE ALSO
 *********/
 
-void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
+boolean_t osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
 			  osm_mcm_alias_guid_t * mcm_alias_guid,
 			  ib_member_rec_t * mcmr);
 void osm_mgrp_cleanup(osm_subn_t * subn, osm_mgrp_t * mpgr);
diff --git a/include/opensm/osm_node.h b/include/opensm/osm_node.h
index 482ed89..b07a455 100644
--- a/include/opensm/osm_node.h
+++ b/include/opensm/osm_node.h
@@ -102,6 +102,7 @@ typedef struct osm_node {
 	uint32_t discovery_count;
 	uint32_t physp_tbl_size;
 	char *print_desc;
+	uint8_t *physp_discovered;
 	osm_physp_t physp_table[1];
 } osm_node_t;
 /*
@@ -125,14 +126,19 @@ typedef struct osm_node {
 *		during the current fabric sweep.  This number is reset
 *		to zero at the start of a sweep.
 *
-*	phsyp_tbl_size
+*	physp_tbl_size
 *		The size of the physp_table array.  This value is one greater
 *		than the number of ports in the node, since port numbers
-*		start with 1 for some bizzare reason.
+*		start with 1 for some bizarre reason.
 *
 *	print_desc
 *		A printable version of the node description.
 *
+*	physp_discovered
+*		Array of physp_discovered objects for all ports of this node.
+*		Each object indiactes whether the port has been discovered
+*		during the sweep or not. 1 means that the port had been discovered.
+*
 *	phsyp_table
 *		Array of physical port objects belonging to this node.
 *		Index is contiguous by local port number.
diff --git a/include/opensm/osm_opensm.h b/include/opensm/osm_opensm.h
index dbff4f6..4750505 100644
--- a/include/opensm/osm_opensm.h
+++ b/include/opensm/osm_opensm.h
@@ -135,6 +135,10 @@ struct osm_routing_engine {
 	void (*update_sl2vl)(void *context, IN osm_physp_t *port,
 			     IN uint8_t in_port_num, IN uint8_t out_port_num,
 			     IN OUT ib_slvl_table_t *t);
+	void (*update_vlarb)(void *context, IN osm_physp_t *port,
+			     IN uint8_t port_num,
+			     IN OUT ib_vl_arb_table_t *block,
+			     unsigned block_length, unsigned block_num);
 	uint8_t (*path_sl)(void *context, IN uint8_t path_sl_hint,
 			   IN const ib_net16_t slid, IN const ib_net16_t dlid);
 	ib_api_status_t (*mcast_build_stree)(void *context,
@@ -164,11 +168,19 @@ struct osm_routing_engine {
 *		     IN uint8_t in_port_num, IN uint8_t out_port_num,
 *		     OUT ib_slvl_table_t *t)
 *		The callback to allow routing engine input for SL2VL maps.
-*		*port is the phyical port for which the SL2VL map is to be
+*		*port is the physical port for which the SL2VL map is to be
 *		updated. For switches, in_port_num/out_port_num identify
 *		which part of the SL2VL map to update.  For router/HCA ports,
 *		in_port_num/out_port_num should be ignored.
 *
+*	update_vlarb(void *context, IN osm_physp_t *port,
+*		     IN uint8_t port_num,
+*		     IN OUT ib_vl_arb_table_t *block,
+*		     unsigned block_length, unsigned block_num)
+*		The callback to allow routing engine input for VLArbitration.
+*		*port is the physical port for which the VLArb table is to be
+*		updated.
+*
 *	path_sl
 *		The callback for computing path SL.
 *
@@ -207,8 +219,10 @@ typedef struct osm_opensm {
 	osm_congestion_control_t cc;
 	cl_qlist_t plugin_list;
 	osm_db_t db;
+	boolean_t mad_pool_constructed;
 	osm_mad_pool_t mad_pool;
 	osm_vendor_t *p_vendor;
+	boolean_t vl15_constructed;
 	osm_vl15_t vl15;
 	osm_log_t log;
 	cl_dispatcher_t disp;
@@ -301,6 +315,34 @@ void osm_opensm_construct(IN osm_opensm_t * p_osm);
 *	SM object, osm_opensm_init, osm_opensm_destroy
 *********/
 
+/****f* OpenSM: OpenSM/osm_opensm_construct_finish
+* NAME
+*	osm_opensm_construct_finish
+*
+* DESCRIPTION
+*	The osm_opensm_construct_finish function completes
+*	the second phase of constucting an OpenSM object.
+*
+* SYNOPSIS
+*/
+void osm_opensm_construct_finish(IN osm_opensm_t * p_osm);
+/*
+* PARAMETERS
+*	p_osm
+*		[in] Pointer to a OpenSM object to construct.
+*
+* RETURN VALUE
+*	This function does not return a value.
+*
+* NOTES
+*	Calling osm_opensm_construct/osm_construct_finish is a prerequisite
+*	to calling any other method except osm_opensm_init/osm_opensm_init_finish.
+*
+* SEE ALSO
+*	SM object, osm_opensm_init, osm_opensm_construct_finish,
+*	osm_opensm_destroy, osm_opensm_destroy_finish
+*********/
+
 /****f* OpenSM: OpenSM/osm_opensm_destroy
 * NAME
 *	osm_opensm_destroy
@@ -330,6 +372,36 @@ void osm_opensm_destroy(IN osm_opensm_t * p_osm);
 *	SM object, osm_opensm_construct, osm_opensm_init
 *********/
 
+/****f* OpenSM: OpenSM/osm_opensm_destroy_finish
+* NAME
+*	osm_opensm_destroy_finish
+*
+* DESCRIPTION
+*	The osm_opensm_destroy_finish function handles the second phase
+*	of destroying an SM, releasing all resources.
+*
+* SYNOPSIS
+*/
+void osm_opensm_destroy_finish(IN osm_opensm_t * p_osm);
+/*
+* PARAMETERS
+*	p_osm
+*		[in] Pointer to a OpenSM object to destroy.
+*
+* RETURN VALUE
+*	This function does not return a value.
+*
+* NOTES
+*	Performs second phase of any necessary cleanup of the specified OpenSM object.
+*	Further operations should not be attempted on the destroyed object.
+*	This function should only be called after a call to
+*	osm_opensm_construct_finish or osm_opensm_init_finish.
+*
+* SEE ALSO
+*	SM object, osm_opensm_construct, osm_opensm_construct_finish,
+*	osm_opensm_init, osm_opensm_init_finish
+*********/
+
 /****f* OpenSM: OpenSM/osm_opensm_init
 * NAME
 *	osm_opensm_init
@@ -359,6 +431,37 @@ ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm,
 *	SM object, osm_opensm_construct, osm_opensm_destroy
 *********/
 
+/****f* OpenSM: OpenSM/osm_opensm_init_finish
+* NAME
+*	osm_opensm_init_finish
+*
+* DESCRIPTION
+*	The osm_opensm_init_finish function performs the second phase
+*	of initialization of an OpenSM object.
+*
+* SYNOPSIS
+*/
+ib_api_status_t osm_opensm_init_finish(IN osm_opensm_t * p_osm,
+				       IN const osm_subn_opt_t * p_opt);
+/*
+* PARAMETERS
+*	p_osm
+*		[in] Pointer to an osm_opensm_t object to initialize.
+*
+*	p_opt
+*		[in] Pointer to the subnet options structure.
+*
+* RETURN VALUES
+*	IB_SUCCESS if the OpenSM object was initialized successfully.
+*
+* NOTES
+*	Allows calling other OpenSM methods.
+*
+* SEE ALSO
+*	SM object, osm_opensm_construct, osm_opensm_construct_finish,
+*	osm_opensm_destroy, osm_opensm_destroy_finish
+*********/
+
 /****f* OpenSM: OpenSM/osm_opensm_sweep
 * NAME
 *	osm_opensm_sweep
diff --git a/include/opensm/osm_perfmgr.h b/include/opensm/osm_perfmgr.h
index 97fead1..0304d9c 100644
--- a/include/opensm/osm_perfmgr.h
+++ b/include/opensm/osm_perfmgr.h
@@ -100,6 +100,9 @@ typedef struct monitored_port {
 	ib_net16_t lid;
 	ib_net16_t pkey;
 	ib_net32_t qp;
+	/* ClassPortInfo fields */
+	boolean_t cpi_valid;
+	ib_net16_t cap_mask;
 } monitored_port_t;
 
 /* Node to store information about nodes being monitored */
@@ -107,6 +110,7 @@ typedef struct monitored_node {
 	cl_map_item_t map_item;
 	struct monitored_node *next;
 	uint64_t guid;
+	uint8_t node_type;
 	boolean_t esp0;
 	char *name;
 	uint32_t num_ports;
@@ -133,6 +137,7 @@ typedef struct osm_perfmgr {
 	cl_disp_reg_handle_t pc_disp_h;
 	osm_perfmgr_state_t state;
 	osm_perfmgr_sweep_state_t sweep_state;
+	cl_spinlock_t lock;
 	uint16_t sweep_time_s;
 	perfmgr_db_t *db;
 	atomic32_t outstanding_queries;	/* this along with sig_query */
@@ -144,6 +149,7 @@ typedef struct osm_perfmgr {
 	ib_net64_t port_guid;
 	int16_t local_port;
 	int rm_nodes;
+	boolean_t query_cpi;
 } osm_perfmgr_t;
 /*
 * FIELDS
@@ -186,11 +192,23 @@ inline static void osm_perfmgr_set_rm_nodes(osm_perfmgr_t *perfmgr,
 {
 	perfmgr->rm_nodes = rm_nodes;
 }
+
 inline static int osm_perfmgr_get_rm_nodes(osm_perfmgr_t *perfmgr)
 {
 	return perfmgr->rm_nodes;
 }
 
+inline static void osm_perfmgr_set_query_cpi(osm_perfmgr_t *perfmgr,
+					    int query_cpi)
+{
+	perfmgr->query_cpi = query_cpi;
+}
+
+inline static int osm_perfmgr_get_query_cpi(osm_perfmgr_t *perfmgr)
+{
+	return perfmgr->query_cpi;
+}
+
 inline static const char *osm_perfmgr_get_state_str(osm_perfmgr_t * p_perfmgr)
 {
 	switch (p_perfmgr->state) {
@@ -247,6 +265,8 @@ void osm_perfmgr_dump_counters(osm_perfmgr_t * p_perfmgr,
 			       perfmgr_db_dump_t dump_type);
 void osm_perfmgr_print_counters(osm_perfmgr_t *pm, char *nodename, FILE *fp,
 				char *port, int err_only);
+void osm_perfmgr_update_nodename(osm_perfmgr_t *pm, uint64_t node_guid,
+				char *nodename);
 
 ib_api_status_t osm_perfmgr_bind(osm_perfmgr_t * p_perfmgr,
 				 ib_net64_t port_guid);
diff --git a/include/opensm/osm_perfmgr_db.h b/include/opensm/osm_perfmgr_db.h
index 6333692..ed14f76 100644
--- a/include/opensm/osm_perfmgr_db.h
+++ b/include/opensm/osm_perfmgr_db.h
@@ -164,6 +164,9 @@ perfmgr_db_err_t perfmgr_db_create_entry(perfmgr_db_t * db, uint64_t guid,
 perfmgr_db_err_t perfmgr_db_delete_entry(perfmgr_db_t * db, uint64_t guid);
 perfmgr_db_err_t perfmgr_db_delete_inactive(perfmgr_db_t * db, unsigned *cnt);
 
+perfmgr_db_err_t perfmgr_db_update_name(perfmgr_db_t * db, uint64_t node_guid,
+					char *name);
+
 perfmgr_db_err_t perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid,
 					    uint8_t port,
 					    perfmgr_db_err_reading_t * reading);
@@ -176,7 +179,8 @@ perfmgr_db_err_t perfmgr_db_clear_prev_err(perfmgr_db_t * db, uint64_t guid,
 perfmgr_db_err_t perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid,
 					   uint8_t port,
 					   perfmgr_db_data_cnt_reading_t *
-					   reading);
+					   reading,
+					   int ietf_sup);
 perfmgr_db_err_t perfmgr_db_get_prev_dc(perfmgr_db_t * db, uint64_t guid,
 					uint8_t port,
 					perfmgr_db_data_cnt_reading_t *
@@ -204,8 +208,9 @@ void perfmgr_db_fill_err_read(ib_port_counters_t * wire_read,
 			      perfmgr_db_err_reading_t * reading);
 void perfmgr_db_fill_data_cnt_read_pc(ib_port_counters_t * wire_read,
 				      perfmgr_db_data_cnt_reading_t * reading);
-void perfmgr_db_fill_data_cnt_read_epc(ib_port_counters_ext_t * wire_read,
-				       perfmgr_db_data_cnt_reading_t * reading);
+void perfmgr_db_fill_data_cnt_read_pce(ib_port_counters_ext_t * wire_read,
+				       perfmgr_db_data_cnt_reading_t * reading,
+				       int ietf_sup);
 
 END_C_DECLS
 
diff --git a/include/opensm/osm_pkey.h b/include/opensm/osm_pkey.h
index 54888e6..090a8be 100644
--- a/include/opensm/osm_pkey.h
+++ b/include/opensm/osm_pkey.h
@@ -82,7 +82,7 @@ struct osm_physp;
 * SYNOPSIS
 */
 typedef struct osm_pkeybl {
-	cl_ptr_vector_t accum_pkeys;
+	cl_map_t accum_pkeys;
 	cl_ptr_vector_t blocks;
 	cl_ptr_vector_t new_blocks;
 	cl_map_t keys;
@@ -90,6 +90,7 @@ typedef struct osm_pkeybl {
 	uint16_t last_pkey_idx;
 	uint16_t used_blocks;
 	uint16_t max_blocks;
+	uint16_t rcv_blocks_cnt;
 } osm_pkey_tbl_t;
 /*
 * FIELDS
@@ -119,6 +120,11 @@ typedef struct osm_pkeybl {
 *		switch_info updated on receiving the node_info or switch_info
 *		GetResp
 *
+*	rcv_blocks_cnt
+*		Counter for the received GetPKeyTable mads.
+*		For every GetPKeyTable mad we send, increase the counter,
+*		and for every GetRespPKeyTable we decrease the counter.
+*
 * NOTES
 * 'blocks' vector should be used to store pkey values obtained from
 * the port and SM pkey manager should not change it directly, for this
@@ -294,6 +300,18 @@ static inline ib_pkey_table_t *osm_pkey_tbl_new_block_get(const osm_pkey_tbl_t *
 		&p_pkey_tbl->new_blocks, block) : NULL);
 };
 
+/****f* OpenSM: osm_pkey_find_last_accum_pkey_index
+ * NAME
+ *   osm_pkey_find_last_accum_pkey_index
+ *
+ * DESCRIPTION
+ *   Finds the next last accumulated pkey
+ *
+ * SYNOPSIS
+ */
+void osm_pkey_find_last_accum_pkey_index(IN osm_pkey_tbl_t * p_pkey_tbl);
+
+
 /****f* OpenSM: osm_pkey_tbl_set_accum_pkeys
 * NAME
 *  osm_pkey_tbl_set_accum_pkeys
@@ -322,29 +340,6 @@ osm_pkey_tbl_set_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl,
 *
 *********/
 
-/****f* OpenSM: osm_pkey_tbl_clear_accum_pkeys
-* NAME
-*  osm_pkey_tbl_clear_accum_pkeys
-*
-* DESCRIPTION
-*   Clears the given pkey in the "accum_pkeys" array
-*
-* SYNOPSIS
-*/
-void
-osm_pkey_tbl_clear_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl,
-			       IN uint16_t pkey);
-/*
-* p_pkey_tbl
-*   [in] Pointer to the PKey table
-*
-* pkey
-*   [in] PKey to clear
-*
-* NOTES
-*
-*********/
-
 /****f* OpenSM: osm_pkey_tbl_set_new_entry
 * NAME
 *  osm_pkey_tbl_set_new_entry
diff --git a/include/opensm/osm_port.h b/include/opensm/osm_port.h
index 5fc186c..206c4a9 100644
--- a/include/opensm/osm_port.h
+++ b/include/opensm/osm_port.h
@@ -474,6 +474,36 @@ void osm_physp_set_port_info(IN osm_physp_t * p_physp,
 *	Port, Physical Port
 *********/
 
+/****f* OpenSM: Physical Port/osm_physp_set_base_lid
+* NAME
+*	osm_physp_set_base_lid
+*
+* DESCRIPTION
+*	Sets the base lid for this Physical Port.
+*
+* SYNOPSIS
+*/
+static inline void osm_physp_set_base_lid(IN osm_physp_t * p_physp,
+					  IN ib_net16_t base_lid)
+{
+	CL_ASSERT(p_physp);
+	CL_ASSERT(osm_physp_is_valid(p_physp));
+	p_physp->port_info.base_lid = base_lid;
+}
+
+/*
+* PARAMETERS
+*	p_physp
+*		[in] Pointer to an osm_physp_t object.
+*
+*	base_lid
+*		[in] Lid to set.
+*
+* NOTES
+*
+* SEE ALSO
+*********/
+
 /****f* OpenSM: Physical Port/osm_physp_set_pkey_tbl
 * NAME
 *  osm_physp_set_pkey_tbl
@@ -486,7 +516,8 @@ void osm_physp_set_port_info(IN osm_physp_t * p_physp,
 void osm_physp_set_pkey_tbl(IN osm_log_t * p_log, IN const osm_subn_t * p_subn,
 			    IN osm_physp_t * p_physp,
 			    IN ib_pkey_table_t * p_pkey_tbl,
-			    IN uint16_t block_num);
+			    IN uint16_t block_num,
+			    IN boolean_t is_set);
 /*
 * PARAMETERS
 *	p_log
@@ -1163,7 +1194,11 @@ typedef struct osm_port {
 	osm_physp_t *p_physp;
 	cl_qlist_t mcm_list;
 	int flag;
+	int use_scatter;
+	unsigned int cc_timeout_count;
+	int cc_unavailable_flag;
 	void *priv;
+	ib_net16_t lid;
 } osm_port_t;
 /*
 * FIELDS
@@ -1195,6 +1230,12 @@ typedef struct osm_port {
 *	flag
 *		Utility flag for port management
 *
+*	cc_timeout_count
+*		Count number of times congestion control config times out.
+*
+*	cc_unavailable_flag
+*		Flag indicating if congestion control is not supported.
+*
 * SEE ALSO
 *	Port, Physical Port, Physical Port Table
 *********/
diff --git a/include/opensm/osm_sa.h b/include/opensm/osm_sa.h
index 7c1061d..f9f334e 100644
--- a/include/opensm/osm_sa.h
+++ b/include/opensm/osm_sa.h
@@ -73,8 +73,8 @@ BEGIN_C_DECLS
 *
 * DESCRIPTION
 *	The SA object encapsulates the information needed by the
-*	OpenSM to instantiate a subnet administrator.  The OpenSM allocates
-*	one SA object per subnet manager.
+*	OpenSM to instantiate subnet administration.  The OpenSM
+*	allocates one SA object per subnet manager.
 *
 *	The SA object is thread safe.
 *
@@ -86,6 +86,7 @@ BEGIN_C_DECLS
 *	Anil Keshavamurthy, Intel
 *
 *********/
+
 /****d* OpenSM: SA/osm_sa_state_t
 * NAME
 *	osm_sa_state_t
@@ -101,6 +102,70 @@ typedef enum _osm_sa_state {
 } osm_sa_state_t;
 /***********/
 
+/****d* OpenSM: SA/osm_mpr_rec_t
+* NAME
+*	osm_mpr_rec_t
+*
+* DESCRIPTION
+*	SA MultiPathRecord response.
+*
+* SYNOPSIS
+*/
+typedef struct osm_mpr_rec {
+	ib_path_rec_t path_rec;
+	const osm_port_t *p_src_port;
+	const osm_port_t *p_dest_port;
+	int hops;
+} osm_mpr_rec_t;
+/***********/
+
+/****d* OpenSM: SA/osm_sa_item_t
+* NAME
+*	osm_sa_item_t
+*
+* DESCRIPTION
+*	SA response item.
+*
+* SYNOPSIS
+*/
+typedef struct osm_sa_item {
+	cl_list_item_t list_item;
+	union {
+		char data[0];
+		ib_guidinfo_record_t guid_rec;
+		ib_inform_info_t inform;
+		ib_inform_info_record_t inform_rec;
+		ib_lft_record_t lft_rec;
+		ib_link_record_t link_rec;
+		ib_member_rec_t mc_rec;
+		ib_mft_record_t mft_rec;
+		osm_mpr_rec_t mpr_rec;
+		ib_node_record_t node_rec;
+		ib_path_rec_t path_rec;
+		ib_pkey_table_record_t pkey_rec;
+		ib_portinfo_record_t port_rec;
+		ib_service_record_t service_rec;
+		ib_slvl_table_record_t slvl_rec;
+		ib_sminfo_record_t sminfo_rec;
+		ib_switch_info_record_t swinfo_rec;
+		ib_vl_arb_table_record_t vlarb_rec;
+	} resp;
+} osm_sa_item_t;
+/*
+* NOTES
+*	Actual structure allocated is based on SA attribute
+*	type. As such, it is variable sized. The allocation
+*	occurs in the SA attribute handling code.
+*	Note also that the size is specified external
+*	to this structure (It's passed as a parameter to
+*	osm_sa_respond). The SA_ITEM_RESP_SIZE macro
+*	facilitates determining the size required.
+*
+***********/
+
+#define SA_ITEM_RESP_SIZE(_m) offsetof(osm_sa_item_t, resp._m) + \
+			      sizeof(((osm_sa_item_t *)NULL)->resp._m)
+
 /****s* OpenSM: SM/osm_sa_t
 * NAME
 *	osm_sa_t
@@ -490,5 +555,51 @@ osm_mgrp_t *osm_mcmr_rcv_find_or_create_new_mgrp(IN osm_sa_t * sa,
 *
 *********/
 
+/**
+ * The following expose functionality of osm_sa_path_record.c for internal use
+ * by sub managers
+ */
+typedef struct osm_path_parms {
+	ib_net16_t pkey;
+	uint8_t mtu;
+	uint8_t rate;
+	uint8_t sl;
+	uint8_t pkt_life;
+	boolean_t reversible;
+	int hops;
+} osm_path_parms_t;
+
+ib_api_status_t osm_get_path_params(IN osm_sa_t * sa,
+				    IN const osm_port_t * p_src_port,
+				    IN const uint16_t slid_ho,
+				    IN const osm_port_t * p_dest_port,
+				    IN const uint16_t dlid_ho,
+				    OUT osm_path_parms_t * p_parms);
+
+ib_net16_t osm_pr_get_end_points(IN osm_sa_t * sa,
+					IN const ib_sa_mad_t *sa_mad,
+					OUT const osm_alias_guid_t ** pp_src_alias_guid,
+					OUT const osm_alias_guid_t ** pp_dest_alias_guid,
+					OUT const osm_port_t ** pp_src_port,
+					OUT const osm_port_t ** pp_dest_port,
+					OUT const ib_gid_t ** pp_sgid,
+					OUT const ib_gid_t ** pp_dgid);
+
+void osm_pr_process_pair(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
+				IN const osm_port_t * requester_port,
+				IN const osm_alias_guid_t * p_src_alias_guid,
+				IN const osm_alias_guid_t * p_dest_alias_guid,
+				IN const ib_gid_t * p_sgid,
+				IN const ib_gid_t * p_dgid,
+				IN cl_qlist_t * p_list);
+
+void osm_pr_process_half(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
+				IN const osm_port_t * requester_port,
+				IN const osm_alias_guid_t * p_src_alias_guid,
+				IN const osm_alias_guid_t * p_dest_alias_guid,
+				IN const ib_gid_t * p_sgid,
+				IN const ib_gid_t * p_dgid,
+				IN cl_qlist_t * p_list);
+
 END_C_DECLS
 #endif				/* _OSM_SA_H_ */
diff --git a/include/opensm/osm_sm.h b/include/opensm/osm_sm.h
index 710d206..e48c549 100644
--- a/include/opensm/osm_sm.h
+++ b/include/opensm/osm_sm.h
@@ -402,6 +402,7 @@ ib_api_status_t osm_sm_bind(IN osm_sm_t * p_sm, IN ib_net64_t port_guid);
 */
 ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
 			    IN ib_net16_t attr_id, IN ib_net32_t attr_mod,
+			    IN boolean_t find_mkey, ib_net64_t m_key,
 			    IN cl_disp_msgid_t err_msg,
 			    IN const osm_madw_context_t * p_context);
 /*
@@ -419,6 +420,13 @@ ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
 *	attr_mod
 *		[in] Attribute modifier for this request.
 *
+*	find_mkey
+*		[in] Flag to indicate whether the M_Key should be looked up for
+*		     this MAD.
+* 	m_key
+* 		[in] M_Key value to be send with this MAD. Applied, only when
+* 		     find_mkey is FALSE.
+*
 *	err_msg
 *		[in] Message id with which to post this MAD if an error occurs.
 *
@@ -467,7 +475,8 @@ void osm_send_req_mad(IN osm_sm_t * sm, IN osm_madw_t *p_madw);
 osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
 				IN const uint8_t * p_payload,
 				IN size_t payload_size, IN ib_net16_t attr_id,
-				IN ib_net32_t attr_mod, IN cl_disp_msgid_t err_msg,
+				IN ib_net32_t attr_mod, IN boolean_t find_mkey,
+				IN ib_net64_t m_key, IN cl_disp_msgid_t err_msg,
 				IN const osm_madw_context_t * p_context);
 /*
 * PARAMETERS
@@ -489,6 +498,13 @@ osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_pat
 *	attr_mod
 *		[in] Attribute modifier for this request.
 *
+*	find_mkey
+*		[in] Flag to indicate whether the M_Key should be looked up for
+*		     this MAD.
+* 	m_key
+* 		[in] M_Key value to be send with this MAD. Applied, only when
+* 		     find_mkey is FALSE.
+*
 *	err_msg
 *		[in] Message id with which to post this MAD if an error occurs.
 *
@@ -513,7 +529,8 @@ osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_pat
 ib_api_status_t osm_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
 			    IN const uint8_t * p_payload,
 			    IN size_t payload_size, IN ib_net16_t attr_id,
-			    IN ib_net32_t attr_mod, IN cl_disp_msgid_t err_msg,
+			    IN ib_net32_t attr_mod, IN boolean_t find_mkey,
+			    IN ib_net64_t m_key, IN cl_disp_msgid_t err_msg,
 			    IN const osm_madw_context_t * p_context);
 /*
 * PARAMETERS
@@ -535,6 +552,14 @@ ib_api_status_t osm_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
 *	attr_mod
 *		[in] Attribute modifier for this request.
 *
+*	find_mkey
+*		[in] Flag to indicate whether the M_Key should be looked up for
+*		     this MAD.
+*
+* 	m_key
+* 		[in] M_Key value to be send with this MAD. Applied, only when
+* 		     find_mkey is FALSE.
+*
 *	err_msg
 *		[in] Message id with which to post this MAD if an error occurs.
 *
diff --git a/include/opensm/osm_subnet.h b/include/opensm/osm_subnet.h
index 803e39c..03f116e 100644
--- a/include/opensm/osm_subnet.h
+++ b/include/opensm/osm_subnet.h
@@ -5,6 +5,7 @@
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
  * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -243,7 +244,7 @@ typedef struct osm_cct {
 * SYNOPSIS
 */
 typedef struct osm_subn_opt {
-	char *config_file;
+	const char *config_file;
 	ib_net64_t guid;
 	ib_net64_t m_key;
 	ib_net64_t sm_key;
@@ -251,6 +252,7 @@ typedef struct osm_subn_opt {
 	ib_net64_t subnet_prefix;
 	ib_net16_t m_key_lease_period;
 	uint8_t m_key_protect_bits;
+	boolean_t m_key_lookup;
 	uint32_t sweep_interval;
 	uint32_t max_wire_smps;
 	uint32_t max_wire_smps2;
@@ -315,6 +317,7 @@ typedef struct osm_subn_opt {
 	uint16_t max_reverse_hops;
 	char *ids_guid_file;
 	char *guid_routing_order_file;
+	boolean_t guid_routing_order_no_scatter;
 	char *sa_db_file;
 	boolean_t sa_db_dump;
 	char *torus_conf_file;
@@ -324,7 +327,9 @@ typedef struct osm_subn_opt {
 	boolean_t daemon;
 	boolean_t sm_inactive;
 	boolean_t babbling_port_policy;
+	boolean_t drop_event_subscriptions;
 	boolean_t use_optimized_slvl;
+	boolean_t fsync_high_avail_files;
 	osm_qos_options_t qos_options;
 	osm_qos_options_t qos_ca_options;
 	osm_qos_options_t qos_sw0_options;
@@ -356,6 +361,7 @@ typedef struct osm_subn_opt {
 	char *event_db_dump_file;
 	int perfmgr_rm_nodes;
 	boolean_t perfmgr_log_errors;
+	boolean_t perfmgr_query_cpi;
 #endif				/* ENABLE_OSM_PERF_MGR */
 	char *event_plugin_name;
 	char *event_plugin_options;
@@ -593,10 +599,17 @@ typedef struct osm_subn_opt {
 *	babbling_port_policy
 *		OpenSM will enforce its "babbling" port policy.
 *
+*	drop_event_subscriptions
+*		OpenSM will drop event subscriptions if the port goes away.
+*
 *	use_optimized_slvl
 *		Use optimized SLtoVLMappingTable programming if
 *		device indicates it supports this.
 *
+*	fsync_high_avail_files
+*		Synchronize high availability in memory files
+*		with storage.
+*
 *	perfmgr
 *		Enable or disable the performance manager
 *
@@ -742,6 +755,7 @@ typedef struct osm_subn {
 	uint8_t min_ca_mtu;
 	uint8_t min_ca_rate;
 	uint8_t min_data_vls;
+	uint8_t min_sw_data_vls;
 	boolean_t ignore_existing_lfts;
 	boolean_t subnet_initialization_error;
 	boolean_t force_heavy_sweep;
@@ -1504,7 +1518,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt);
 *
 * SYNOPSIS
 */
-int osm_subn_parse_conf_file(char *conf_file, osm_subn_opt_t * p_opt);
+int osm_subn_parse_conf_file(const char *conf_file, osm_subn_opt_t * p_opt);
 /*
 * PARAMETERS
 *
diff --git a/include/opensm/osm_switch.h b/include/opensm/osm_switch.h
index de567ad..41ac959 100644
--- a/include/opensm/osm_switch.h
+++ b/include/opensm/osm_switch.h
@@ -570,7 +570,7 @@ boolean_t osm_switch_get_lft_block(IN const osm_switch_t * p_sw,
 *	p_sw
 *		[in] Pointer to an osm_switch_t object.
 *
-*	block_ID
+*	block_id
 *		[in] The block_id to retrieve.
 *
 *	p_block
diff --git a/include/opensm/osm_ucast_mgr.h b/include/opensm/osm_ucast_mgr.h
index c534b7e..b9c1ca1 100644
--- a/include/opensm/osm_ucast_mgr.h
+++ b/include/opensm/osm_ucast_mgr.h
@@ -296,5 +296,7 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr);
 * SEE ALSO
 *	Unicast Manager, Node Info Response Controller
 *********/
+
+int ucast_dummy_build_lid_matrices(void *context);
 END_C_DECLS
 #endif				/* _OSM_UCAST_MGR_H_ */
diff --git a/include/opensm/osm_version.h b/include/opensm/osm_version.h
index 32109f3..e4251ac 100644
--- a/include/opensm/osm_version.h
+++ b/include/opensm/osm_version.h
@@ -45,7 +45,7 @@
 *
 * SYNOPSIS
 */
-#define OSM_VERSION "OpenSM 3.3.15"
+#define OSM_VERSION "OpenSM 3.3.17"
 /********/
 
 #endif				/* _OSM_VERSION_H_ */
diff --git a/libvendor/Makefile.am b/libvendor/Makefile.am
index 22f7a08..a4dc229 100644
--- a/libvendor/Makefile.am
+++ b/libvendor/Makefile.am
@@ -11,7 +11,7 @@ INCLUDES = $(OSMV_INCLUDES)
 
 lib_LTLIBRARIES = libosmvendor.la
 
-libosmvendor_la_CFLAGS = -Wall $(DBGFLAGS)
+libosmvendor_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS)
 
 if HAVE_LD_VERSION_SCRIPT
     libosmvendor_version_script = -Wl,--version-script=$(srcdir)/libosmvendor.map
diff --git a/libvendor/Makefile.in b/libvendor/Makefile.in
index 6b794d4..54ceddb 100644
--- a/libvendor/Makefile.in
+++ b/libvendor/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -39,8 +39,12 @@ subdir = libvendor
 DIST_COMMON = $(am__libosmvendorinclude_HEADERS_DIST) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
-	$(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+	$(top_srcdir)/config/ltoptions.m4 \
+	$(top_srcdir)/config/ltsugar.m4 \
+	$(top_srcdir)/config/ltversion.m4 \
+	$(top_srcdir)/config/lt~obsolete.m4 \
+	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -69,12 +73,6 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
 am__installdirs = "$(DESTDIR)$(libdir)" \
 	"$(DESTDIR)$(libosmvendorincludedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
@@ -201,9 +199,10 @@ CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
+DEFAULT_START = @DEFAULT_START@
+DEFAULT_STOP = @DEFAULT_STOP@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -230,7 +229,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -257,6 +255,7 @@ PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
+RDMA_SERVICE = @RDMA_SERVICE@
 RELEASE = @RELEASE@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -273,7 +272,6 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -306,6 +304,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -326,7 +325,7 @@ SUBDIRS = .
 @DEBUG_TRUE at DBGFLAGS = -ggdb -D_DEBUG_
 INCLUDES = $(OSMV_INCLUDES)
 lib_LTLIBRARIES = libosmvendor.la
-libosmvendor_la_CFLAGS = -Wall $(DBGFLAGS)
+libosmvendor_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS)
 @HAVE_LD_VERSION_SCRIPT_FALSE at libosmvendor_version_script = 
 @HAVE_LD_VERSION_SCRIPT_TRUE at libosmvendor_version_script = -Wl,--version-script=$(srcdir)/libosmvendor.map
 osmvendor_api_version = $(shell grep LIBVERSION= $(srcdir)/libosmvendor.ver | sed 's/LIBVERSION=//')
@@ -455,7 +454,7 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libosmvendor.la: $(libosmvendor_la_OBJECTS) $(libosmvendor_la_DEPENDENCIES) $(EXTRA_libosmvendor_la_DEPENDENCIES) 
+libosmvendor.la: $(libosmvendor_la_OBJECTS) $(libosmvendor_la_DEPENDENCIES) 
 	$(libosmvendor_la_LINK) -rpath $(libdir) $(libosmvendor_la_OBJECTS) $(libosmvendor_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -628,7 +627,9 @@ uninstall-libosmvendorincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(libosmvendorinclude_HEADERS)'; test -n "$(libosmvendorincludedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(libosmvendorincludedir)'; $(am__uninstall_files_from_dir)
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(libosmvendorincludedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(libosmvendorincludedir)" && rm -f $$files
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -841,15 +842,10 @@ install-am: all-am
 
 installcheck: installcheck-recursive
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/libvendor/libosmvendor.ver b/libvendor/libosmvendor.ver
index aa30dc3..d2b5c37 100644
--- a/libvendor/libosmvendor.ver
+++ b/libvendor/libosmvendor.ver
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=3:8:0
+LIBVERSION=3:9:0
diff --git a/libvendor/osm_pkt_randomizer.c b/libvendor/osm_pkt_randomizer.c
index cfc5a8f..5ea1f4a 100644
--- a/libvendor/osm_pkt_randomizer.c
+++ b/libvendor/osm_pkt_randomizer.c
@@ -234,8 +234,7 @@ osm_pkt_randomizer_mad_drop(IN osm_log_t * p_log,
 		/* This is a lid route mad. Don't drop it */
 		goto Exit;
 
-	osm_dr_path_init(&dr_path, 0,	/* The h_bind is not really important for us to save */
-			 p_smp->hop_count, p_smp->initial_path);
+	osm_dr_path_init(&dr_path, p_smp->hop_count, p_smp->initial_path);
 
 	if (__osm_pkt_randomizer_process_path
 	    (p_log, p_pkt_randomizer, &dr_path)) {
diff --git a/libvendor/osm_vendor_ibumad.c b/libvendor/osm_vendor_ibumad.c
index d9ed13a..aa9396c 100644
--- a/libvendor/osm_vendor_ibumad.c
+++ b/libvendor/osm_vendor_ibumad.c
@@ -133,6 +133,7 @@ static void clear_madw(osm_vendor_t * p_vend)
 {
 	umad_match_t *m, *e, *old_m;
 	ib_net64_t old_tid;
+	uint8_t old_mgmt_class;
 
 	OSM_LOG_ENTER(p_vend->p_log);
 	pthread_mutex_lock(&p_vend->match_tbl_mutex);
@@ -140,14 +141,16 @@ static void clear_madw(osm_vendor_t * p_vend)
 		if (m->tid) {
 			old_m = m;
 			old_tid = m->tid;
+			old_mgmt_class = m->mgmt_class;
 			m->tid = 0;
 			osm_mad_pool_put(((osm_umad_bind_info_t
 					   *) ((osm_madw_t *) m->v)->h_bind)->
 					 p_mad_pool, m->v);
 			pthread_mutex_unlock(&p_vend->match_tbl_mutex);
 			OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5401: "
-				"evicting entry %p (tid was 0x%" PRIx64 ")\n",
-				old_m, cl_ntoh64(old_tid));
+				"evicting entry %p (tid was 0x%" PRIx64
+				" mgmt class 0x%x)\n",
+				old_m, cl_ntoh64(old_tid), old_mgmt_class);
 			goto Exit;
 		}
 	}
@@ -285,7 +288,7 @@ static void *umad_receiver(void *p_ptr)
 	osm_umad_bind_info_t *p_bind;
 	osm_mad_addr_t osm_addr;
 	osm_madw_t *p_madw, *p_req_madw;
-	ib_mad_t *mad;
+	ib_mad_t *p_mad, *p_req_mad;
 	void *umad = 0;
 	int mad_agent, length;
 
@@ -337,11 +340,11 @@ static void *umad_receiver(void *p_ptr)
 			continue;
 		}
 
-		mad = (ib_mad_t *) umad_get_mad(umad);
+		p_mad = (ib_mad_t *) umad_get_mad(umad);
 
 		ib_mad_addr_conv(umad, &osm_addr,
-				 mad->mgmt_class == IB_MCLASS_SUBN_LID ||
-				 mad->mgmt_class == IB_MCLASS_SUBN_DIR);
+				 p_mad->mgmt_class == IB_MCLASS_SUBN_LID ||
+				 p_mad->mgmt_class == IB_MCLASS_SUBN_DIR);
 
 		if (!(p_madw = osm_mad_pool_get(p_bind->p_mad_pool,
 						(osm_bind_handle_t) p_bind,
@@ -364,15 +367,15 @@ static void *umad_receiver(void *p_ptr)
 
 		/* if status != 0 then we are handling recv timeout on send */
 		if (umad_status(p_madw->vend_wrap.umad)) {
-			if (!(p_req_madw = get_madw(p_vend, &mad->trans_id,
-						    mad->mgmt_class))) {
+			if (!(p_req_madw = get_madw(p_vend, &p_mad->trans_id,
+						    p_mad->mgmt_class))) {
 				OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,
 					"ERR 5412: "
 					"Failed to obtain request madw for timed out MAD"
 					" (class=0x%X method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n",
-					mad->mgmt_class, mad->method,
-					cl_ntoh16(mad->attr_id),
-					cl_ntoh64(mad->trans_id));
+					p_mad->mgmt_class, p_mad->method,
+					cl_ntoh16(p_mad->attr_id),
+					cl_ntoh64(p_mad->trans_id));
 			} else {
 				p_req_madw->status = IB_TIMEOUT;
 				log_send_error(p_vend, p_req_madw);
@@ -391,30 +394,71 @@ static void *umad_receiver(void *p_ptr)
 		}
 
 		p_req_madw = 0;
-		if (ib_mad_is_response(mad) &&
-		    !(p_req_madw = get_madw(p_vend, &mad->trans_id,
-					    mad->mgmt_class))) {
-			OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5413: "
-				"Failed to obtain request madw for received MAD"
-				" (class=0x%X method=0x%X attr=0x%X tid=0x%"PRIx64") -- dropping\n",
-				mad->mgmt_class, mad->method,
-				cl_ntoh16((mad)->attr_id),
-				cl_ntoh64(mad->trans_id));
-			osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
-			continue;
+		if (ib_mad_is_response(p_mad)) {
+			p_req_madw = get_madw(p_vend, &p_mad->trans_id,
+					      p_mad->mgmt_class);
+			if (PF(!p_req_madw)) {
+				OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,
+					"ERR 5413: Failed to obtain request "
+					"madw for received MAD "
+					"(class=0x%X method=0x%X attr=0x%X "
+					"tid=0x%"PRIx64") -- dropping\n",
+					p_mad->mgmt_class, p_mad->method,
+					cl_ntoh16(p_mad->attr_id),
+					cl_ntoh64(p_mad->trans_id));
+				osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
+				continue;
+			}
+
+			/*
+			 * Check that request MAD was really a request,
+			 * and make sure that attribute ID, attribute
+			 * modifier and transaction ID are the same in
+			 * request and response.
+			 *
+			 * Exception for o15-0.2-1.11:
+			 * SA response to a SubnAdmGetMulti() containing a
+			 * MultiPathRecord shall have PathRecord attribute ID.
+			 */
+			p_req_mad = osm_madw_get_mad_ptr(p_req_madw);
+			if (PF(ib_mad_is_response(p_req_mad) ||
+			       (p_mad->attr_id != p_req_mad->attr_id &&
+                                !(p_mad->mgmt_class == IB_MCLASS_SUBN_ADM &&
+                                  p_req_mad->attr_id ==
+					IB_MAD_ATTR_MULTIPATH_RECORD &&
+                                  p_mad->attr_id == IB_MAD_ATTR_PATH_RECORD)) ||
+			       p_mad->attr_mod != p_req_mad->attr_mod ||
+			       p_mad->trans_id != p_req_mad->trans_id)) {
+				OSM_LOG(p_vend->p_log, OSM_LOG_ERROR,
+					"ERR 541A: "
+					"Response MAD validation failed "
+					"(request attr=0x%X modif=0x%X "
+					"tid=0x%"PRIx64", "
+					"response attr=0x%X modif=0x%X "
+					"tid=0x%"PRIx64") -- dropping\n",
+					cl_ntoh16(p_req_mad->attr_id),
+					cl_ntoh32(p_req_mad->attr_mod),
+					cl_ntoh64(p_req_mad->trans_id),
+					cl_ntoh16(p_mad->attr_id),
+					cl_ntoh32(p_mad->attr_mod),
+					cl_ntoh64(p_mad->trans_id));
+				osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
+				continue;
+			}
 		}
+
 #ifndef VENDOR_RMPP_SUPPORT
-		if ((mad->mgmt_class != IB_MCLASS_SUBN_DIR) &&
-		    (mad->mgmt_class != IB_MCLASS_SUBN_LID) &&
-		    (ib_rmpp_is_flag_set((ib_rmpp_mad_t *) mad,
+		if ((p_mad->mgmt_class != IB_MCLASS_SUBN_DIR) &&
+		    (p_mad->mgmt_class != IB_MCLASS_SUBN_LID) &&
+		    (ib_rmpp_is_flag_set((ib_rmpp_mad_t *) p_mad,
 					 IB_RMPP_FLAG_ACTIVE))) {
 			OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5414: "
 				"class 0x%x method 0x%x RMPP version %d type "
 				"%d flags 0x%x received -- dropping\n",
-				mad->mgmt_class, mad->method,
-				((ib_rmpp_mad_t *) mad)->rmpp_version,
-				((ib_rmpp_mad_t *) mad)->rmpp_type,
-				((ib_rmpp_mad_t *) mad)->rmpp_flags);
+				p_mad->mgmt_class, p_mad->method,
+				((ib_rmpp_mad_t *) p_mad)->rmpp_version,
+				((ib_rmpp_mad_t *) p_mad)->rmpp_type,
+				((ib_rmpp_mad_t *) p_mad)->rmpp_flags);
 			osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
 			continue;
 		}
@@ -538,7 +582,7 @@ osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log,
 
 	memset(p_vend, 0, sizeof(*p_vend));
 
-	if (osm_vendor_init(p_vend, p_log, timeout) < 0) {
+	if (osm_vendor_init(p_vend, p_log, timeout) != IB_SUCCESS) {
 		free(p_vend);
 		p_vend = NULL;
 	}
@@ -602,6 +646,7 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 				attr->lid = ca.ports[j]->base_lid;
 				attr->port_num = ca.ports[j]->portnum;
 				attr->sm_lid = ca.ports[j]->sm_lid;
+				attr->sm_sl = ca.ports[j]->sm_sl;
 				attr->link_state = ca.ports[j]->state;
 				if (attr->num_pkeys && attr->p_pkey_table) {
 					if (attr->num_pkeys > ca.ports[j]->pkeys_size)
@@ -611,6 +656,11 @@ osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
 							cl_hton16(ca.ports[j]->pkeys[k]);
 				}
 				attr->num_pkeys = ca.ports[j]->pkeys_size;
+				if (attr->num_gids && attr->p_gid_table) {
+					attr->p_gid_table[0].unicast.prefix = cl_hton64(ca.ports[j]->gid_prefix);
+					attr->p_gid_table[0].unicast.interface_id = cl_hton64(ca.ports[j]->port_guid);
+					attr->num_gids = 1;
+				}
 				attr++;
 				if (attr - p_attr_array > *p_num_ports) {
 					done = 1;
@@ -1093,8 +1143,10 @@ Resp:
 			     resp_expected ? p_bind->timeout : 0,
 			     p_bind->max_retries)) < 0) {
 		OSM_LOG(p_vend->p_log, OSM_LOG_ERROR, "ERR 5430: "
-			"Send p_madw = %p of size %d TID 0x%" PRIx64 " failed %d (%m)\n",
-			p_madw, sent_mad_size, tid, ret);
+			"Send p_madw = %p of size %d, Class 0x%x, Method 0x%X, "
+			"Attr 0x%X, TID 0x%" PRIx64 " failed %d (%m)\n",
+			p_madw, sent_mad_size, p_mad->mgmt_class,
+			p_mad->method, cl_ntoh16(p_mad->attr_id), tid, ret);
 		if (resp_expected) {
 			get_madw(p_vend, &p_mad->trans_id,
 				 p_mad->mgmt_class);	/* remove from aging table */
diff --git a/libvendor/osm_vendor_ibumad_sa.c b/libvendor/osm_vendor_ibumad_sa.c
index 1d482c0..f715cf6 100644
--- a/libvendor/osm_vendor_ibumad_sa.c
+++ b/libvendor/osm_vendor_ibumad_sa.c
@@ -84,9 +84,8 @@ __osmv_sa_mad_rcv_cb(IN osm_madw_t * p_madw,
 	}
 
 	/* obtain the sent context since we store it during send in the ni_ctx */
-	p_query_req_copy =
-	    (osmv_query_req_t *) (uintptr_t)(p_req_madw->context.ni_context.
-						node_guid);
+	p_query_req_copy = (osmv_query_req_t *)
+            (uintptr_t)(osm_madw_get_ni_context_ptr(p_req_madw)->node_guid);
 
 	/* provide the context of the original request in the result */
 	query_res.query_context = p_query_req_copy->query_context;
@@ -180,9 +179,8 @@ static void __osmv_sa_mad_err_cb(IN void *bind_context, IN osm_madw_t * p_madw)
 	OSM_LOG_ENTER(p_bind->p_log);
 
 	/* Obtain the sent context etc */
-	p_query_req_copy =
-	    (osmv_query_req_t *) (uintptr_t)(p_madw->context.ni_context.
-						node_guid);
+	p_query_req_copy = (osmv_query_req_t *)
+            (uintptr_t)(osm_madw_get_ni_context_ptr(p_madw)->node_guid);
 
 	/* provide the context of the original request in the result */
 	query_res.query_context = p_query_req_copy->query_context;
@@ -433,7 +431,7 @@ __osmv_send_sa_req(IN osmv_sa_bind_info_t * p_bind,
 		goto Exit;
 	}
 	*p_query_req_copy = *p_query_req;
-	p_madw->context.ni_context.node_guid =
+	osm_madw_get_ni_context_ptr(p_madw)->node_guid =
 	    (ib_net64_t) (uintptr_t)p_query_req_copy;
 
 	/* we can support async as well as sync calls */
diff --git a/man/opensm.8 b/man/opensm.8
index f6c9377..82d3ae5 100644
--- a/man/opensm.8
+++ b/man/opensm.8
@@ -11,7 +11,7 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-g(uid) <GUID in hex>]
 [\-l(mc) <LMC>]
 [\-p(riority) <PRIORITY>]
-[\-smkey <SM_Key>]
+[\-\-smkey <SM_Key>]
 [\-\-sm_sl <SL number>]
 [\-r(eassign_lids)]
 [\-R <engine name(s)> | \-\-routing_engine <engine name(s)>]
@@ -34,9 +34,9 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-s(weep) <interval>]
 [\-t(imeout) <milliseconds>]
 [\-\-retries <number>]
-[\-maxsmps <number>]
-[\-console [off | local | socket | loopback]]
-[\-console-port <port>]
+[\-\-maxsmps <number>]
+[\-\-console [off | local | socket | loopback]]
+[\-\-console-port <port>]
 [\-i(gnore-guids) <equalize-ignore-guids-file>]
 [\-w | \-\-hop_weights_file <path to file>]
 [\-O | \-\-port_search_ordering_file <path to file>]
@@ -52,6 +52,7 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-\-cckey <key>]
 [\-y | \-\-stay_on_fatal]
 [\-B | \-\-daemon]
+[\-J | \-\-pidfile <file_name>]
 [\-I | \-\-inactive]
 [\-\-perfmgr]
 [\-\-perfmgr_sweep_time_s <seconds>]
@@ -134,7 +135,7 @@ This will effect the handover cases, where master
 is chosen by priority and GUID.  Range goes from 0
 (default and lowest priority) to 15 (highest).
 .TP
-\fB\-smkey\fR <SM_Key value>
+\fB\-\-smkey\fR <SM_Key value>
 This option specifies the SM\'s SM_Key (64 bits).
 This will effect SM authentication.
 Note that OpenSM version 3.2.1 and below used the default value '1'
@@ -196,7 +197,8 @@ loaded.
 .TP
 \fB\-U\fR, \fB\-\-lfts_file\fR <file name>
 This option specifies the name of the LFTs file
-from where switch forwarding tables will be loaded.
+from where switch forwarding tables will be loaded when using "file" routing
+engine.
 .TP
 \fB\-S\fR, \fB\-\-sadb_file\fR <file name>
 This option specifies the name of the SA DB dump file
@@ -207,14 +209,23 @@ Set the root nodes for the Up/Down or Fat-Tree routing
 algorithm to the guids provided in the given file (one to a line).
 .TP
 \fB\-u\fR, \fB\-\-cn_guid_file\fR <file name>
-Set the compute nodes for the Fat-Tree routing algorithm
-to the guids provided in the given file (one to a line).
+Set the compute nodes for the Fat-Tree or DFSSSP/SSSP routing algorithms
+to the port GUIDs provided in the given file (one to a line).
 .TP
 \fB\-G\fR, \fB\-\-io_guid_file\fR <file name>
-Set the I/O nodes for the Fat-Tree routing algorithm
-to the guids provided in the given file (one to a line).
+Set the I/O nodes for the Fat-Tree or DFSSSP/SSSP routing algorithms
+to the port GUIDs provided in the given file (one to a line).
+.br
+In the case of Fat-Tree routing:
+.br
 I/O nodes are non-CN nodes allowed to use up to max_reverse_hops switches
 the wrong way around to improve connectivity.
+.br
+In the case of (DF)SSSP routing:
+.br
+Providing guids of compute and/or I/O nodes will ensure that paths towards
+those nodes are as much separated as possible within their node category,
+i.e., I/O traffic will not share the same link if multiple links are available.
 .TP
 \fB\-\-port\-shifting\fR
 This option enables a feature called \fBport shifting\fR.  In some
@@ -263,15 +274,15 @@ for transactions.
 Without --retries, OpenSM defaults to 3 retries
 for transactions.
 .TP
-\fB\-maxsmps\fR <number>
+\fB\-\-maxsmps\fR <number>
 This option specifies the number of VL15 SMP MADs
 allowed on the wire at any one time.
-Specifying -maxsmps 0 allows unlimited outstanding
+Specifying \-\-maxsmps 0 allows unlimited outstanding
 SMPs.
-Without -maxsmps, OpenSM defaults to a maximum of
+Without \-\-maxsmps, OpenSM defaults to a maximum of
 4 outstanding SMPs.
 .TP
-\fB\-console [off | local | loopback | socket]\fR
+\fB\-\-console [off | local | loopback | socket]\fR
 This option brings up the OpenSM console (default off).  Note, loopback and
 socket open a socket which can be connected to WITHOUT CREDENTIALS.  Loopback
 is safer if access to your SM host is controlled.  tcp_wrappers
@@ -279,12 +290,12 @@ is safer if access to your SM host is controlled.  tcp_wrappers
 will only be available if OpenSM was built with --enable-console-loopback
 (default yes) and --enable-console-socket (default no) respectively.
 .TP
-\fB\-console-port\fR <port>
+\fB\-\-console-port\fR <port>
 Specify an alternate telnet port for the socket console (default 10000).
 Note that this option only appears if OpenSM was built with
 --enable-console-socket.
 .TP
-\fB\-i\fR, \fB\-ignore-guids\fR <equalize-ignore-guids-file>
+\fB\-i\fR, \fB\-\-ignore-guids\fR <equalize-ignore-guids-file>
 This option provides the means to define a set of ports
 (by node guid and port number) that will be ignored by the link load
 equalization algorithm.
@@ -320,7 +331,7 @@ listed on a line are assigned to the remaining dimensions, in port
 order.  Anything after a # is a comment.
 .TP
 \fB\-O\fR, \fB\-\-dimn_ports_file\fR <path to file> \fB(DEPRECATED)\fR
-This is a deprecated flag. Please use \fB-port_search_ordering_file\fR instead.
+This is a deprecated flag. Please use \fB\-\-port_search_ordering_file\fR instead.
 This option provides a mapping between hypercube dimensions and ports
 on a per switch basis for the DOR routing engine.  The file consists
 of lines containing a switch node GUID (specified as a 64 bit hex
@@ -403,18 +414,22 @@ By default, the SM will exit on these errors.
 \fB\-B\fR, \fB\-\-daemon\fR
 Run in daemon mode - OpenSM will run in the background.
 .TP
+\fB\-J\fR, \fB\-\-pidfile <file_name>\fR
+Makes the SM write its own PID to the specified file when started in daemon
+mode.
+.TP
 \fB\-I\fR, \fB\-\-inactive\fR
 Start SM in inactive rather than init SM state.  This
 option can be used in conjunction with the perfmgr so as to
 run a standalone performance manager without SM/SA.  However,
 this is NOT currently implemented in the performance manager.
 .TP
-\fB\-perfmgr\fR
+\fB\-\-perfmgr\fR
 Enable the perfmgr.  Only takes effect if --enable-perfmgr was specified at
 configure time.  See performance-manager-HOWTO.txt in opensm doc for
 more information on running perfmgr.
 .TP
-\fB\-perfmgr_sweep_time_s\fR <seconds>
+\fB\-\-perfmgr_sweep_time_s\fR <seconds>
 Specify the sweep time for the performance manager in seconds
 (default is 180 seconds).  Only takes
 effect if --enable-perfmgr was specified at configure time.
@@ -614,9 +629,9 @@ General file format:
                             mgid.  Furthermore specifying multiple scope
                             settings will result in multiple MC groups
                             being created.
-        qkey=<val>      - specifies the Q_Key for this MC group
+        Q_Key=<val>      - specifies the Q_Key for this MC group
                           (default: 0x0b1b for IP groups, 0 for other groups)
-        tclass=<val>    - specifies tclass for this MC group
+        TClass=<val>    - specifies tclass for this MC group
                           (default is 0)
         FlowLabel=<val> - specifies FlowLabel for this MC group
                           (default is 0)
@@ -962,7 +977,7 @@ port GUID. The latter is supplied by:
 
 -i <equalize-ignore-guids-file>
 .br
--ignore-guids <equalize-ignore-guids-file>
+\-\-ignore-guids <equalize-ignore-guids-file>
           This option provides the means to define a set of ports
           (by guid) that will be ignored by the link load
           equalization algorithm. Note that only endports (CA,
@@ -1302,6 +1317,48 @@ b) running SSSP:   '-R sssp'
 .br
 c) both algorithms support LMC > 0
 
+Hints for optimizing I/O traffic:
+.br
+Having more nodes (I/O and compute) connected to a switch than incoming links
+can result in a 'bad' routing of the I/O traffic as long as (DF)SSSP routing
+is not aware of the dedicated I/O nodes, i.e., in the following network
+configuration CN1-CN3 might send all I/O traffic via Link2 to IO1,IO2:
+
+     CN1         Link1        IO1
+.br
+        \\       /----\\       /
+.br
+  CN2 -- Switch1      Switch2 -- CN4
+.br
+        /       \\----/       \\
+.br
+     CN3         Link2        IO2
+
+To prevent this from happening (DF)SSSP can use both the compute node guid
+file and the I/O guid file specified by the \'-u\' or \'--cn_guid_file\' and
+\'-G\' or \'--io_guid_file\' options (similar to the Fat-Tree routing).
+This ensures that traffic towards compute nodes and I/O nodes is balanced
+separately and therefore distributed as much as possible across the available
+links. Port GUIDs, as listed by ibstat, must be specified (not Node GUIDs).
+.br
+The priority for the optimization is as follows:
+.br
+  compute nodes -> I/O nodes -> other nodes
+.br
+Possible use case szenarios:
+.br
+a) neither \'-u\' nor \'-G\' are specified: all nodes a treated as \'other nodes\'
+and therefore balanced equally;
+.br
+b) \'-G\' is specified: traffic towards I/O nodes will be balanced optimally;
+.br
+c) the system has three node types, such as login/admin, compute and I/O,
+but the balancing focus should be I/O, then one has to use \'-u\' and \'-G\'
+with I/O guids listed in cn_guid_file and compute node guids listed in
+io_guid_file;
+.br
+d) ...
+
 Torus-2QoS Routing Algorithm
 
 Torus-2QoS is routing algorithm designed for large-scale 2D/3D torus fabrics;
diff --git a/man/opensm.8.in b/man/opensm.8.in
index 79ff6a5..4d4facd 100644
--- a/man/opensm.8.in
+++ b/man/opensm.8.in
@@ -11,7 +11,7 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-g(uid) <GUID in hex>]
 [\-l(mc) <LMC>]
 [\-p(riority) <PRIORITY>]
-[\-smkey <SM_Key>]
+[\-\-smkey <SM_Key>]
 [\-\-sm_sl <SL number>]
 [\-r(eassign_lids)]
 [\-R <engine name(s)> | \-\-routing_engine <engine name(s)>]
@@ -34,9 +34,9 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-s(weep) <interval>]
 [\-t(imeout) <milliseconds>]
 [\-\-retries <number>]
-[\-maxsmps <number>]
-[\-console [off | local | socket | loopback]]
-[\-console-port <port>]
+[\-\-maxsmps <number>]
+[\-\-console [off | local | socket | loopback]]
+[\-\-console-port <port>]
 [\-i(gnore-guids) <equalize-ignore-guids-file>]
 [\-w | \-\-hop_weights_file <path to file>]
 [\-O | \-\-port_search_ordering_file <path to file>]
@@ -52,6 +52,7 @@ opensm \- InfiniBand subnet manager and administration (SM/SA)
 [\-\-cckey <key>]
 [\-y | \-\-stay_on_fatal]
 [\-B | \-\-daemon]
+[\-J | \-\-pidfile <file_name>]
 [\-I | \-\-inactive]
 [\-\-perfmgr]
 [\-\-perfmgr_sweep_time_s <seconds>]
@@ -134,7 +135,7 @@ This will effect the handover cases, where master
 is chosen by priority and GUID.  Range goes from 0
 (default and lowest priority) to 15 (highest).
 .TP
-\fB\-smkey\fR <SM_Key value>
+\fB\-\-smkey\fR <SM_Key value>
 This option specifies the SM\'s SM_Key (64 bits).
 This will effect SM authentication.
 Note that OpenSM version 3.2.1 and below used the default value '1'
@@ -196,7 +197,8 @@ loaded.
 .TP
 \fB\-U\fR, \fB\-\-lfts_file\fR <file name>
 This option specifies the name of the LFTs file
-from where switch forwarding tables will be loaded.
+from where switch forwarding tables will be loaded when using "file" routing
+engine.
 .TP
 \fB\-S\fR, \fB\-\-sadb_file\fR <file name>
 This option specifies the name of the SA DB dump file
@@ -207,14 +209,23 @@ Set the root nodes for the Up/Down or Fat-Tree routing
 algorithm to the guids provided in the given file (one to a line).
 .TP
 \fB\-u\fR, \fB\-\-cn_guid_file\fR <file name>
-Set the compute nodes for the Fat-Tree routing algorithm
-to the guids provided in the given file (one to a line).
+Set the compute nodes for the Fat-Tree or DFSSSP/SSSP routing algorithms
+to the port GUIDs provided in the given file (one to a line).
 .TP
 \fB\-G\fR, \fB\-\-io_guid_file\fR <file name>
-Set the I/O nodes for the Fat-Tree routing algorithm
-to the guids provided in the given file (one to a line).
+Set the I/O nodes for the Fat-Tree or DFSSSP/SSSP routing algorithms
+to the port GUIDs provided in the given file (one to a line).
+.br
+In the case of Fat-Tree routing:
+.br
 I/O nodes are non-CN nodes allowed to use up to max_reverse_hops switches
 the wrong way around to improve connectivity.
+.br
+In the case of (DF)SSSP routing:
+.br
+Providing guids of compute and/or I/O nodes will ensure that paths towards
+those nodes are as much separated as possible within their node category,
+i.e., I/O traffic will not share the same link if multiple links are available.
 .TP
 \fB\-\-port\-shifting\fR
 This option enables a feature called \fBport shifting\fR.  In some
@@ -263,15 +274,15 @@ for transactions.
 Without --retries, OpenSM defaults to 3 retries
 for transactions.
 .TP
-\fB\-maxsmps\fR <number>
+\fB\-\-maxsmps\fR <number>
 This option specifies the number of VL15 SMP MADs
 allowed on the wire at any one time.
-Specifying -maxsmps 0 allows unlimited outstanding
+Specifying \-\-maxsmps 0 allows unlimited outstanding
 SMPs.
-Without -maxsmps, OpenSM defaults to a maximum of
+Without \-\-maxsmps, OpenSM defaults to a maximum of
 4 outstanding SMPs.
 .TP
-\fB\-console [off | local | loopback | socket]\fR
+\fB\-\-console [off | local | loopback | socket]\fR
 This option brings up the OpenSM console (default off).  Note, loopback and
 socket open a socket which can be connected to WITHOUT CREDENTIALS.  Loopback
 is safer if access to your SM host is controlled.  tcp_wrappers
@@ -279,12 +290,12 @@ is safer if access to your SM host is controlled.  tcp_wrappers
 will only be available if OpenSM was built with --enable-console-loopback
 (default yes) and --enable-console-socket (default no) respectively.
 .TP
-\fB\-console-port\fR <port>
+\fB\-\-console-port\fR <port>
 Specify an alternate telnet port for the socket console (default 10000).
 Note that this option only appears if OpenSM was built with
 --enable-console-socket.
 .TP
-\fB\-i\fR, \fB\-ignore-guids\fR <equalize-ignore-guids-file>
+\fB\-i\fR, \fB\-\-ignore-guids\fR <equalize-ignore-guids-file>
 This option provides the means to define a set of ports
 (by node guid and port number) that will be ignored by the link load
 equalization algorithm.
@@ -320,7 +331,7 @@ listed on a line are assigned to the remaining dimensions, in port
 order.  Anything after a # is a comment.
 .TP
 \fB\-O\fR, \fB\-\-dimn_ports_file\fR <path to file> \fB(DEPRECATED)\fR
-This is a deprecated flag. Please use \fB-port_search_ordering_file\fR instead.
+This is a deprecated flag. Please use \fB\-\-port_search_ordering_file\fR instead.
 This option provides a mapping between hypercube dimensions and ports
 on a per switch basis for the DOR routing engine.  The file consists
 of lines containing a switch node GUID (specified as a 64 bit hex
@@ -403,18 +414,22 @@ By default, the SM will exit on these errors.
 \fB\-B\fR, \fB\-\-daemon\fR
 Run in daemon mode - OpenSM will run in the background.
 .TP
+\fB\-J\fR, \fB\-\-pidfile <file_name>\fR
+Makes the SM write its own PID to the specified file when started in daemon
+mode.
+.TP
 \fB\-I\fR, \fB\-\-inactive\fR
 Start SM in inactive rather than init SM state.  This
 option can be used in conjunction with the perfmgr so as to
 run a standalone performance manager without SM/SA.  However,
 this is NOT currently implemented in the performance manager.
 .TP
-\fB\-perfmgr\fR
+\fB\-\-perfmgr\fR
 Enable the perfmgr.  Only takes effect if --enable-perfmgr was specified at
 configure time.  See performance-manager-HOWTO.txt in opensm doc for
 more information on running perfmgr.
 .TP
-\fB\-perfmgr_sweep_time_s\fR <seconds>
+\fB\-\-perfmgr_sweep_time_s\fR <seconds>
 Specify the sweep time for the performance manager in seconds
 (default is 180 seconds).  Only takes
 effect if --enable-perfmgr was specified at configure time.
@@ -614,9 +629,9 @@ General file format:
                             mgid.  Furthermore specifying multiple scope
                             settings will result in multiple MC groups
                             being created.
-        qkey=<val>      - specifies the Q_Key for this MC group
+        Q_Key=<val>      - specifies the Q_Key for this MC group
                           (default: 0x0b1b for IP groups, 0 for other groups)
-        tclass=<val>    - specifies tclass for this MC group
+        TClass=<val>    - specifies tclass for this MC group
                           (default is 0)
         FlowLabel=<val> - specifies FlowLabel for this MC group
                           (default is 0)
@@ -962,7 +977,7 @@ port GUID. The latter is supplied by:
 
 -i <equalize-ignore-guids-file>
 .br
--ignore-guids <equalize-ignore-guids-file>
+\-\-ignore-guids <equalize-ignore-guids-file>
           This option provides the means to define a set of ports
           (by guid) that will be ignored by the link load
           equalization algorithm. Note that only endports (CA,
@@ -1302,6 +1317,48 @@ b) running SSSP:   '-R sssp'
 .br
 c) both algorithms support LMC > 0
 
+Hints for optimizing I/O traffic:
+.br
+Having more nodes (I/O and compute) connected to a switch than incoming links
+can result in a 'bad' routing of the I/O traffic as long as (DF)SSSP routing
+is not aware of the dedicated I/O nodes, i.e., in the following network
+configuration CN1-CN3 might send all I/O traffic via Link2 to IO1,IO2:
+
+     CN1         Link1        IO1
+.br
+        \\       /----\\       /
+.br
+  CN2 -- Switch1      Switch2 -- CN4
+.br
+        /       \\----/       \\
+.br
+     CN3         Link2        IO2
+
+To prevent this from happening (DF)SSSP can use both the compute node guid
+file and the I/O guid file specified by the \'-u\' or \'--cn_guid_file\' and
+\'-G\' or \'--io_guid_file\' options (similar to the Fat-Tree routing).
+This ensures that traffic towards compute nodes and I/O nodes is balanced
+separately and therefore distributed as much as possible across the available
+links. Port GUIDs, as listed by ibstat, must be specified (not Node GUIDs).
+.br
+The priority for the optimization is as follows:
+.br
+  compute nodes -> I/O nodes -> other nodes
+.br
+Possible use case szenarios:
+.br
+a) neither \'-u\' nor \'-G\' are specified: all nodes a treated as \'other nodes\'
+and therefore balanced equally;
+.br
+b) \'-G\' is specified: traffic towards I/O nodes will be balanced optimally;
+.br
+c) the system has three node types, such as login/admin, compute and I/O,
+but the balancing focus should be I/O, then one has to use \'-u\' and \'-G\'
+with I/O guids listed in cn_guid_file and compute node guids listed in
+io_guid_file;
+.br
+d) ...
+
 Torus-2QoS Routing Algorithm
 
 Torus-2QoS is routing algorithm designed for large-scale 2D/3D torus fabrics;
diff --git a/man/osmtest.8 b/man/osmtest.8
index d47a501..c999739 100644
--- a/man/osmtest.8
+++ b/man/osmtest.8
@@ -1,4 +1,4 @@
-.TH OSMTEST 8 "August 31, 2009" "OpenIB" "OpenIB Management"
+.TH OSMTEST 8 "March 9, 2013" "OpenIB" "OpenIB Management"
 
 .SH NAME
 osmtest \- InfiniBand subnet manager and administration (SM/SA) test program
@@ -75,6 +75,7 @@ option to enable as follows:
  -d1  - Force single threaded dispatching
  -d2  - Force log flushing after each log message
  -d3  - Disable multicast support
+ -d4  - Use full world path record queries
 .TP
 \fB\-m\fR, \fB\-\-max_lid\fR
 This option specifies the maximal LID number to be searched
diff --git a/man/torus-2QoS.8 b/man/torus-2QoS.8
index 943613b..fc887b0 100644
--- a/man/torus-2QoS.8
+++ b/man/torus-2QoS.8
@@ -19,8 +19,8 @@ Routing that is free of credit loops.
 .in
 \[en]
 'in +2m
-Two levels of Quality of Service (QoS), assuming switches and channel
-adapters support eight data VLs.
+Two levels of Quality of Service (QoS), assuming switches support eight
+data VLs and channel adapters support two data VLs.
 .in
 \[en]
 'in +2m
@@ -404,15 +404,24 @@ Since SL to VL map configuration must be under the complete control of
 torus-2QoS, any configuration via qos_sl2vl, qos_swe_sl2vl,
 \fIetc.\fR, must and  will be ignored, and a warning will be generated.
 .P
-Torus-2QoS uses VL values 0-3 to implement one of its supported QoS
-levels, and VL values 4-7 to implement the other.  Hard-to-diagnose
-application issues may arise if traffic is not delivered fairly
-across each of these two VL ranges.
-Torus-2QoS will detect and warn if VL arbitration is configured
-unfairly across VLs in the range 0-3, and also in the range 4-7.
-Note that the default OpenSM VL arbitration configuration
-does not meet this constraint, so all torus-2QoS users should
-configure VL arbitration via qos_vlarb_high, qos_vlarb_low, \fIetc.\fR
+For inter-switch links, Torus-2QoS uses VL values 0-3 to implement one of
+its supported QoS levels, and VL values 4-7 to implement the other. For
+endport links (CA, router, switch management port), Torus-2QoS uses VL
+value 0 for one of its supported QoS levels and VL value 1 to implement
+the other.  Hard-to-diagnose application issues may arise if traffic is
+not delivered fairly across each of these two VL ranges. For
+inter-switch links, Torus-2QoS will detect and warn if VL arbitration is
+configured unfairly across VLs in the range 0-3, and also in the range
+4-7. Note that the default OpenSM VL arbitration configuration does
+not meet this constraint, so all torus-2QoS users should configure VL
+arbitration via qos_ca_vlarb_high, qos_swe_vlarb_high, qos_ca_vlarb_low,
+qos_swe_vlarb_low, \fIetc.\fR
+.P
+Note that torus-2QoS maps SL values to VL values differently
+for inter-switch and endport links.  This is why qos_vlarb_high and
+qos_vlarb_low should not be used, as using them may result in
+VL arbitration for a QoS level being different across inter-switch
+links vs. across endport links.
 .
 .SH OPERATIONAL CONSIDERATIONS
 .
diff --git a/man/torus-2QoS.8.in b/man/torus-2QoS.8.in
index be74f26..f192066 100644
--- a/man/torus-2QoS.8.in
+++ b/man/torus-2QoS.8.in
@@ -19,8 +19,8 @@ Routing that is free of credit loops.
 .in
 \[en]
 'in +2m
-Two levels of Quality of Service (QoS), assuming switches and channel
-adapters support eight data VLs.
+Two levels of Quality of Service (QoS), assuming switches support eight
+data VLs and channel adapters support two data VLs.
 .in
 \[en]
 'in +2m
@@ -404,15 +404,24 @@ Since SL to VL map configuration must be under the complete control of
 torus-2QoS, any configuration via qos_sl2vl, qos_swe_sl2vl,
 \fIetc.\fR, must and  will be ignored, and a warning will be generated.
 .P
-Torus-2QoS uses VL values 0-3 to implement one of its supported QoS
-levels, and VL values 4-7 to implement the other.  Hard-to-diagnose
-application issues may arise if traffic is not delivered fairly
-across each of these two VL ranges.
-Torus-2QoS will detect and warn if VL arbitration is configured
-unfairly across VLs in the range 0-3, and also in the range 4-7.
-Note that the default OpenSM VL arbitration configuration
-does not meet this constraint, so all torus-2QoS users should
-configure VL arbitration via qos_vlarb_high, qos_vlarb_low, \fIetc.\fR
+For inter-switch links, Torus-2QoS uses VL values 0-3 to implement one of
+its supported QoS levels, and VL values 4-7 to implement the other. For
+endport links (CA, router, switch management port), Torus-2QoS uses VL
+value 0 for one of its supported QoS levels and VL value 1 to implement
+the other.  Hard-to-diagnose application issues may arise if traffic is
+not delivered fairly across each of these two VL ranges. For
+inter-switch links, Torus-2QoS will detect and warn if VL arbitration is
+configured unfairly across VLs in the range 0-3, and also in the range
+4-7. Note that the default OpenSM VL arbitration configuration does
+not meet this constraint, so all torus-2QoS users should configure VL
+arbitration via qos_ca_vlarb_high, qos_swe_vlarb_high, qos_ca_vlarb_low,
+qos_swe_vlarb_low, \fIetc.\fR
+.P
+Note that torus-2QoS maps SL values to VL values differently
+for inter-switch and endport links.  This is why qos_vlarb_high and
+qos_vlarb_low should not be used, as using them may result in
+VL arbitration for a QoS level being different across inter-switch
+links vs. across endport links.
 .
 .SH OPERATIONAL CONSIDERATIONS
 .
diff --git a/man/torus-2QoS.conf.5 b/man/torus-2QoS.conf.5
index ef8a351..58375cb 100644
--- a/man/torus-2QoS.conf.5
+++ b/man/torus-2QoS.conf.5
@@ -1,4 +1,4 @@
-.TH TORUS\-2QOS.CONF 5 "November 7, 2011" "OpenIB" "OpenIB Management"
+.TH TORUS\-2QOS.CONF 5 "January 4, 2013" "OpenIB" "OpenIB Management"
 .
 .SH NAME
 torus\-2QoS.conf \- Torus-2QoS configuration for OpenSM subnet manager
@@ -162,6 +162,15 @@ order on destination switches.
 Duplicate values in the list will be ignored.
 .RE
 .
+.P
+\fBmax_changes
+\fImax
+\fR
+.RS
+This keyword specifies the maximum number of torus changes reported.
+The default value is 32.
+.RE
+.
 .SH EXAMPLE
 .
 \f(RC
diff --git a/man/torus-2QoS.conf.5.in b/man/torus-2QoS.conf.5.in
index d806ab5..1ab0d2e 100644
--- a/man/torus-2QoS.conf.5.in
+++ b/man/torus-2QoS.conf.5.in
@@ -1,4 +1,4 @@
-.TH TORUS\-2QOS.CONF 5 "November 7, 2011" "OpenIB" "OpenIB Management"
+.TH TORUS\-2QOS.CONF 5 "January 4, 2013" "OpenIB" "OpenIB Management"
 .
 .SH NAME
 torus\-2QoS.conf \- Torus-2QoS configuration for OpenSM subnet manager
@@ -162,6 +162,15 @@ order on destination switches.
 Duplicate values in the list will be ignored.
 .RE
 .
+.P
+\fBmax_changes
+\fImax
+\fR
+.RS
+This keyword specifies the maximum number of torus changes reported.
+The default value is 32.
+.RE
+.
 .SH EXAMPLE
 .
 \f(RC
diff --git a/opensm.spec b/opensm.spec
index 1624c67..7e83a04 100644
--- a/opensm.spec
+++ b/opensm.spec
@@ -27,17 +27,15 @@
 
 Summary: InfiniBand subnet manager and administration
 Name: opensm
-Version: 3.3.15
+Version: 3.3.17
 Release: %rel%{?dist}
 License: GPLv2 or BSD
 Group: System Environment/Daemons
 URL: http://openfabrics.org/
-Source: http://www.openfabrics.org/downloads/management/opensm-3.3.15.tar.gz
+Source: http://www.openfabrics.org/downloads/management/opensm-3.3.17.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: libibumad-devel, libtool
 Requires: %{name}-libs = %{version}-%{release}, logrotate
-Requires(post): /sbin/service, /sbin/chkconfig
-Requires(preun): /sbin/chkconfig, /sbin/service
 
 %description
 OpenSM provides an implementation of an InfiniBand Subnet Manager and
@@ -109,15 +107,30 @@ rm -rf $RPM_BUILD_ROOT
 
 %post
 if [ $1 = 1 ]; then
-    /sbin/chkconfig --add opensmd
+    if [ -e /sbin/chkconfig ]; then
+        /sbin/chkconfig --add opensmd
+    elif [ -e /usr/sbin/update-rc.d ]; then
+        /usr/sbin/update-rc.d opensmd defaults
+    else
+        /usr/lib/lsb/install_initd /etc/init.d/opensmd
+    fi
+    if type systemctl >/dev/null 2>&1; then
+        systemctl --system daemon-reload
+    fi
 else
-    /sbin/service opensmd condrestart
+    /etc/init.d/opensmd condrestart
 fi
 
 %preun
 if [ $1 = 0 ]; then
-    /sbin/service opensmd stop
-    /sbin/chkconfig --del opensmd
+    /etc/init.d/opensmd stop
+    if [ -e /sbin/chkconfig ]; then
+        /sbin/chkconfig --del opensmd
+    elif [ -e /usr/sbin/update-rc.d ]; then
+        /usr/sbin/update-rc.d -f opensmd remove
+    else
+        /usr/lib/lsb/remove_initd /etc/init.d/opensmd
+    fi
     rm -f /var/cache/opensm/*
 fi
 
diff --git a/opensm.spec.in b/opensm.spec.in
index 65e46c9..0187069 100644
--- a/opensm.spec.in
+++ b/opensm.spec.in
@@ -36,8 +36,6 @@ Source: http://www.openfabrics.org/downloads/management/@TARBALL@
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: libibumad-devel, libtool
 Requires: %{name}-libs = %{version}-%{release}, logrotate
-Requires(post): /sbin/service, /sbin/chkconfig
-Requires(preun): /sbin/chkconfig, /sbin/service
 
 %description
 OpenSM provides an implementation of an InfiniBand Subnet Manager and
@@ -109,15 +107,30 @@ rm -rf $RPM_BUILD_ROOT
 
 %post
 if [ $1 = 1 ]; then
-    /sbin/chkconfig --add opensmd
+    if [ -e /sbin/chkconfig ]; then
+        /sbin/chkconfig --add opensmd
+    elif [ -e /usr/sbin/update-rc.d ]; then
+        /usr/sbin/update-rc.d opensmd defaults
+    else
+        /usr/lib/lsb/install_initd /etc/init.d/opensmd
+    fi
+    if type systemctl >/dev/null 2>&1; then
+        systemctl --system daemon-reload
+    fi
 else
-    /sbin/service opensmd condrestart
+    /etc/init.d/opensmd condrestart
 fi
 
 %preun
 if [ $1 = 0 ]; then
-    /sbin/service opensmd stop
-    /sbin/chkconfig --del opensmd
+    /etc/init.d/opensmd stop
+    if [ -e /sbin/chkconfig ]; then
+        /sbin/chkconfig --del opensmd
+    elif [ -e /usr/sbin/update-rc.d ]; then
+        /usr/sbin/update-rc.d -f opensmd remove
+    else
+        /usr/lib/lsb/remove_initd /etc/init.d/opensmd
+    fi
     rm -f /var/cache/opensm/*
 fi
 
diff --git a/opensm/Makefile.am b/opensm/Makefile.am
index 7fd6bc6..a44975a 100644
--- a/opensm/Makefile.am
+++ b/opensm/Makefile.am
@@ -1,7 +1,7 @@
 
 INCLUDES = $(OSMV_INCLUDES)
 
-AM_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
+AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
 
 lib_LTLIBRARIES = libopensm.la
 
@@ -116,6 +116,7 @@ opensminclude_HEADERS = \
 	$(srcdir)/../include/opensm/osm_subnet.h \
 	$(srcdir)/../include/opensm/osm_switch.h \
 	$(srcdir)/../include/opensm/osm_ucast_mgr.h \
+	$(srcdir)/../include/opensm/osm_mcast_mgr.h \
 	$(srcdir)/../include/opensm/osm_ucast_cache.h \
 	$(srcdir)/../include/opensm/osm_vl15intf.h \
 	$(top_builddir)/include/opensm/osm_version.h \
diff --git a/opensm/Makefile.in b/opensm/Makefile.in
index 055620b..6f736f1 100644
--- a/opensm/Makefile.in
+++ b/opensm/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -42,8 +42,12 @@ DIST_COMMON = $(opensminclude_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in ChangeLog osm_qos_parser_l.c \
 	osm_qos_parser_y.c osm_qos_parser_y.h
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
-	$(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+	$(top_srcdir)/config/ltoptions.m4 \
+	$(top_srcdir)/config/ltsugar.m4 \
+	$(top_srcdir)/config/ltversion.m4 \
+	$(top_srcdir)/config/lt~obsolete.m4 \
+	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -72,12 +76,6 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sbindir)" \
 	"$(DESTDIR)$(opensmincludedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
@@ -150,13 +148,13 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
+LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
 LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS)
+	--mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
 YLWRAP = $(top_srcdir)/config/ylwrap
-YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS)
+YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
 LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS)
+	--mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
 SOURCES = $(libopensm_la_SOURCES) $(opensm_SOURCES)
 DIST_SOURCES = $(libopensm_la_SOURCES) $(opensm_SOURCES)
 HEADERS = $(opensminclude_HEADERS)
@@ -177,9 +175,10 @@ CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
+DEFAULT_START = @DEFAULT_START@
+DEFAULT_STOP = @DEFAULT_STOP@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -206,7 +205,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -233,6 +231,7 @@ PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
+RDMA_SERVICE = @RDMA_SERVICE@
 RELEASE = @RELEASE@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -249,7 +248,6 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -282,6 +280,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -298,7 +297,7 @@ top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 INCLUDES = $(OSMV_INCLUDES)
-AM_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
+AM_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
 lib_LTLIBRARIES = libopensm.la
 @DEBUG_FALSE at DBGFLAGS = -g
 @DEBUG_TRUE at DBGFLAGS = -ggdb -D_DEBUG_
@@ -399,6 +398,7 @@ opensminclude_HEADERS = \
 	$(srcdir)/../include/opensm/osm_subnet.h \
 	$(srcdir)/../include/opensm/osm_switch.h \
 	$(srcdir)/../include/opensm/osm_ucast_mgr.h \
+	$(srcdir)/../include/opensm/osm_mcast_mgr.h \
 	$(srcdir)/../include/opensm/osm_ucast_cache.h \
 	$(srcdir)/../include/opensm/osm_vl15intf.h \
 	$(top_builddir)/include/opensm/osm_version.h \
@@ -476,7 +476,7 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libopensm.la: $(libopensm_la_OBJECTS) $(libopensm_la_DEPENDENCIES) $(EXTRA_libopensm_la_DEPENDENCIES) 
+libopensm.la: $(libopensm_la_OBJECTS) $(libopensm_la_DEPENDENCIES) 
 	$(libopensm_la_LINK) -rpath $(libdir) $(libopensm_la_OBJECTS) $(libopensm_la_LIBADD) $(LIBS)
 install-sbinPROGRAMS: $(sbin_PROGRAMS)
 	@$(NORMAL_INSTALL)
@@ -522,9 +522,11 @@ clean-sbinPROGRAMS:
 	echo " rm -f" $$list; \
 	rm -f $$list
 osm_qos_parser_y.h: osm_qos_parser_y.c
-	@if test ! -f $@; then rm -f osm_qos_parser_y.c; else :; fi
-	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) osm_qos_parser_y.c; else :; fi
-opensm$(EXEEXT): $(opensm_OBJECTS) $(opensm_DEPENDENCIES) $(EXTRA_opensm_DEPENDENCIES) 
+	@if test ! -f $@; then \
+	  rm -f osm_qos_parser_y.c; \
+	  $(MAKE) $(AM_MAKEFLAGS) osm_qos_parser_y.c; \
+	else :; fi
+opensm$(EXEEXT): $(opensm_OBJECTS) $(opensm_DEPENDENCIES) 
 	@rm -f opensm$(EXEEXT)
 	$(opensm_LINK) $(opensm_OBJECTS) $(opensm_LDADD) $(LIBS)
 
@@ -673,7 +675,9 @@ uninstall-opensmincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(opensminclude_HEADERS)'; test -n "$(opensmincludedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(opensmincludedir)'; $(am__uninstall_files_from_dir)
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(opensmincludedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(opensmincludedir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -776,15 +780,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/opensm/libopensm.map b/opensm/libopensm.map
index e75d424..721e0e8 100644
--- a/opensm/libopensm.map
+++ b/opensm/libopensm.map
@@ -65,6 +65,7 @@ OPENSM_1.5 {
 		osm_dump_sa_mad_v2;
 		osm_dump_dr_path;
 		osm_dump_dr_path_v2;
+		osm_dump_dr_path_as_buf;
 		osm_dump_smp_dr_path;
 		osm_dump_smp_dr_path_v2;
 		osm_dump_pkey_block;
diff --git a/opensm/libopensm.ver b/opensm/libopensm.ver
index bdb52f6..db08fc3 100644
--- a/opensm/libopensm.ver
+++ b/opensm/libopensm.ver
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=6:0:1
+LIBVERSION=7:0:2
diff --git a/opensm/main.c b/opensm/main.c
index e9a0b4c..27c1b35 100644
--- a/opensm/main.c
+++ b/opensm/main.c
@@ -68,6 +68,7 @@ volatile unsigned int osm_exit_flag = 0;
 
 static volatile unsigned int osm_hup_flag = 0;
 static volatile unsigned int osm_usr1_flag = 0;
+static char *pidfile;
 
 #define MAX_LOCAL_IBPORTS 64
 #define INVALID_GUID (0xFFFFFFFFFFFFFFFFULL)
@@ -212,7 +213,8 @@ static void show_usage(void)
 	       "          loaded.\n\n");
 	printf("--lfts_file, -U <file name>\n"
 	       "          This option specifies the name of the LFTs file\n"
-	       "          from where switch forwarding tables will be loaded.\n\n");
+	       "          from where switch forwarding tables will be loaded when using \"file\"\n"
+	       "          routing engine.\n\n");
 	printf("--sadb_file, -S <file name>\n"
 	       "          This option specifies the name of the SA DB dump file\n"
 	       "          from where SA database will be loaded.\n\n");
@@ -221,11 +223,11 @@ static void show_usage(void)
 	       "          algorithm to the guids provided in the given file (one\n"
 	       "          to a line)\n" "\n");
 	printf("--cn_guid_file, -u <path to file>\n"
-	       "          Set the compute nodes for the Fat-Tree routing algorithm\n"
-	       "          to the guids provided in the given file (one to a line)\n\n");
+	       "          Set the compute nodes for the Fat-Tree or DFSSSP/SSSP routing algorithms\n"
+	       "          to the port GUIDs provided in the given file (one to a line)\n\n");
 	printf("--io_guid_file, -G <path to file>\n"
-	       "          Set the I/O nodes for the Fat-Tree routing algorithm\n"
-	       "          to the guids provided in the given file (one to a line)\n\n");
+	       "          Set the I/O nodes for the Fat-Tree or DFSSSP/SSSP routing algorithms\n"
+	       "          to the port GUIDs provided in the given file (one to a line)\n\n");
 	printf("--port-shifting\n"
 	       "          Attempt to shift port routes around to remove alignment problems\n"
 	       "          in routing tables\n\n");
@@ -367,6 +369,8 @@ static void show_usage(void)
 	printf("--consolidate_ipv6_snm_req\n"
 	       "          Use shared MLID for IPv6 Solicited Node Multicast groups\n"
 	       "          per MGID scope and P_Key.\n\n");
+	printf("--guid_routing_order_no_scatter\n"
+	       "          Don't use scatter for ports defined in guid_routing_order file\n\n");
 	printf("--log_prefix <prefix text>\n"
 	       "          Prefix to syslog messages from OpenSM.\n\n");
 	printf("--verbose, -v\n"
@@ -430,6 +434,8 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)
 	for (i = 0; i < num_ports; i++) {
 		attr_array[i].num_pkeys = 0;
 		attr_array[i].p_pkey_table = NULL;
+		attr_array[i].num_gids = 0;
+		attr_array[i].p_gid_table = NULL;
 	}
 
 	/* Call the transport layer for a list of local port GUID values */
@@ -498,10 +504,17 @@ static ib_net64_t get_port_guid(IN osm_opensm_t * p_osm, uint64_t port_guid)
 	return attr_array[choice].port_guid;
 }
 
+static void remove_pidfile(void)
+{
+	if (pidfile)
+		unlink(pidfile);
+}
+
 static int daemonize(osm_opensm_t * osm)
 {
 	pid_t pid;
 	int fd;
+	FILE *f;
 
 	fd = open("/dev/null", O_WRONLY);
 	if (fd < 0) {
@@ -523,6 +536,18 @@ static int daemonize(osm_opensm_t * osm)
 	} else if (pid > 0)
 		exit(0);
 
+	if (pidfile) {
+		remove_pidfile();
+		f = fopen(pidfile, "w");
+		if (f) {
+			fprintf(f, "%d\n", getpid());
+			fclose(f);
+		} else {
+			perror("fopen");
+			exit(1);
+		}
+	}
+
 	close(0);
 	close(1);
 	close(2);
@@ -583,7 +608,8 @@ int main(int argc, char *argv[])
 	boolean_t run_once_flag = FALSE;
 	int32_t vendor_debug = 0;
 	int next_option;
-	char *conf_template = NULL, *config_file = NULL;
+	char *conf_template = NULL;
+	const char *config_file = NULL;
 	uint32_t val;
 	const char *const short_option =
 	    "F:c:i:w:O:f:ed:D:g:l:L:s:t:a:u:m:X:R:zM:U:S:P:Y:ANZ:WBIQvVhoryxp:n:q:k:C:G:H:";
@@ -649,6 +675,7 @@ int main(int argc, char *argv[])
 		{"console-port", 1, NULL, 'C'},
 #endif
 		{"daemon", 0, NULL, 'B'},
+		{"pidfile", 1, NULL, 'J'},
 		{"inactive", 0, NULL, 'I'},
 #ifdef ENABLE_OSM_PERF_MGR
 		{"perfmgr", 0, NULL, 1},
@@ -662,6 +689,7 @@ int main(int argc, char *argv[])
 		{"retries", 1, NULL, 8},
 		{"log_prefix", 1, NULL, 9},
 		{"torus_config", 1, NULL, 10},
+		{"guid_routing_order_no_scatter", 0, NULL, 13},
 		{NULL, 0, NULL, 0}	/* Required at the end of the array */
 	};
 
@@ -887,6 +915,10 @@ int main(int argc, char *argv[])
 			printf(" Creating new log file\n");
 			break;
 
+		case 'J':
+			pidfile = optarg;
+			break;
+
 		case 'P':
 			SET_STR_OPT(opt.partition_config_file, optarg);
 			break;
@@ -1104,6 +1136,9 @@ int main(int argc, char *argv[])
 			SET_STR_OPT(opt.torus_conf_file, optarg);
 			printf("Torus-2QoS config file = %s\n", opt.torus_conf_file);
 			break;
+		case 13:
+			opt.guid_routing_order_no_scatter = TRUE;
+			break;
 		case 'h':
 		case '?':
 		case ':':
@@ -1167,7 +1202,16 @@ int main(int argc, char *argv[])
 		opt.guid = get_port_guid(&osm, opt.guid);
 
 	if (opt.guid == 0)
-		goto Exit;
+		goto Exit2;
+
+	status = osm_opensm_init_finish(&osm, &opt);
+	if (status != IB_SUCCESS) {
+		const char *err_str = ib_get_err_str(status);
+		if (err_str == NULL)
+			err_str = "Unknown Error Type";
+		printf("\nError from osm_opensm_init_finish: %s.\n", err_str);
+		goto Exit2;
+	}
 
 	status = osm_opensm_bind(&osm, opt.guid);
 	if (status != IB_SUCCESS) {
@@ -1211,7 +1255,10 @@ int main(int argc, char *argv[])
 
 Exit:
 	osm_opensm_destroy(&osm);
+Exit2:
+	osm_opensm_destroy_finish(&osm);
 	complib_exit();
+	remove_pidfile();
 
 	exit(0);
 }
diff --git a/opensm/osm_congestion_control.c b/opensm/osm_congestion_control.c
index 8be333d..ce8b696 100644
--- a/opensm/osm_congestion_control.c
+++ b/opensm/osm_congestion_control.c
@@ -362,7 +362,7 @@ int osm_congestion_control_setup(struct osm_opensm *p_osm)
 	/*
 	 * Do nothing unless the most recent routing attempt was successful.
 	 */
-	if (!p_osm->sm.p_subn->p_osm->routing_engine_used)
+	if (!p_osm->routing_engine_used)
 		return 0;
 
 	cc_setup_mad_data(&p_osm->sm);
@@ -378,6 +378,9 @@ int osm_congestion_control_setup(struct osm_opensm *p_osm)
 
 		p_next = cl_qmap_next(p_next);
 
+		if (p_port->cc_unavailable_flag)
+			continue;
+
 		if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {
 			status = cc_send_sw_cong_setting(&p_osm->sm, p_node);
 			if (status != IB_SUCCESS)
@@ -406,7 +409,7 @@ int osm_congestion_control_setup(struct osm_opensm *p_osm)
 
 int osm_congestion_control_wait_pending_transactions(struct osm_opensm *p_osm)
 {
-	osm_congestion_control_t *cc = &p_osm->sm.p_subn->p_osm->cc;
+	osm_congestion_control_t *cc = &p_osm->cc;
 
 	if (!p_osm->subn.opt.congestion_control)
 		return 0;
@@ -468,6 +471,18 @@ static void cc_rcv_mad(void *context, void *data)
 		goto Exit;
 	}
 
+	p_port->cc_timeout_count = 0;
+
+	if (p_cc_mad->header.status) {
+		if (p_cc_mad->header.status & IB_MAD_STATUS_UNSUP_METHOD
+		    || p_cc_mad->header.status & IB_MAD_STATUS_UNSUP_METHOD_ATTR)
+			p_port->cc_unavailable_flag = 1;
+		cl_plock_release(&p_osm->lock);
+		goto Exit;
+	}
+	else
+		p_port->cc_unavailable_flag = 0;
+
 	if (p_cc_mad->header.attr_id == IB_MAD_ATTR_SW_CONG_SETTING) {
 		ib_sw_cong_setting_t *p_sw_cong_setting;
 
@@ -506,24 +521,21 @@ static void cc_poller_send(osm_congestion_control_t *p_cc,
 {
 	osm_subn_opt_t *p_opt = &p_cc->subn->opt;
 	ib_api_status_t status;
+	osm_madw_context_t mad_context = p_madw->context;
 
 	status = osm_vendor_send(p_cc->bind_handle, p_madw, TRUE);
 	if (status == IB_SUCCESS) {
 		cl_atomic_inc(&p_cc->outstanding_mads_on_wire);
-		if (p_cc->outstanding_mads_on_wire >
-		    p_opt->cc_max_outstanding_mads)
+		while (p_cc->outstanding_mads_on_wire >
+		       (int32_t)p_opt->cc_max_outstanding_mads)
 			cl_event_wait_on(&p_cc->sig_mads_on_wire_continue,
 					 EVENT_NO_TIMEOUT,
 					 TRUE);
-	}
-	else {
-		osm_madw_context_t *mad_context = &p_madw->context;
-
+	} else
 		OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C104: "
 			"send failed to node 0x%" PRIx64 "port %u\n",
-			mad_context->cc_context.node_guid,
-			mad_context->cc_context.port);
-	}
+			mad_context.cc_context.node_guid,
+			mad_context.cc_context.port);
 }
 
 static void cc_poller(void *p_ptr)
@@ -617,6 +629,11 @@ static void cc_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,
 
 	OSM_LOG_ENTER(p_cc->log);
 
+	CL_ASSERT(p_madw);
+
+	/* HACK - should be extended when supporting CC traps */
+	CL_ASSERT(p_req_madw != NULL);
+
 	osm_madw_copy_context(p_madw, p_req_madw);
 	osm_mad_pool_put(p_cc->mad_pool, p_req_madw);
 
@@ -637,23 +654,55 @@ static void cc_mad_send_err_callback(void *bind_context,
 {
 	osm_congestion_control_t *p_cc = bind_context;
 	osm_madw_context_t *p_madw_context = &p_madw->context;
+	osm_opensm_t *p_osm = p_cc->osm;
 	uint64_t node_guid = p_madw_context->cc_context.node_guid;
+	uint64_t port_guid = p_madw_context->cc_context.port_guid;
 	uint8_t port = p_madw_context->cc_context.port;
+	osm_port_t *p_port;
+	int log_flag = 1;
 
 	OSM_LOG_ENTER(p_cc->log);
 
-	OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C106: MAD Error (%s): "
-		"attr id = %u LID %u GUID 0x%016" PRIx64 " port %u "
-		"TID 0x%" PRIx64 "\n",
-		ib_get_err_str(p_madw->status),
-		p_madw->p_mad->attr_id,
-		cl_ntoh16(p_madw->mad_addr.dest_lid),
-		node_guid,
-		port,
-		cl_ntoh64(p_madw->p_mad->trans_id));
+	cl_plock_acquire(&p_osm->lock);
+
+	p_port = osm_get_port_by_guid(p_cc->subn, port_guid);
+	if (!p_port) {
+		OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C106A: "
+			"Port guid not in table 0x%" PRIx64 "\n",
+			port_guid);
+		cl_plock_release(&p_osm->lock);
+		goto Exit;
+	}
+
+	/* If timed out before, don't bothering logging again
+	 * we assume no CC support
+	 */
+	if (p_madw->status == IB_TIMEOUT
+	    && p_port->cc_timeout_count)
+		log_flag = 0;
+
+	if (log_flag)
+		OSM_LOG(p_cc->log, OSM_LOG_ERROR, "ERR C106: MAD Error (%s): "
+			"attr id = %u LID %u GUID 0x%016" PRIx64 " port %u "
+			"TID 0x%" PRIx64 "\n",
+			ib_get_err_str(p_madw->status),
+			p_madw->p_mad->attr_id,
+			cl_ntoh16(p_madw->mad_addr.dest_lid),
+			node_guid,
+			port,
+			cl_ntoh64(p_madw->p_mad->trans_id));
+
+	if (p_madw->status == IB_TIMEOUT) {
+		p_port->cc_timeout_count++;
+		if (p_port->cc_timeout_count > OSM_CC_TIMEOUT_COUNT_THRESHOLD
+		    && !p_port->cc_unavailable_flag)
+			p_port->cc_unavailable_flag++;
+	} else
+		p_cc->subn->subnet_initialization_error = TRUE;
 
-	p_cc->subn->subnet_initialization_error = TRUE;
+	cl_plock_release(&p_osm->lock);
 
+Exit:
 	osm_mad_pool_put(p_cc->mad_pool, p_madw);
 
 	decrement_outstanding_mads(p_cc);
diff --git a/opensm/osm_console.c b/opensm/osm_console.c
index b0f7f48..665b8a5 100644
--- a/opensm/osm_console.c
+++ b/opensm/osm_console.c
@@ -62,7 +62,7 @@
 extern void osm_update_node_desc(IN osm_opensm_t *osm);
 
 struct command {
-	char *name;
+	const char *name;
 	void (*help_function) (FILE * out, int detail);
 	void (*parse_function) (char **p_last, osm_opensm_t * p_osm,
 				FILE * out);
@@ -178,7 +178,7 @@ static void help_status(FILE * out, int detail)
 
 static void help_logflush(FILE * out, int detail)
 {
-	fprintf(out, "logflush -- flush the opensm.log file\n");
+	fprintf(out, "logflush [on|off] -- toggle opensm.log file flushing\n");
 }
 
 static void help_querylid(FILE * out, int detail)
@@ -242,13 +242,17 @@ static void help_perfmgr(FILE * out, int detail)
 		"perfmgr(pm) [enable|disable\n"
 		"             |clear_counters|dump_counters|print_counters(pc)|print_errors(pe)\n"
 		"             |set_rm_nodes|clear_rm_nodes|clear_inactive\n"
-		"             |dump_redir|clear_redir|sweep_time[seconds]]\n");
+		"             |set_query_cpi|clear_query_cpi\n"
+		"             |dump_redir|clear_redir\n"
+		"             |sweep|sweep_time[seconds]]\n");
 	if (detail) {
 		fprintf(out,
 			"perfmgr -- print the performance manager state\n");
 		fprintf(out,
 			"   [enable|disable] -- change the perfmgr state\n");
 		fprintf(out,
+			"   [sweep] -- Initiate a sweep of the fabric\n");
+		fprintf(out,
 			"   [sweep_time] -- change the perfmgr sweep time (requires [seconds] option)\n");
 		fprintf(out,
 			"   [clear_counters] -- clear the counters stored\n");
@@ -272,6 +276,9 @@ static void help_perfmgr(FILE * out, int detail)
 			"   [[set|clear]_rm_nodes] -- enable/disable the removal of \"inactive\" nodes from the DB\n"
 			"                             Inactive nodes are those which no longer appear on the fabric\n");
 		fprintf(out,
+			"   [[set|clear]_query_cpi] -- enable/disable PerfMgrGet(ClassPortInfo)\n"
+			"                             ClassPortInfo indicates hardware support for extended attributes such as PortCountersExtended\n");
+		fprintf(out,
 			"   [clear_inactive] -- Delete inactive nodes from the DB\n");
 	}
 }
@@ -592,7 +599,20 @@ static void sweep_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 
 static void logflush_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 {
-	fflush(p_osm->log.out_port);
+	char *p_cmd;
+
+	p_cmd = next_token(p_last);
+	if (!p_cmd ||
+	    (strcmp(p_cmd, "on") != 0 && strcmp(p_cmd, "off") != 0)) {
+		fprintf(out, "Invalid logflush command\n");
+		help_sweep(out, 1);
+	} else {
+		if (strcmp(p_cmd, "on") == 0) {
+			p_osm->log.flush = TRUE;
+	                fflush(p_osm->log.out_port);
+		} else
+			p_osm->log.flush = FALSE;
+	}
 }
 
 static void querylid_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
@@ -700,6 +720,8 @@ typedef struct {
 	uint64_t ports_8X;
 	uint64_t ports_12X;
 	uint64_t ports_unknown_width;
+	uint64_t ports_unenabled_width;
+	port_report_t *unenabled_width_ports;
 	uint64_t ports_reduced_width;
 	port_report_t *reduced_width_ports;
 	uint64_t ports_sdr;
@@ -709,6 +731,8 @@ typedef struct {
 	uint64_t ports_fdr;
 	uint64_t ports_edr;
 	uint64_t ports_unknown_speed;
+	uint64_t ports_unenabled_speed;
+	port_report_t *unenabled_speed_ports;
 	uint64_t ports_reduced_speed;
 	port_report_t *reduced_speed_ports;
 } fabric_stats_t;
@@ -763,14 +787,43 @@ static void __get_stats(cl_map_item_t * const p_map_item, void *context)
 		port_state = ib_port_info_get_port_state(pi);
 		port_phys_state = ib_port_info_get_port_phys_state(pi);
 
-		if ((enabled_width ^ active_width) > active_width) {
+		if (port_state == IB_LINK_DOWN)
+			fs->ports_down++;
+		else if (port_state == IB_LINK_ACTIVE)
+			fs->ports_active++;
+		if (port_phys_state == IB_PORT_PHYS_STATE_DISABLED) {
+			__tag_port_report(&(fs->disabled_ports),
+					  cl_ntoh64(node->node_info.node_guid),
+					  port, node->print_desc);
+			fs->ports_disabled++;
+		}
+
+		fs->total_ports++;
+
+		if (port_state == IB_LINK_DOWN)
+			continue;
+
+		if (!(active_width & enabled_width)) {
+			__tag_port_report(&(fs->unenabled_width_ports),
+					  cl_ntoh64(node->node_info.node_guid),
+					  port, node->print_desc);
+			fs->ports_unenabled_width++;
+		}
+		else if ((enabled_width ^ active_width) > active_width) {
 			__tag_port_report(&(fs->reduced_width_ports),
 					  cl_ntoh64(node->node_info.node_guid),
 					  port, node->print_desc);
 			fs->ports_reduced_width++;
 		}
 
-		if ((enabled_speed ^ active_speed) > active_speed) {
+		/* unenabled speed usually due to problems with force_link_speed */
+		if (!(active_speed & enabled_speed)) {
+			__tag_port_report(&(fs->unenabled_speed_ports),
+					  cl_ntoh64(node->node_info.node_guid),
+					  port, node->print_desc);
+			fs->ports_unenabled_speed++;
+		}
+		else if ((enabled_speed ^ active_speed) > active_speed) {
 			__tag_port_report(&(fs->reduced_speed_ports),
 					  cl_ntoh64(node->node_info.node_guid),
 					  port, node->print_desc);
@@ -808,10 +861,16 @@ static void __get_stats(cl_map_item_t * const p_map_item, void *context)
 		}
 		if (pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS &&
 		    ib_port_info_get_link_speed_ext_sup(pi) &&
-		    (enabled_speed = pi->link_speed_ext_enabled) != IB_LINK_SPEED_EXT_DISABLE &&
+		    (enabled_speed = ib_port_info_get_link_speed_ext_enabled(pi)) != IB_LINK_SPEED_EXT_DISABLE &&
 		    active_speed == IB_LINK_SPEED_ACTIVE_10) {
 			active_speed = ib_port_info_get_link_speed_ext_active(pi);
-			if ((enabled_speed ^ active_speed) > active_speed) {
+			if (!(active_speed & enabled_speed)) {
+				__tag_port_report(&(fs->unenabled_speed_ports),
+						  cl_ntoh64(node->node_info.node_guid),
+						  port, node->print_desc);
+				fs->ports_unenabled_speed++;
+			}
+			else if ((enabled_speed ^ active_speed) > active_speed) {
 				__tag_port_report(&(fs->reduced_speed_ports),
 						  cl_ntoh64(node->node_info.node_guid),
 						  port, node->print_desc);
@@ -846,18 +905,6 @@ static void __get_stats(cl_map_item_t * const p_map_item, void *context)
 			fs->ports_unknown_width++;
 			break;
 		}
-		if (port_state == IB_LINK_DOWN)
-			fs->ports_down++;
-		else if (port_state == IB_LINK_ACTIVE)
-			fs->ports_active++;
-		if (port_phys_state == IB_PORT_PHYS_STATE_DISABLED) {
-			__tag_port_report(&(fs->disabled_ports),
-					  cl_ntoh64(node->node_info.node_guid),
-					  port, node->print_desc);
-			fs->ports_disabled++;
-		}
-
-		fs->total_ports++;
 	}
 }
 
@@ -930,18 +977,28 @@ static void portstatus_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 		fprintf(out, "   %" PRIu64 " at 25.78125 Gbps\n", fs.ports_edr);
 
 	if (fs.ports_disabled + fs.ports_reduced_speed + fs.ports_reduced_width
-	    > 0) {
+	    + fs.ports_unenabled_width + fs.ports_unenabled_speed > 0) {
 		fprintf(out, "\nPossible issues:\n");
 	}
 	if (fs.ports_disabled) {
 		fprintf(out, "   %" PRIu64 " disabled\n", fs.ports_disabled);
 		__print_port_report(out, fs.disabled_ports);
 	}
+	if (fs.ports_unenabled_speed) {
+		fprintf(out, "   %" PRIu64 " with unenabled speed\n",
+			fs.ports_unenabled_speed);
+		__print_port_report(out, fs.unenabled_speed_ports);
+	}
 	if (fs.ports_reduced_speed) {
 		fprintf(out, "   %" PRIu64 " with reduced speed\n",
 			fs.ports_reduced_speed);
 		__print_port_report(out, fs.reduced_speed_ports);
 	}
+	if (fs.ports_unenabled_width) {
+		fprintf(out, "   %" PRIu64 " with unenabled width\n",
+			fs.ports_unenabled_width);
+		__print_port_report(out, fs.unenabled_width_ports);
+	}
 	if (fs.ports_reduced_width) {
 		fprintf(out, "   %" PRIu64 " with reduced width\n",
 			fs.ports_reduced_width);
@@ -1466,6 +1523,10 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 			osm_perfmgr_set_rm_nodes(&p_osm->perfmgr, 1);
 		} else if (strcmp(p_cmd, "clear_rm_nodes") == 0) {
 			osm_perfmgr_set_rm_nodes(&p_osm->perfmgr, 0);
+		} else if (strcmp(p_cmd, "set_query_cpi") == 0) {
+			osm_perfmgr_set_query_cpi(&p_osm->perfmgr, 1);
+		} else if (strcmp(p_cmd, "clear_query_cpi") == 0) {
+			osm_perfmgr_set_query_cpi(&p_osm->perfmgr, 0);
 		} else if (strcmp(p_cmd, "dump_counters") == 0) {
 			p_cmd = next_token(p_last);
 			if (p_cmd && (strcmp(p_cmd, "mach") == 0)) {
@@ -1521,6 +1582,9 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 					"sweep_time requires a time period "
 					"(in seconds) to be specified\n");
 			}
+		} else if (strcmp(p_cmd, "sweep") == 0) {
+			osm_sm_signal(&p_osm->sm, OSM_SIGNAL_PERFMGR_SWEEP);
+			fprintf(out, "sweep initiated...\n");
 		} else {
 			fprintf(out, "\"%s\" option not found\n", p_cmd);
 		}
@@ -1530,13 +1594,16 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 			"sweep state                  : %s\n"
 			"sweep time                   : %us\n"
 			"outstanding queries/max      : %d/%u\n"
-			"remove missing nodes from DB : %s\n",
+			"remove missing nodes from DB : %s\n"
+			"query ClassPortInfo          : %s\n",
 			osm_perfmgr_get_state_str(&p_osm->perfmgr),
 			osm_perfmgr_get_sweep_state_str(&p_osm->perfmgr),
 			osm_perfmgr_get_sweep_time_s(&p_osm->perfmgr),
 			p_osm->perfmgr.outstanding_queries,
 			p_osm->perfmgr.max_outstanding_queries,
 			osm_perfmgr_get_rm_nodes(&p_osm->perfmgr)
+						 ? "TRUE" : "FALSE",
+			osm_perfmgr_get_query_cpi(&p_osm->perfmgr)
 						 ? "TRUE" : "FALSE");
 	}
 }
diff --git a/opensm/osm_console_io.c b/opensm/osm_console_io.c
index 167562c..dfc903f 100644
--- a/opensm/osm_console_io.c
+++ b/opensm/osm_console_io.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2005-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2008 HNR Consulting. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -107,10 +108,10 @@ int cio_close(osm_console_t * p_oct, osm_log_t * p_log)
 {
 	int rtnval = -1;
 	if (p_oct && p_oct->in_fd > 0) {
-		OSM_LOG(p_log, OSM_LOG_INFO,
+		OSM_LOG(p_log, OSM_LOG_VERBOSE,
 			"Console connection closed: %s (%s)\n",
 			p_oct->client_hn, p_oct->client_ip);
-		rtnval = close(p_oct->in_fd);
+		rtnval = fclose(p_oct->in);
 		p_oct->in_fd = -1;
 		p_oct->out_fd = -1;
 		p_oct->in = NULL;
@@ -138,9 +139,10 @@ int cio_open(osm_console_t * p_oct, int new_fd, osm_log_t * p_log)
 			cio_close(p_oct, p_log);
 		else {
 			OSM_LOG(p_log, OSM_LOG_INFO,
-				"Console connection aborted: %s (%s)\n",
+				"Console connection aborted: %s (%s) - "
+				"already in use\n",
 				p_oct->client_hn, p_oct->client_ip);
-			close(new_fd);
+			fclose(file);
 			free(p_line);
 			return -1;
 		}
@@ -151,7 +153,7 @@ int cio_open(osm_console_t * p_oct, int new_fd, osm_log_t * p_log)
 	p_oct->in = fdopen(p_oct->in_fd, "w+");
 	p_oct->out = p_oct->in;
 	osm_console_prompt(p_oct->out);
-	OSM_LOG(p_log, OSM_LOG_INFO, "Console connection accepted: %s (%s)\n",
+	OSM_LOG(p_log, OSM_LOG_VERBOSE, "Console connection accepted: %s (%s)\n",
 		p_oct->client_hn, p_oct->client_ip);
 
 	return (p_oct->in == NULL) ? -1 : 0;
@@ -164,8 +166,8 @@ int is_authorized(osm_console_t * p_oct)
 {
 	/* allowed to use the console? */
 	p_oct->authorized = !is_remote(p_oct->client_type) ||
-	    hosts_ctl(OSM_DAEMON_NAME, p_oct->client_hn, p_oct->client_ip,
-		      "STRING_UNKNOWN");
+	    hosts_ctl((char *)OSM_DAEMON_NAME, p_oct->client_hn, p_oct->client_ip,
+		      (char *)"STRING_UNKNOWN");
 	return p_oct->authorized;
 }
 #endif
@@ -224,7 +226,7 @@ int osm_console_init(osm_subn_opt_t * opt, osm_console_t * p_oct, osm_log_t * p_
 		}
 		if (listen(p_oct->socket, 1) < 0) {
 			OSM_LOG(p_log, OSM_LOG_ERROR,
-				"ERR 4B03: Failed to listen on socket: %s\n",
+				"ERR 4B03: Failed to listen on console socket: %s\n",
 				strerror(errno));
 			return -1;
 		}
diff --git a/opensm/osm_db_files.c b/opensm/osm_db_files.c
index 9f338f3..7be976b 100644
--- a/opensm/osm_db_files.c
+++ b/opensm/osm_db_files.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -44,8 +45,10 @@
 
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include <opensm/osm_file_ids.h>
 #define FILE_ID OSM_FILE_DB_FILES_C
 #include <opensm/st.h>
@@ -90,6 +93,7 @@ typedef struct osm_db_domain_imp {
 	char *file_name;
 	st_table *p_hash;
 	cl_spinlock_t lock;
+	boolean_t dirty;
 } osm_db_domain_imp_t;
 /*
  * FIELDS
@@ -108,7 +112,7 @@ typedef struct osm_db_domain_imp {
  * SYNOPSIS
  */
 typedef struct osm_db_imp {
-	char *db_dir_name;
+	const char *db_dir_name;
 } osm_db_imp_t;
 /*
  * FIELDS
@@ -161,7 +165,8 @@ int osm_db_init(IN osm_db_t * p_db, IN osm_log_t * p_log)
 
 	p_db_imp = malloc(sizeof(osm_db_imp_t));
 	if (!p_db_imp) {
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6100: No memory.\n");
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6100: "
+			"Failed to allocate db memory\n");
 		return -1;
 	}
 
@@ -206,7 +211,7 @@ err:
 	return 1;
 }
 
-osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name)
+osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN const char *domain_name)
 {
 	osm_db_domain_t *p_domain;
 	osm_db_domain_imp_t *p_domain_imp;
@@ -218,17 +223,34 @@ osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name)
 
 	/* allocate a new domain object */
 	p_domain = malloc(sizeof(osm_db_domain_t));
-	CL_ASSERT(p_domain != NULL);
+	if (p_domain == NULL) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 610C: "
+			"Failed to allocate domain memory\n");
+		goto Exit;
+	}
 
 	p_domain_imp = malloc(sizeof(osm_db_domain_imp_t));
-	CL_ASSERT(p_domain_imp != NULL);
+	if (p_domain_imp == NULL) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 610D: "
+			"Failed to allocate domain_imp memory\n");
+		free(p_domain);
+		p_domain = NULL;
+		goto Exit;
+	}
 
 	path_len = strlen(((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name)
 	    + strlen(domain_name) + 2;
 
 	/* set the domain file name */
 	p_domain_imp->file_name = malloc(path_len);
-	CL_ASSERT(p_domain_imp->file_name != NULL);
+	if (p_domain_imp->file_name == NULL) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 610E: "
+			"Failed to allocate file_name memory\n");
+		free(p_domain_imp);
+		free(p_domain);
+		p_domain = NULL;
+		goto Exit;
+	}
 	snprintf(p_domain_imp->file_name, path_len, "%s/%s",
 		 ((osm_db_imp_t *) p_db->p_db_imp)->db_dir_name, domain_name);
 
@@ -248,6 +270,7 @@ osm_db_domain_t *osm_db_domain_init(IN osm_db_t * p_db, IN char *domain_name)
 	/* initialize the hash table object */
 	p_domain_imp->p_hash = st_init_strtable();
 	CL_ASSERT(p_domain_imp->p_hash != NULL);
+	p_domain_imp->dirty = FALSE;
 
 	p_domain->p_db = p_db;
 	cl_list_insert_tail(&p_db->domains, p_domain);
@@ -272,7 +295,7 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 	boolean_t before_key;
 	char *p_first_word, *p_rest_of_line, *p_last;
 	char *p_key = NULL;
-	char *p_prev_val, *p_accum_val = NULL;
+	char *p_prev_val = NULL, *p_accum_val = NULL;
 	char *endptr = NULL;
 	unsigned int line_num;
 
@@ -371,12 +394,18 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 				if (st_lookup(p_domain_imp->p_hash,
 					      (st_data_t) p_key,
 					      (void *)&p_prev_val)) {
+					/* if previously used we ignore this guid */
 					OSM_LOG(p_log, OSM_LOG_ERROR,
 						"ERR 6106: "
 						"Key:%s already exists in:%s with value:%s."
 						" Removing it\n", p_key,
 						p_domain_imp->file_name,
 						p_prev_val);
+						free(p_key);
+						p_key = NULL;
+						free(p_accum_val);
+						p_accum_val = NULL;
+						continue;
 				} else {
 					p_prev_val = NULL;
 				}
@@ -391,6 +420,10 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 					OSM_LOG(p_log, OSM_LOG_ERROR,
 						"ERR 610B: "
 						"Key:%s is invalid\n", p_key);
+						free(p_key);
+						p_key = NULL;
+						free(p_accum_val);
+						p_accum_val = NULL;
 				} else {
 					/* store our key and value */
 					st_insert(p_domain_imp->p_hash,
@@ -404,6 +437,7 @@ int osm_db_restore(IN osm_db_domain_t * p_domain)
 						     strlen(sLine) + 1);
 				strcpy(p_accum_val, p_prev_val);
 				free(p_prev_val);
+				p_prev_val = NULL;
 				strcat(p_accum_val, sLine);
 			}
 		}		/* in key */
@@ -428,54 +462,79 @@ static int dump_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
 	return ST_CONTINUE;
 }
 
-int osm_db_store(IN osm_db_domain_t * p_domain)
+int osm_db_store(IN osm_db_domain_t * p_domain,
+		 IN boolean_t fsync_high_avail_files)
 {
 	osm_log_t *p_log = p_domain->p_db->p_log;
 	osm_db_domain_imp_t *p_domain_imp;
-	FILE *p_file;
-	int status = 0;
-	char *p_tmp_file_name;
+	FILE *p_file = NULL;
+	int fd, status = 0;
+	char *p_tmp_file_name = NULL;
 
 	OSM_LOG_ENTER(p_log);
 
 	p_domain_imp = (osm_db_domain_imp_t *) p_domain->p_domain_imp;
+
 	p_tmp_file_name = malloc(sizeof(char) *
 				 (strlen(p_domain_imp->file_name) + 8));
+	if (!p_tmp_file_name) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6113: "
+			"Failed to allocate memory for temporary file name\n");
+		goto Exit2;
+	}
 	strcpy(p_tmp_file_name, p_domain_imp->file_name);
 	strcat(p_tmp_file_name, ".tmp");
 
 	cl_spinlock_acquire(&p_domain_imp->lock);
 
+	if (p_domain_imp->dirty == FALSE)
+		goto Exit;
+
 	/* open up the output file */
 	p_file = fopen(p_tmp_file_name, "w");
 	if (!p_file) {
 		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6107: "
-			"Failed to open the db file:%s for writing\n",
-			p_domain_imp->file_name);
+			"Failed to open the db file:%s for writing: err:%s\n",
+			p_domain_imp->file_name, strerror(errno));
 		status = 1;
 		goto Exit;
 	}
 
 	st_foreach(p_domain_imp->p_hash, dump_tbl_entry, (st_data_t) p_file);
-	fclose(p_file);
 
-	/* move the domain file */
-	status = remove(p_domain_imp->file_name);
-	if (status) {
-		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6109: "
-			"Failed to remove file:%s (err:%u)\n",
-			p_domain_imp->file_name, status);
+	if (fsync_high_avail_files) {
+		if (fflush(p_file) == 0) {
+			fd = fileno(p_file);
+			if (fd != -1) {
+				if (fsync(fd) == -1)
+					OSM_LOG(p_log, OSM_LOG_ERROR,
+						"ERR 6110: fsync() failed (%s) for %s\n",
+						strerror(errno),
+						p_domain_imp->file_name);
+			} else
+				OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6111: "
+					"fileno() failed for %s\n",
+					p_domain_imp->file_name);
+		} else
+			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6112: "
+				"fflush() failed (%s) for %s\n",
+				strerror(errno), p_domain_imp->file_name);
 	}
 
+	fclose(p_file);
+
 	status = rename(p_tmp_file_name, p_domain_imp->file_name);
 	if (status) {
 		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 6108: "
-			"Failed to rename the db file to:%s (err:%u)\n",
-			p_domain_imp->file_name, status);
+			"Failed to rename the db file to:%s (err:%s)\n",
+			p_domain_imp->file_name, strerror(errno));
+		goto Exit;
 	}
+	p_domain_imp->dirty = FALSE;
 Exit:
 	cl_spinlock_release(&p_domain_imp->lock);
 	free(p_tmp_file_name);
+Exit2:
 	OSM_LOG_EXIT(p_log);
 	return status;
 }
@@ -556,6 +615,9 @@ int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val)
 			"Key:%s previously exists in:%s with value:%s\n",
 			p_key, p_domain_imp->file_name, p_prev_val);
 		p_new_key = p_key;
+		/* same key, same value - nothing to update */
+		if (p_prev_val && !strcmp(p_val, p_prev_val))
+			goto Exit;
 	} else {
 		/* need to allocate the key */
 		p_new_key = malloc(sizeof(char) * (strlen(p_key) + 1));
@@ -572,6 +634,9 @@ int osm_db_update(IN osm_db_domain_t * p_domain, IN char *p_key, IN char *p_val)
 	if (p_prev_val)
 		free(p_prev_val);
 
+	p_domain_imp->dirty = TRUE;
+
+Exit:
 	cl_spinlock_release(&p_domain_imp->lock);
 
 	return 0;
@@ -597,7 +662,9 @@ int osm_db_delete(IN osm_db_domain_t * p_domain, IN char *p_key)
 				p_key, p_domain_imp->file_name, p_prev_val);
 			res = 1;
 		} else {
+			free(p_key);
 			free(p_prev_val);
+			p_domain_imp->dirty = TRUE;
 			res = 0;
 		}
 	} else {
@@ -638,6 +705,10 @@ int main(int argc, char **argv)
 	}
 
 	p_dbd = osm_db_domain_init(&db, "lid_by_guid");
+	if (!p_dbd) {
+		printf("db domain init failed\n");
+		exit(1);
+	}
 
 	if (osm_db_restore(p_dbd)) {
 		printf("failed to restore\n");
@@ -691,7 +762,7 @@ int main(int argc, char **argv)
 			printf("key = %s val = %s\n", p_key, p_val);
 		}
 	}
-	if (osm_db_store(p_dbd))
+	if (osm_db_store(p_dbd, FALSE))
 		printf("failed to store\n");
 
 	osm_db_destroy(&db);
diff --git a/opensm/osm_db_pack.c b/opensm/osm_db_pack.c
index ea00c31..59ac1d5 100644
--- a/opensm/osm_db_pack.c
+++ b/opensm/osm_db_pack.c
@@ -72,14 +72,18 @@ static inline int unpack_lids(IN char *p_lid_str, OUT uint16_t * p_min_lid,
 	if (!p_num)
 		return 1;
 	tmp = strtoul(p_num, NULL, 0);
-	CL_ASSERT(tmp < 0x10000);
+	if (tmp >= 0xC000)
+		return 1;
+
 	*p_min_lid = (uint16_t) tmp;
 
 	p_num = strtok_r(NULL, " \t", &p_next);
 	if (!p_num)
 		return 1;
 	tmp = strtoul(p_num, NULL, 0);
-	CL_ASSERT(tmp < 0x10000);
+	if (tmp >= 0xC000)
+		return 1;
+
 	*p_max_lid = (uint16_t) tmp;
 
 	return 0;
diff --git a/opensm/osm_drop_mgr.c b/opensm/osm_drop_mgr.c
index 5e5f1b1..ff6a81b 100644
--- a/opensm/osm_drop_mgr.c
+++ b/opensm/osm_drop_mgr.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -276,6 +277,15 @@ static void drop_mgr_remove_port(osm_sm_t * sm, IN osm_port_t * p_port)
 
 	drop_mgr_clean_physp(sm, p_port->p_physp);
 
+	/* Delete event forwarding subscriptions */
+	if (sm->p_subn->opt.drop_event_subscriptions) {
+		if (osm_infr_remove_subscriptions(sm->p_subn, sm->p_log, port_guid)
+		    == CL_SUCCESS)
+			OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
+			    "Removed event subscriptions for port 0x%016" PRIx64 "\n",
+			    cl_ntoh64(port_guid));
+	}
+
 	/* initialize the p_node - may need to get node_desc later */
 	p_node = p_port->p_node;
 
@@ -378,9 +388,11 @@ static boolean_t drop_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node)
 static void drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)
 {
 	ib_net64_t node_guid;
-	osm_physp_t *p_physp;
+	osm_physp_t *p_physp, *p_remote_physp;
+	osm_node_t *p_remote_node;
 	osm_port_t *p_port;
 	ib_net64_t port_guid;
+	uint8_t port_num, remote_port_num;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -428,7 +440,7 @@ static void drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)
 		goto Exit;
 	}
 
-	if (p_port->discovery_count == 0) {
+	if (!p_node->physp_discovered[0]) {
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 			"Node 0x%016" PRIx64 " port has discovery count zero\n",
 			cl_ntoh64(node_guid));
@@ -437,6 +449,47 @@ static void drop_mgr_check_node(osm_sm_t * sm, IN osm_node_t * p_node)
 		goto Exit;
 	}
 
+	/*
+	 * Unlink all ports that havn't been discovered during the last sweep.
+	 * Optimization: Skip the check if discovered all the ports of the switch.
+	 */
+	if (p_port->discovery_count < p_node->physp_tbl_size) {
+		for (port_num = 1; port_num < p_node->physp_tbl_size; port_num++) {
+			if (!p_node->physp_discovered[port_num]) {
+				p_physp = osm_node_get_physp_ptr(p_node, port_num);
+				if (!p_physp)
+					continue;
+				p_remote_physp = osm_physp_get_remote(p_physp);
+				if (!p_remote_physp)
+					continue;
+
+				p_remote_node =
+				    osm_physp_get_node_ptr(p_remote_physp);
+				remote_port_num =
+				    osm_physp_get_port_num(p_remote_physp);
+
+				OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
+					"Unlinking local node 0x%" PRIx64
+					", port %u"
+					"\n\t\t\t\tand remote node 0x%" PRIx64
+					", port %u\n due to missing PortInfo",
+					cl_ntoh64(osm_node_get_node_guid
+						  (p_node)), port_num,
+					cl_ntoh64(osm_node_get_node_guid
+						  (p_remote_node)),
+					remote_port_num);
+
+				if (sm->ucast_mgr.cache_valid)
+					osm_ucast_cache_add_link(&sm->ucast_mgr,
+								 p_physp,
+								 p_remote_physp);
+
+				osm_node_unlink(p_node, (uint8_t) port_num,
+						p_remote_node,
+						(uint8_t) remote_port_num);
+			}
+		}
+	}
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
 	return;
@@ -447,6 +500,9 @@ void osm_drop_mgr_process(osm_sm_t * sm)
 	cl_qmap_t *p_node_guid_tbl, *p_port_guid_tbl;
 	osm_port_t *p_port, *p_next_port;
 	osm_node_t *p_node, *p_next_node;
+	int max_ports, port_num;
+	osm_physp_t *p_physp;
+	ib_net64_t port_guid;
 
 	CL_ASSERT(sm);
 
@@ -477,6 +533,39 @@ void osm_drop_mgr_process(osm_sm_t * sm)
 		 */
 		if (p_node->discovery_count == 0)
 			drop_mgr_process_node(sm, p_node);
+		else {
+			/*
+			 * We want to preserve the configured pkey indexes,
+			 * so if we don't receive GetResp P_KeyTable for some block,
+			 * do the following:
+			 *   1. Drop node if the node is sw and got timeout for port 0.
+			 *   2. Drop node if node is HCA/RTR.
+			 *   3. Drop only physp if got timeout for sw when the port isn't 0.
+			 * We'll set error during initialization in order to
+			 * cause an immediate heavy sweep and try to get the
+			 * configured P_KeyTable again.
+			 */
+			if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
+				port_num = 0;
+			else
+				port_num = 1;
+			max_ports = osm_node_get_num_physp(p_node);
+			for (; port_num < max_ports; port_num++) {
+				p_physp = osm_node_get_physp_ptr(p_node, port_num);
+				if (!p_physp || p_physp->pkeys.rcv_blocks_cnt == 0)
+					continue;
+				p_physp->pkeys.rcv_blocks_cnt = 0;
+				p_physp->need_update = 2;
+				sm->p_subn->subnet_initialization_error = TRUE;
+				port_guid = osm_physp_get_port_guid(p_physp);
+				p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
+				CL_ASSERT(p_port);
+				if (p_node->physp_discovered[port_num]) {
+					p_node->physp_discovered[port_num] = 0;
+					p_port->discovery_count--;
+				}
+			}
+		}
 	}
 
 	/*
diff --git a/opensm/osm_dump.c b/opensm/osm_dump.c
index daaa98e..443030f 100644
--- a/opensm/osm_dump.c
+++ b/opensm/osm_dump.c
@@ -320,7 +320,7 @@ static void dump_lid_matrix(cl_map_item_t * item, FILE * file, void *cxt)
 				osm_switch_get_hop_count(p_sw, lid, port));
 		p_port = osm_get_port_by_lid_ho(&p_osm->subn, lid);
 		if (p_port)
-			fprintf(file, " # portguid 0x016%" PRIx64,
+			fprintf(file, " # portguid 0x%016" PRIx64,
 				cl_ntoh64(osm_port_get_guid(p_port)));
 		fprintf(file, "\n");
 	}
@@ -370,7 +370,7 @@ static void dump_topology_node(cl_map_item_t * item, FILE * file, void *cxt)
 	osm_node_t *p_nbnode;
 	osm_physp_t *p_physp, *p_default_physp, *p_rphysp;
 	uint8_t link_speed_act;
-	char *link_speed_act_str;
+	const char *link_speed_act_str;
 
 	if (!p_node->node_info.num_ports)
 		return;
@@ -493,8 +493,8 @@ static void dump_sl2vl_tbl(cl_map_item_t * item, FILE * file, void *cxt)
 	ib_slvl_table_t *p_tbl;
 	int i, n;
 	char buf[1024];
-	char * header_line =	"#in out : 0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15";
-	char * separator_line = "#--------------------------------------------------------";
+	const char * header_line =	"#in out : 0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15";
+	const char * separator_line = "#--------------------------------------------------------";
 
 	if (!num_ports)
 		return;
@@ -524,13 +524,11 @@ static void dump_sl2vl_tbl(cl_map_item_t * item, FILE * file, void *cxt)
 		}
 	} else {
 		p_physp = p_port->p_physp;
-		CL_ASSERT(p_physp->p_remote_physp);
 		p_tbl = osm_physp_get_slvl_tbl(p_physp, 0);
 		for (i = 0, n = 0; i < 16; i++)
 			n += sprintf(buf + n, " %-2d",
 					ib_slvl_table_get(p_tbl, i));
-		fprintf(file, "%-3d %-3d :%s\n",
-			0, p_physp->port_num, buf);
+		fprintf(file, "%-3d %-3d :%s\n", 0, 0, buf);
 	}
 
 	fprintf(file, "%s\n\n", separator_line);
@@ -564,9 +562,10 @@ static void print_node_report(cl_map_item_t * item, FILE * file, void *cxt)
 		p_pi = &p_physp->port_info;
 
 		/*
-		 * Port state is not defined for switch port 0
+		 * Port state is not defined for base switch port 0
 		 */
-		if (port_num == 0)
+		if (port_num == 0 &&
+		    ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) == FALSE)
 			fprintf(file, "     :");
 		else
 			fprintf(file, " %s :",
@@ -585,7 +584,10 @@ static void print_node_report(cl_map_item_t * item, FILE * file, void *cxt)
 		else
 			fprintf(file, "      :     :");
 
-		if (port_num != 0)
+		if (port_num == 0 &&
+		    ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info) == FALSE)
+			fprintf(file, "      :     :      ");
+		else
 			fprintf(file, " %s : %s : %s ",
 				osm_get_mtu_str
 				(ib_port_info_get_neighbor_mtu(p_pi)),
@@ -595,8 +597,6 @@ static void print_node_report(cl_map_item_t * item, FILE * file, void *cxt)
 				 ib_port_info_get_link_speed_ext_active(p_pi),
 				 ib_port_info_get_port_state(p_pi),
 				 p_physp->ext_port_info.link_speed_active & FDR10));
-		else
-			fprintf(file, "      :     :      ");
 
 		if (osm_physp_get_port_guid(p_physp) == osm->subn.sm_port_guid)
 			fprintf(file, "* %016" PRIx64 " *",
diff --git a/opensm/osm_guid_mgr.c b/opensm/osm_guid_mgr.c
index 5bb2c67..e4d1de7 100644
--- a/opensm/osm_guid_mgr.c
+++ b/opensm/osm_guid_mgr.c
@@ -73,8 +73,9 @@ static void guidinfo_set(IN osm_sa_t *sa, IN osm_port_t *p_port,
 
 	status = osm_req_set(sa->sm, osm_physp_get_dr_path_ptr(p_port->p_physp),
 			     payload, sizeof(payload), IB_MAD_ATTR_GUID_INFO,
-			     cl_hton32((uint32_t)block_num),
-			     CL_DISP_MSGID_NONE, &context);
+			     cl_hton32((uint32_t)block_num), FALSE,
+			     ib_port_info_get_m_key(&p_port->p_physp->port_info),
+					            CL_DISP_MSGID_NONE, &context);
 	if (status != IB_SUCCESS)
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5109: "
 			"Failure initiating GUIDInfo request (%s)\n",
diff --git a/opensm/osm_helper.c b/opensm/osm_helper.c
index 26f28cd..e3ea3a7 100644
--- a/opensm/osm_helper.c
+++ b/opensm/osm_helper.c
@@ -888,7 +888,7 @@ void osm_dump_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
 		osm_dump_port_info_to_buf(node_guid, port_guid,
 					  port_num, p_pi, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 
 		/*  show the capabilities mask */
 		if (p_pi->capability_mask) {
@@ -910,7 +910,7 @@ void osm_dump_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
 		osm_dump_port_info_to_buf(node_guid, port_guid,
 					  port_num, p_pi, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 
 		/*  show the capabilities mask */
 		if (p_pi->capability_mask) {
@@ -955,7 +955,7 @@ void osm_dump_mlnx_ext_port_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
 		osm_dump_mlnx_ext_port_info_to_buf(node_guid, port_guid,
 						   port_num, p_pi, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -970,7 +970,7 @@ void osm_dump_mlnx_ext_port_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_gui
 		osm_dump_mlnx_ext_port_info_to_buf(node_guid, port_guid,
 						   port_num, p_pi, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
         }
 }
 
@@ -1072,7 +1072,7 @@ void osm_dump_portinfo_record(IN osm_log_t * p_log,
 
 		osm_dump_portinfo_record_to_buf(p_pir, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 
 		/*  show the capabilities mask */
 		if (p_pi->capability_mask) {
@@ -1094,7 +1094,7 @@ void osm_dump_portinfo_record_v2(IN osm_log_t * p_log,
 
 		osm_dump_portinfo_record_to_buf(p_pir, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 
 		/*  show the capabilities mask */
 		if (p_pi->capability_mask) {
@@ -1146,7 +1146,7 @@ void osm_dump_guid_info(IN osm_log_t * p_log, IN ib_net64_t node_guid,
 		osm_dump_guid_info_to_buf(node_guid, port_guid,
 					  block_num, p_gi, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1162,7 +1162,7 @@ void osm_dump_guid_info_v2(IN osm_log_t * p_log, IN ib_net64_t node_guid,
 		osm_dump_guid_info_to_buf(node_guid, port_guid,
 					  block_num, p_gi, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1207,7 +1207,7 @@ void osm_dump_guidinfo_record(IN osm_log_t * p_log,
 
 		osm_dump_guidinfo_record_to_buf(p_gir, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1221,7 +1221,7 @@ void osm_dump_guidinfo_record_v2(IN osm_log_t * p_log,
 
 		osm_dump_guidinfo_record_to_buf(p_gir, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1264,7 +1264,7 @@ void osm_dump_node_info(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni,
 
 		osm_dump_node_info_to_buf(p_ni, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1276,7 +1276,7 @@ void osm_dump_node_info_v2(IN osm_log_t * p_log, IN const ib_node_info_t * p_ni,
 
 		osm_dump_node_info_to_buf(p_ni, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1333,7 +1333,7 @@ void osm_dump_node_record(IN osm_log_t * p_log,
 
 		osm_dump_node_record_to_buf(p_nr, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1347,7 +1347,7 @@ void osm_dump_node_record_v2(IN osm_log_t * p_log,
 
 		osm_dump_node_record_to_buf(p_nr, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1401,7 +1401,7 @@ void osm_dump_path_record(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr,
 
 		osm_dump_path_record_to_buf(p_pr, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1413,7 +1413,7 @@ void osm_dump_path_record_v2(IN osm_log_t * p_log, IN const ib_path_rec_t * p_pr
 
 		osm_dump_path_record_to_buf(p_pr, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1486,7 +1486,7 @@ void osm_dump_multipath_record(IN osm_log_t * p_log,
 
 		osm_dump_multipath_record_to_buf(p_mpr, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1500,7 +1500,7 @@ void osm_dump_multipath_record_v2(IN osm_log_t * p_log,
 
 		osm_dump_multipath_record_to_buf(p_mpr, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1547,7 +1547,7 @@ void osm_dump_mc_record(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mcmr,
 
 		osm_dump_mc_record_to_buf(p_mcmr, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1559,7 +1559,7 @@ void osm_dump_mc_record_v2(IN osm_log_t * p_log, IN const ib_member_rec_t * p_mc
 
 		osm_dump_mc_record_to_buf(p_mcmr, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1664,7 +1664,7 @@ void osm_dump_service_record(IN osm_log_t * p_log,
 
 		osm_dump_service_record_to_buf(p_sr, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1678,7 +1678,7 @@ void osm_dump_service_record_v2(IN osm_log_t * p_log,
 
 		osm_dump_service_record_to_buf(p_sr, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1768,7 +1768,7 @@ void osm_dump_inform_info(IN osm_log_t * p_log,
 		else
 			osm_dump_inform_info_to_buf(p_ii, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1785,7 +1785,7 @@ void osm_dump_inform_info_v2(IN osm_log_t * p_log,
 		else
 			osm_dump_inform_info_to_buf(p_ii, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1897,7 +1897,7 @@ void osm_dump_inform_info_record(IN osm_log_t * p_log,
 		else
 			osm_dump_inform_info_record_to_buf(p_iir, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1914,7 +1914,7 @@ void osm_dump_inform_info_record_v2(IN osm_log_t * p_log,
 		else
 			osm_dump_inform_info_record_to_buf(p_iir, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -1945,7 +1945,7 @@ void osm_dump_link_record(IN osm_log_t * p_log,
 
 		osm_dump_link_record_to_buf(p_lr, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -1959,7 +1959,7 @@ void osm_dump_link_record_v2(IN osm_log_t * p_log,
 
 		osm_dump_link_record_to_buf(p_lr, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -2002,7 +2002,7 @@ void osm_dump_switch_info(IN osm_log_t * p_log,
 
 		osm_dump_switch_info_to_buf(p_si, buf);
 
-		osm_log(p_log, OSM_LOG_VERBOSE, buf);
+		osm_log(p_log, OSM_LOG_VERBOSE, "%s", buf);
 	}
 }
 
@@ -2016,7 +2016,7 @@ void osm_dump_switch_info_v2(IN osm_log_t * p_log,
 
 		osm_dump_switch_info_to_buf(p_si, buf);
 
-		osm_log_v2(p_log, OSM_LOG_VERBOSE, file_id, buf);
+		osm_log_v2(p_log, OSM_LOG_VERBOSE, file_id, "%s", buf);
 	}
 }
 
@@ -2066,7 +2066,7 @@ void osm_dump_switch_info_record(IN osm_log_t * p_log,
 
 		osm_dump_switch_info_record_to_buf(p_sir, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -2080,7 +2080,7 @@ void osm_dump_switch_info_record_v2(IN osm_log_t * p_log,
 
 		osm_dump_switch_info_record_to_buf(p_sir, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -2120,7 +2120,7 @@ void osm_dump_pkey_block(IN osm_log_t * p_log, IN uint64_t port_guid,
 		osm_dump_pkey_block_to_buf(port_guid, block_num, port_num,
 					   p_pkey_tbl, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -2136,7 +2136,7 @@ void osm_dump_pkey_block_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
 		osm_dump_pkey_block_to_buf(port_guid, block_num,
 					   port_num, p_pkey_tbl, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -2179,7 +2179,7 @@ void osm_dump_slvl_map_table(IN osm_log_t * p_log, IN uint64_t port_guid,
 		osm_dump_slvl_map_table_to_buf(port_guid, in_port_num,
 					       out_port_num, p_slvl_tbl, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -2195,7 +2195,7 @@ void osm_dump_slvl_map_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
 		osm_dump_slvl_map_table_to_buf(port_guid, in_port_num,
 					       out_port_num, p_slvl_tbl, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -2237,7 +2237,7 @@ void osm_dump_vl_arb_table(IN osm_log_t * p_log, IN uint64_t port_guid,
 		osm_dump_vl_arb_table_to_buf(port_guid, block_num,
 					     port_num, p_vla_tbl, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -2253,7 +2253,7 @@ void osm_dump_vl_arb_table_v2(IN osm_log_t * p_log, IN uint64_t port_guid,
 		osm_dump_vl_arb_table_to_buf(port_guid, block_num,
 					     port_num, p_vla_tbl, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -2285,7 +2285,7 @@ void osm_dump_sm_info(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
 
 		osm_dump_sm_info_to_buf(p_smi, buf);
 
-		osm_log(p_log, OSM_LOG_DEBUG, buf);
+		osm_log(p_log, OSM_LOG_DEBUG, "%s", buf);
 	}
 }
 
@@ -2297,7 +2297,7 @@ void osm_dump_sm_info_v2(IN osm_log_t * p_log, IN const ib_sm_info_t * p_smi,
 
 		osm_dump_sm_info_to_buf(p_smi, buf);
 
-		osm_log_v2(p_log, OSM_LOG_DEBUG, file_id, buf);
+		osm_log_v2(p_log, OSM_LOG_DEBUG, file_id, "%s", buf);
 	}
 }
 
@@ -2336,7 +2336,7 @@ void osm_dump_sm_info_record(IN osm_log_t * p_log,
 
 		osm_dump_sm_info_record_to_buf(p_smir, buf);
 
-		osm_log(p_log, OSM_LOG_DEBUG, buf);
+		osm_log(p_log, OSM_LOG_DEBUG, "%s", buf);
 	}
 }
 
@@ -2350,7 +2350,7 @@ void osm_dump_sm_info_record_v2(IN osm_log_t * p_log,
 
 		osm_dump_sm_info_record_to_buf(p_smir, buf);
 
-		osm_log_v2(p_log, OSM_LOG_DEBUG, file_id, buf);
+		osm_log_v2(p_log, OSM_LOG_DEBUG, file_id, "%s", buf);
 	}
 }
 
@@ -2569,7 +2569,7 @@ void osm_dump_notice(IN osm_log_t * p_log,
 		else
 			osm_dump_notice_to_buf(p_ntci, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -2585,11 +2585,12 @@ void osm_dump_notice_v2(IN osm_log_t * p_log,
 		else
 			osm_dump_notice_to_buf(p_ntci, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
-static void osm_dump_dr_smp_to_buf(IN const ib_smp_t * p_smp, OUT char * buf)
+static void osm_dump_dr_smp_to_buf(IN const ib_smp_t * p_smp, OUT char * buf,
+				   IN size_t buf_size)
 {
 	if (!buf || !p_smp)
 		return;
@@ -2607,18 +2608,18 @@ static void osm_dump_dr_smp_to_buf(IN const ib_smp_t * p_smp, OUT char * buf)
 			    ib_get_sm_method_str(p_smp->method));
 
 		if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
-			n += snprintf(buf + n, sizeof(buf) - n,
+			n += snprintf(buf + n, buf_size - n,
 				      "\t\t\t\tD bit...................0x%X\n"
 				      "\t\t\t\tstatus..................0x%X\n",
 				      ib_smp_is_d(p_smp),
 				      cl_ntoh16(ib_smp_get_status(p_smp)));
 		} else {
-			n += snprintf(buf + n, sizeof(buf) - n,
+			n += snprintf(buf + n, buf_size - n,
 				      "\t\t\t\tstatus..................0x%X\n",
 				      cl_ntoh16(p_smp->status));
 		}
 
-		n += snprintf(buf + n, sizeof(buf) - n,
+		n += snprintf(buf + n, buf_size - n,
 			      "\t\t\t\thop_ptr.................0x%X\n"
 			      "\t\t\t\thop_count...............0x%X\n"
 			      "\t\t\t\ttrans_id................0x%" PRIx64 "\n"
@@ -2636,34 +2637,34 @@ static void osm_dump_dr_smp_to_buf(IN const ib_smp_t * p_smp, OUT char * buf)
 
 		if (p_smp->mgmt_class == IB_MCLASS_SUBN_DIR) {
 			uint32_t i;
-			n += snprintf(buf + n, sizeof(buf) - n,
+			n += snprintf(buf + n, buf_size - n,
 				      "\t\t\t\tdr_slid.................%u\n"
 				      "\t\t\t\tdr_dlid.................%u\n",
 				      cl_ntoh16(p_smp->dr_slid),
 				      cl_ntoh16(p_smp->dr_dlid));
 
-			n += snprintf(buf + n, sizeof(buf) - n,
+			n += snprintf(buf + n, buf_size - n,
 				      "\n\t\t\t\tInitial path: ");
-			n += sprint_uint8_arr(buf + n, sizeof(buf) - n,
+			n += sprint_uint8_arr(buf + n, buf_size - n,
 					      p_smp->initial_path,
 					      p_smp->hop_count + 1);
 
-			n += snprintf(buf + n, sizeof(buf) - n,
+			n += snprintf(buf + n, buf_size - n,
 				      "\n\t\t\t\tReturn path:  ");
-			n += sprint_uint8_arr(buf + n, sizeof(buf) - n,
+			n += sprint_uint8_arr(buf + n, buf_size - n,
 					      p_smp->return_path,
 					      p_smp->hop_count + 1);
 
-			n += snprintf(buf + n, sizeof(buf) - n,
+			n += snprintf(buf + n, buf_size - n,
 				      "\n\t\t\t\tReserved:     ");
 			for (i = 0; i < 7; i++) {
-				n += snprintf(buf + n, sizeof(buf) - n,
+				n += snprintf(buf + n, buf_size - n,
 					      "[%0X]", p_smp->resv1[i]);
 			}
-			n += snprintf(buf + n, sizeof(buf) - n, "\n");
+			n += snprintf(buf + n, buf_size - n, "\n");
 
 			for (i = 0; i < 64; i += 16) {
-				n += snprintf(buf + n, sizeof(buf) - n,
+				n += snprintf(buf + n, buf_size - n,
 					      "\n\t\t\t\t%02X %02X %02X %02X "
 					      "%02X %02X %02X %02X"
 					      "   %02X %02X %02X %02X %02X %02X %02X %02X\n",
@@ -2686,7 +2687,7 @@ static void osm_dump_dr_smp_to_buf(IN const ib_smp_t * p_smp, OUT char * buf)
 			}
 		} else {
 			/* not a Direct Route so provide source and destination lids */
-			n += snprintf(buf + n, sizeof(buf) - n,
+			n += snprintf(buf + n, buf_size - n,
 				      "\t\t\t\tMAD IS LID ROUTED\n");
 		}
 	}
@@ -2698,9 +2699,9 @@ void osm_dump_dr_smp(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
 	if (osm_log_is_active(p_log, log_level)) {
 		char buf[BUF_SIZE];
 
-		osm_dump_dr_smp_to_buf(p_smp, buf);
+		osm_dump_dr_smp_to_buf(p_smp, buf, BUF_SIZE);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s", buf);
 	}
 }
 
@@ -2710,9 +2711,9 @@ void osm_dump_dr_smp_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
 	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
 		char buf[BUF_SIZE];
 
-		osm_dump_dr_smp_to_buf(p_smp, buf);
+		osm_dump_dr_smp_to_buf(p_smp, buf, BUF_SIZE);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
@@ -2774,7 +2775,7 @@ void osm_dump_sa_mad(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad,
 
 		osm_dump_sa_mad_to_buf(p_mad, buf);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s\n", buf);
 	}
 }
 
@@ -2786,12 +2787,12 @@ void osm_dump_sa_mad_v2(IN osm_log_t * p_log, IN const ib_sa_mad_t * p_mad,
 
 		osm_dump_sa_mad_to_buf(p_mad, buf);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s", buf);
 	}
 }
 
 static void osm_dump_dr_path_to_buf(IN const osm_dr_path_t * p_path,
-				    OUT char * buf)
+				    OUT char * buf, IN size_t buf_size)
 {
 	if (!buf || !p_path)
 		return;
@@ -2801,7 +2802,7 @@ static void osm_dump_dr_path_to_buf(IN const osm_dr_path_t * p_path,
 		n = sprintf(buf, "Directed Path Dump of %u hop path: "
 			    "Path = ", p_path->hop_count);
 
-		sprint_uint8_arr(buf + n, sizeof(buf) - n, p_path->path,
+		sprint_uint8_arr(buf + n, buf_size - n, p_path->path,
 				 p_path->hop_count + 1);
 	}
 }
@@ -2812,9 +2813,9 @@ void osm_dump_dr_path(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
 	if (osm_log_is_active(p_log, log_level)) {
 		char buf[BUF_SIZE];
 
-		osm_dump_dr_path_to_buf(p_path, buf);
+		osm_dump_dr_path_to_buf(p_path, buf, BUF_SIZE);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s\n", buf);
 	}
 }
 
@@ -2824,14 +2825,14 @@ void osm_dump_dr_path_v2(IN osm_log_t * p_log, IN const osm_dr_path_t * p_path,
 	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
 		char buf[BUF_SIZE];
 
-		osm_dump_dr_path_to_buf(p_path, buf);
+		osm_dump_dr_path_to_buf(p_path, buf, BUF_SIZE);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s\n", buf);
 	}
 }
 
 static void osm_dump_smp_dr_path_to_buf(IN const ib_smp_t * p_smp,
-					OUT char * buf)
+					OUT char * buf, IN size_t buf_size)
 {
 	if (!buf || !p_smp)
 		return;
@@ -2840,12 +2841,12 @@ static void osm_dump_smp_dr_path_to_buf(IN const ib_smp_t * p_smp,
 
 		n = sprintf(buf, "Received SMP on a %u hop path: "
 			    "Initial path = ", p_smp->hop_count);
-		n += sprint_uint8_arr(buf + n, sizeof(buf) - n,
+		n += sprint_uint8_arr(buf + n, buf_size - n,
 				      p_smp->initial_path,
 				      p_smp->hop_count + 1);
 
-		n += sprintf(buf + n, ", Return path  = ");
-		n += sprint_uint8_arr(buf + n, sizeof(buf) - n,
+		n += snprintf(buf + n, buf_size - n, ", Return path  = ");
+		n += sprint_uint8_arr(buf + n, buf_size - n,
 				      p_smp->return_path, p_smp->hop_count + 1);
 	}
 }
@@ -2856,9 +2857,9 @@ void osm_dump_smp_dr_path(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
 	if (osm_log_is_active(p_log, log_level)) {
 		char buf[BUF_SIZE];
 
-		osm_dump_smp_dr_path_to_buf(p_smp, buf);
+		osm_dump_smp_dr_path_to_buf(p_smp, buf, BUF_SIZE);
 
-		osm_log(p_log, log_level, buf);
+		osm_log(p_log, log_level, "%s\n", buf);
 	}
 }
 
@@ -2868,12 +2869,19 @@ void osm_dump_smp_dr_path_v2(IN osm_log_t * p_log, IN const ib_smp_t * p_smp,
 	if (osm_log_is_active_v2(p_log, log_level, file_id)) {
 		char buf[BUF_SIZE];
 
-		osm_dump_smp_dr_path_to_buf(p_smp, buf);
+		osm_dump_smp_dr_path_to_buf(p_smp, buf, BUF_SIZE);
 
-		osm_log_v2(p_log, log_level, file_id, buf);
+		osm_log_v2(p_log, log_level, file_id, "%s\n", buf);
 	}
 }
 
+void osm_dump_dr_path_as_buf(IN size_t max_len,
+			     IN const osm_dr_path_t * p_path,
+			     OUT char* buf)
+{
+	sprint_uint8_arr(buf, max_len, p_path->path, p_path->hop_count + 1);
+}
+
 static const char *sm_signal_str[] = {
 	"OSM_SIGNAL_NONE",	/* 0 */
 	"OSM_SIGNAL_SWEEP",	/* 1 */
@@ -2932,8 +2940,8 @@ static const char *disp_msg_str[] = {
 
 const char *osm_get_disp_msg_str(IN cl_disp_msgid_t msg)
 {
-	if (msg > OSM_MSG_MAX)
-		msg = OSM_MSG_MAX;
+	if (msg >= OSM_MSG_MAX)
+		msg = OSM_MSG_MAX-1;
 	return disp_msg_str[msg];
 }
 
@@ -3002,6 +3010,7 @@ const char *osm_get_manufacturer_str(IN uint64_t guid_ho)
 	case OSM_VENDOR_ID_INTEL:
 		return intel_str;
 	case OSM_VENDOR_ID_MELLANOX:
+	case OSM_VENDOR_ID_MELLANOX2:
 		return mellanox_str;
 	case OSM_VENDOR_ID_REDSWITCH:
 		return redswitch_str;
diff --git a/opensm/osm_inform.c b/opensm/osm_inform.c
index f5abbc6..c6c180a 100644
--- a/opensm/osm_inform.c
+++ b/opensm/osm_inform.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -281,6 +282,37 @@ void osm_infr_remove_from_db(IN osm_subn_t * p_subn, IN osm_log_t * p_log,
 	OSM_LOG_EXIT(p_log);
 }
 
+ib_api_status_t osm_infr_remove_subscriptions(IN osm_subn_t * p_subn,
+					      IN osm_log_t * p_log,
+					      IN ib_net64_t port_guid)
+{
+	cl_list_item_t *p_list_item;
+	osm_infr_t *p_infr;
+	ib_api_status_t status = CL_NOT_FOUND;
+
+	OSM_LOG_ENTER(p_log);
+
+	/* go over all inform info available at the subnet */
+	/* match to the given GID and delete subscriptions if match */
+	p_list_item = cl_qlist_head(&p_subn->sa_infr_list);
+	while (p_list_item != cl_qlist_end(&p_subn->sa_infr_list)) {
+
+		p_infr = (osm_infr_t *)p_list_item;
+		p_list_item = cl_qlist_next(p_list_item);
+
+		if (port_guid != p_infr->inform_record.subscriber_gid.unicast.interface_id)
+			continue;
+
+		/* Remove this event subscription */
+		osm_infr_remove_from_db(p_subn, p_log, p_infr);
+
+		status = CL_SUCCESS;
+	}
+
+	OSM_LOG_EXIT(p_log);
+	return (status);
+}
+
 /**********************************************************************
  * Send a report:
  * Given a target address to send to and the notice.
@@ -304,10 +336,12 @@ static ib_api_status_t send_report(IN osm_infr_t * p_infr_rec,	/* the informinfo
 	/* HACK: who switches or uses the src and dest GIDs in the grh_info ?? */
 
 	/* it is better to use LIDs since the GIDs might not be there for SMI traps */
-	OSM_LOG(p_log, OSM_LOG_DEBUG, "Forwarding Notice Event from LID:%u"
-		" to InformInfo LID:%u TID:0x%X\n",
+	OSM_LOG(p_log, OSM_LOG_DEBUG, "Forwarding Notice Event from LID %u"
+		" to InformInfo LID %u GUID 0x%" PRIx64 ", TID 0x%X\n",
 		cl_ntoh16(p_ntc->issuer_lid),
-		cl_ntoh16(p_infr_rec->report_addr.dest_lid), trap_fwd_trans_id);
+		cl_ntoh16(p_infr_rec->report_addr.dest_lid),
+		cl_ntoh64(p_infr_rec->inform_record.subscriber_gid.unicast.interface_id),
+		trap_fwd_trans_id);
 
 	/* get the MAD to send */
 	p_report_madw = osm_mad_pool_get(p_infr_rec->sa->p_mad_pool,
@@ -316,7 +350,8 @@ static ib_api_status_t send_report(IN osm_infr_t * p_infr_rec,	/* the informinfo
 
 	if (!p_report_madw) {
 		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0203: "
-			"osm_mad_pool_get failed\n");
+			"Cannot send report to LID %u, osm_mad_pool_get failed\n",
+			cl_ntoh16(p_infr_rec->report_addr.dest_lid));
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -370,7 +405,8 @@ static int is_access_permitted(osm_infr_t *p_infr_rec,
 	   pkey with MC group.
 	   In all other cases the issuer gid is the trap source.
 	*/
-	if (trap_num >= 64 && trap_num <= 67 )
+	if (trap_num >= SM_GID_IN_SERVICE_TRAP &&
+	    trap_num <= SM_MGID_DESTROYED_TRAP)
 		/* The issuer of these traps is the SM so source_gid
 		   is the gid saved on the data details */
 		source_gid = p_ntc->data_details.ntc_64_67.gid;
@@ -388,8 +424,8 @@ static int is_access_permitted(osm_infr_t *p_infr_rec,
 
 	/* Check if there is a pkey match. o13-17.1.1 */
 	switch (trap_num) {
-		case 66:
-		case 67:
+		case SM_MGID_CREATED_TRAP:
+		case SM_MGID_DESTROYED_TRAP:
 			p_mgrp = osm_get_mgrp_by_mgid(p_subn, &source_gid);
 			if (!p_mgrp) {
 				char gid_str[INET6_ADDRSTRLEN];
@@ -582,26 +618,158 @@ Exit:
 static void log_notice(osm_log_t * log, osm_log_level_t level,
 		       ib_mad_notice_attr_t * ntc)
 {
-	char gid_str[INET6_ADDRSTRLEN];
+	char gid_str[INET6_ADDRSTRLEN], gid_str2[INET6_ADDRSTRLEN];
 	ib_gid_t *gid;
+	ib_gid_t *gid1, *gid2;
 
 	/* an official Event information log */
 	if (ib_notice_is_generic(ntc)) {
-		if ((ntc->g_or_v.generic.trap_num == CL_HTON16(64)) ||
-		    (ntc->g_or_v.generic.trap_num == CL_HTON16(65)) ||
-		    (ntc->g_or_v.generic.trap_num == CL_HTON16(66)) ||
-		    (ntc->g_or_v.generic.trap_num == CL_HTON16(67)))
+		if ((ntc->g_or_v.generic.trap_num == CL_HTON16(SM_GID_IN_SERVICE_TRAP)) ||
+		    (ntc->g_or_v.generic.trap_num == CL_HTON16(SM_GID_OUT_OF_SERVICE_TRAP)) ||
+		    (ntc->g_or_v.generic.trap_num == CL_HTON16(SM_MGID_CREATED_TRAP)) ||
+		    (ntc->g_or_v.generic.trap_num == CL_HTON16(SM_MGID_DESTROYED_TRAP)))
 			gid = &ntc->data_details.ntc_64_67.gid;
 		else
 			gid = &ntc->issuer_gid;
-		OSM_LOG(log, level,
-			"Reporting Generic Notice type:%u num:%u (%s)"
-			" from LID:%u GID:%s\n",
-			ib_notice_get_type(ntc),
-			cl_ntoh16(ntc->g_or_v.generic.trap_num),
-			ib_get_trap_str(ntc->g_or_v.generic.trap_num),
-			cl_ntoh16(ntc->issuer_lid),
-			inet_ntop(AF_INET6, gid->raw, gid_str, sizeof gid_str));
+
+		switch (cl_ntoh16(ntc->g_or_v.generic.trap_num)) {
+		case SM_GID_IN_SERVICE_TRAP:
+		case SM_GID_OUT_OF_SERVICE_TRAP:
+			OSM_LOG(log, level,
+				"Reporting Informational Notice \"%s\", GID:%s\n",
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+				inet_ntop(AF_INET6, gid->raw, gid_str, sizeof gid_str));
+			break;
+		case SM_MGID_CREATED_TRAP:
+		case SM_MGID_DESTROYED_TRAP:
+			OSM_LOG(log, level,
+				"Reporting Informational Notice \"%s\", MGID:%s\n",
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+				inet_ntop(AF_INET6, gid->raw, gid_str, sizeof gid_str));
+			break;
+		case SM_UNPATH_TRAP:
+		case SM_REPATH_TRAP:
+			/* TODO: Fill in details once SM starts to use these traps */
+			OSM_LOG(log, level,
+				"Reporting Informational Notice \"%s\"n",
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num));
+			break;
+		case SM_LINK_STATE_CHANGED_TRAP:
+			OSM_LOG(log, level,
+				"Reporting Urgent Notice \"%s\" from switch LID %u, "
+				"GUID 0x%016" PRIx64 "\n",
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+				cl_ntoh16(ntc->issuer_lid),
+				cl_ntoh64(gid->unicast.interface_id));
+			break;
+		case SM_LINK_INTEGRITY_THRESHOLD_TRAP:
+		case SM_BUFFER_OVERRUN_THRESHOLD_TRAP:
+		case SM_WATCHDOG_TIMER_EXPIRED_TRAP:
+			OSM_LOG(log, level,
+				"Reporting Urgent Notice \"%s\" from LID %u, "
+				"GUID 0x%016" PRIx64 ", port %u\n",
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+				cl_ntoh16(ntc->issuer_lid),
+				cl_ntoh64(gid->unicast.interface_id),
+				ntc->data_details.ntc_129_131.port_num);
+			break;
+		case SM_LOCAL_CHANGES_TRAP:
+			if (ntc->data_details.ntc_144.local_changes == 1)
+				OSM_LOG(log, level,
+					"Reporting Informational Notice \"%s\" from LID %u, "
+					"GUID 0x%016" PRIx64 ", ChangeFlags 0x%04x, "
+					"CapabilityMask2 0x%04x\n",
+					ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+					cl_ntoh16(ntc->issuer_lid),
+					cl_ntoh64(gid->unicast.interface_id),
+					cl_ntoh16(ntc->data_details.ntc_144.change_flgs),
+					cl_ntoh16(ntc->data_details.ntc_144.cap_mask2));
+			else
+				OSM_LOG(log, level,
+					"Reporting Informational Notice \"%s\" from LID %u, "
+					"GUID 0x%016" PRIx64 ", new CapabilityMask 0x%08x\n",
+					ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+					cl_ntoh16(ntc->issuer_lid),
+					cl_ntoh64(gid->unicast.interface_id),
+					cl_ntoh32(ntc->data_details.ntc_144.new_cap_mask));
+			break;
+		case SM_SYS_IMG_GUID_CHANGED_TRAP:
+			OSM_LOG(log, level,
+				"Reporting Informational Notice \"%s\" from LID %u, "
+				"GUID 0x%016" PRIx64 ", new SysImageGUID 0x%016" PRIx64 "\n",
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+				cl_ntoh16(ntc->issuer_lid),
+				cl_ntoh64(gid->unicast.interface_id),
+				cl_ntoh64(ntc->data_details.ntc_145.new_sys_guid));
+			break;
+		case SM_BAD_MKEY_TRAP:
+			OSM_LOG(log, level,
+				"Reporting Security Notice \"%s\" from LID %u, "
+				"GUID 0x%016" PRIx64 ", Method 0x%x, Attribute 0x%x, "
+				"AttrMod 0x%x, M_Key 0x%016" PRIx64 "\n",
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+				cl_ntoh16(ntc->issuer_lid),
+				cl_ntoh64(gid->unicast.interface_id),
+				ntc->data_details.ntc_256.method,
+				cl_ntoh16(ntc->data_details.ntc_256.attr_id),
+				cl_ntoh32(ntc->data_details.ntc_256.attr_mod),
+				cl_ntoh64(ntc->data_details.ntc_256.mkey));
+			break;
+		case SM_BAD_PKEY_TRAP:
+		case SM_BAD_QKEY_TRAP:
+			gid1 = &ntc->data_details.ntc_257_258.gid1;
+			gid2 = &ntc->data_details.ntc_257_258.gid2;
+			OSM_LOG(log, level,
+				"Reporting Security Notice \"%s\" from LID %u, "
+				"GUID 0x%016" PRIx64 " : LID1 %u, LID2 %u, %s 0x%x, "
+				"SL %d, QP1 0x%x, QP2 0x%x, GID1 %s, GID2 %s\n",
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+				cl_ntoh16(ntc->issuer_lid),
+				cl_ntoh64(gid->unicast.interface_id),
+				cl_ntoh16(ntc->data_details.ntc_257_258.lid1),
+				cl_ntoh16(ntc->data_details.ntc_257_258.lid2),
+				cl_ntoh16(ntc->g_or_v.generic.trap_num) == SM_BAD_QKEY_TRAP ?
+					"Q_Key" : "P_Key",
+				cl_ntoh32(ntc->data_details.ntc_257_258.key),
+				cl_ntoh32(ntc->data_details.ntc_257_258.qp1) >> 28,
+				cl_ntoh32(ntc->data_details.ntc_257_258.qp1) & 0xffffff,
+				cl_ntoh32(ntc->data_details.ntc_257_258.qp2) & 0xffffff,
+				inet_ntop(AF_INET6, gid1->raw, gid_str, sizeof gid_str),
+				inet_ntop(AF_INET6, gid2->raw, gid_str2, sizeof gid_str2));
+			break;
+		case SM_BAD_SWITCH_PKEY_TRAP:
+			gid1 = &ntc->data_details.ntc_259.gid1;
+			gid2 = &ntc->data_details.ntc_259.gid2;
+			OSM_LOG(log, level,
+				"Reporting Security Notice \"%s\" from switch LID %u, "
+				"GUID 0x%016" PRIx64 " port %d : data_valid 0x%04x, "
+				"LID1 %u, LID2 %u, PKey 0x%04x, "
+				"SL %d, QP1 0x%x, QP2 0x%x, GID1 %s, GID2 %s\n",
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+				cl_ntoh16(ntc->issuer_lid),
+				cl_ntoh64(gid->unicast.interface_id),
+				ntc->data_details.ntc_259.port_no,
+				cl_ntoh16(ntc->data_details.ntc_259.data_valid),
+				cl_ntoh16(ntc->data_details.ntc_259.lid1),
+				cl_ntoh16(ntc->data_details.ntc_259.lid2),
+				cl_ntoh16(ntc->data_details.ntc_257_258.key),
+				cl_ntoh32(ntc->data_details.ntc_259.sl_qp1) >> 28,
+				cl_ntoh32(ntc->data_details.ntc_259.sl_qp1) & 0xffffff,
+				cl_ntoh32(ntc->data_details.ntc_259.qp2),
+				inet_ntop(AF_INET6, gid1->raw, gid_str, sizeof gid_str),
+				inet_ntop(AF_INET6, gid2->raw, gid_str2, sizeof gid_str2));
+			break;
+		default:
+			OSM_LOG(log, level,
+				"Reporting Generic Notice type:%u num:%u (%s)"
+				" from LID:%u GID:%s\n",
+				ib_notice_get_type(ntc),
+				cl_ntoh16(ntc->g_or_v.generic.trap_num),
+				ib_get_trap_str(ntc->g_or_v.generic.trap_num),
+				cl_ntoh16(ntc->issuer_lid),
+				inet_ntop(AF_INET6, gid->raw, gid_str, sizeof gid_str));
+			break;
+		}
 	} else
 		OSM_LOG(log, level,
 			"Reporting Vendor Notice type:%u vend:%u dev:%u"
diff --git a/opensm/osm_lid_mgr.c b/opensm/osm_lid_mgr.c
index aa48eab..757a9e3 100644
--- a/opensm/osm_lid_mgr.c
+++ b/opensm/osm_lid_mgr.c
@@ -47,7 +47,7 @@
  * ALGORITHM:
  *
  * 0. we define a function to obtain the correct port lid:
- *    lid_mgr_get_port_lid( p_mgr, port, &min_lid ):
+ *    lid_mgr_get_port_lid( p_mgr, port, &min_lid, &max_lid ):
  *    0.1 if the port info lid matches the guid2lid return 0
  *    0.2 if the port info has a lid and that range is empty in
  *        port_lid_tbl, return 0 and update the port_lid_tbl and
@@ -64,12 +64,12 @@
  * 2. During SM port lid assignment:
  *   2.1 if reassign_lids is set, make it 2^lmc
  *   2.2 cleanup all port_lid_tbl and re-fill it according to guid2lid
- *   2.3 call lid_mgr_get_port_lid the SM port
+ *   2.3 call lid_mgr_get_port_lid for the SM port
  *   2.4 set the port info
  *
  * 3. During all other ports lid assignment:
  *   3.1 go through all ports in the subnet
- *   3.1.1 call lid_mgr_get_port_min_lid
+ *   3.1.1 call lid_mgr_get_port_lid
  *   3.1.2 if a change required send the port info
  *   3.2 if any change send the signal PENDING...
  *
@@ -302,11 +302,17 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
 
 	lmc_mask = ~((1 << p_mgr->p_subn->opt.lmc) - 1);
 
-	/* if we came out of standby we need to discard any previous guid2lid
-	   info we might have.
-	   Do this only if the honor_guid2lid_file option is FALSE. If not, then
-	   need to honor this file. */
-	if (p_mgr->p_subn->coming_out_of_standby == TRUE) {
+	/* We must discard previous guid2lid db if this is the first master
+	 * sweep and reassign_lids option is TRUE.
+	 * If we came out of standby and honor_guid2lid_file option is TRUE, we
+	 * must restore guid2lid db. Otherwise if honor_guid2lid_file option is
+	 * FALSE we must discard previous guid2lid db.
+	 */
+	if (p_mgr->p_subn->first_time_master_sweep == TRUE &&
+	    p_mgr->p_subn->opt.reassign_lids == TRUE) {
+		osm_db_clear(p_mgr->p_g2l);
+		memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids));
+	} else if (p_mgr->p_subn->coming_out_of_standby == TRUE) {
 		osm_db_clear(p_mgr->p_g2l);
 		memset(p_mgr->used_lids, 0, sizeof(p_mgr->used_lids));
 		if (p_mgr->p_subn->opt.honor_guid2lid_file == FALSE)
@@ -436,7 +442,7 @@ static int lid_mgr_init_sweep(IN osm_lid_mgr_t * p_mgr)
 			   1. The port has a (legal) persistency entry. Then the
 			   local lid is free (we will use the persistency value).
 			   2. Can the port keep its local assignment?
-			   a. Make sure the lid a aligned.
+			   a. Make sure the lid is aligned.
 			   b. Make sure all needed lids (for the lmc) are free
 			   according to persistency table.
 			 */
@@ -716,7 +722,7 @@ static int lid_mgr_get_port_lid(IN osm_lid_mgr_t * p_mgr,
 			guid);
 
 	/* if the port info carries a lid it must be lmc aligned and not mapped
-	   by the pesistent storage  */
+	   by the persistent storage  */
 	min_lid = cl_ntoh16(osm_port_get_base_lid(p_port));
 
 	/* we want to ignore the discovered lid if we are also on first sweep of
@@ -873,10 +879,17 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
 		   sizeof(p_pi->subnet_prefix)))
 		send_set = TRUE;
 
+	p_port->lid = lid;
 	p_pi->base_lid = lid;
 	if (memcmp(&p_pi->base_lid, &p_old_pi->base_lid,
-		   sizeof(p_pi->base_lid)))
+		   sizeof(p_pi->base_lid))) {
+		/*
+		 * Reset stored base_lid.
+		 * On successful send, we'll update it when we'll get a reply.
+		 */
+		osm_physp_set_base_lid(p_physp, 0);
 		send_set = TRUE;
+	}
 
 	/* we are updating the ports with our local sm_base_lid */
 	p_pi->master_sm_base_lid = p_mgr->p_subn->sm_base_lid;
@@ -979,10 +992,11 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
 			    ib_port_info_get_port_state(p_old_pi))
 				send_set = TRUE;
 		}
-	} else {
+	} else if (ib_switch_info_is_enhanced_port0(&p_node->sw->switch_info)) {
 		/*
-		   For Port 0, NeighborMTU is relevant only for Enh. SP0.
-		   In this case, we'll set the MTU according to the mtu_cap
+		 * Configure Enh. SP0:
+		 * Set MTU according to the mtu_cap.
+		 * Set LMC if lmc_esp0 is defined.
 		 */
 		ib_port_info_set_neighbor_mtu(p_pi,
 					      ib_port_info_get_mtu_cap
@@ -997,8 +1011,8 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
 			cl_ntoh64(osm_physp_get_port_guid(p_physp)),
 			ib_port_info_get_neighbor_mtu(p_pi));
 
-		/* Determine if enhanced switch port 0 and if so set LMC */
-		if (osm_switch_sp0_is_lmc_capable(p_node->sw, p_mgr->p_subn)) {
+		/* Configure LMC on enhanced SP0 */
+		if (p_mgr->p_subn->opt.lmc_esp0) {
 			/* p_pi->mkey_lmc is initialized earlier */
 			ib_port_info_set_lmc(p_pi, p_mgr->p_subn->opt.lmc);
 			if (ib_port_info_get_lmc(p_pi) !=
@@ -1029,9 +1043,12 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
 			"Setting client rereg on %s, port %d\n",
 			p_port->p_node->print_desc, p_port->p_physp->port_num);
 		ib_port_info_set_client_rereg(p_pi, 1);
+		context.pi_context.client_rereg = TRUE;
 		send_set = TRUE;
-	} else
+	} else {
 		ib_port_info_set_client_rereg(p_pi, 0);
+		context.pi_context.client_rereg = FALSE;
+	}
 
 	/* We need to send the PortInfo Set request with the new sm_lid
 	   in the following cases:
@@ -1054,6 +1071,7 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
 	status = osm_req_set(p_mgr->sm, osm_physp_get_dr_path_ptr(p_physp),
 			     payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
 			     cl_hton32(osm_physp_get_port_num(p_physp)),
+			     FALSE, ib_port_info_get_m_key(&p_physp->port_info),
 			     CL_DISP_MSGID_NONE, &context);
 	if (status != IB_SUCCESS)
 		ret = -1;
@@ -1153,7 +1171,7 @@ int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr)
 
 /**********************************************************************
  1 go through all ports in the subnet.
- 1.1 call lid_mgr_get_port_min_lid
+ 1.1 call lid_mgr_get_port_lid
  1.2 if a change is required send the port info
  2 if any change send the signal PENDING...
 **********************************************************************/
@@ -1218,7 +1236,7 @@ int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr)
 	}			/* all ports */
 
 	/* store the guid to lid table in persistent db */
-	osm_db_store(p_mgr->p_g2l);
+	osm_db_store(p_mgr->p_g2l, p_mgr->p_subn->opt.fsync_high_avail_files);
 
 	CL_PLOCK_RELEASE(p_mgr->p_lock);
 
diff --git a/opensm/osm_lin_fwd_rcv.c b/opensm/osm_lin_fwd_rcv.c
index f13b9a8..5b9422b 100644
--- a/opensm/osm_lin_fwd_rcv.c
+++ b/opensm/osm_lin_fwd_rcv.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -51,6 +52,8 @@
 #define FILE_ID OSM_FILE_LIN_FWD_RCV_C
 #include <opensm/osm_switch.h>
 #include <opensm/osm_sm.h>
+#include <opensm/osm_event_plugin.h>
+#include <opensm/osm_opensm.h>
 
 void osm_lft_rcv_process(IN void *context, IN void *data)
 {
@@ -62,6 +65,7 @@ void osm_lft_rcv_process(IN void *context, IN void *data)
 	osm_lft_context_t *p_lft_context;
 	uint8_t *p_block;
 	ib_net64_t node_guid;
+	osm_epi_lft_change_event_t lft_change;
 	ib_api_status_t status;
 
 	CL_ASSERT(sm);
@@ -89,10 +93,20 @@ void osm_lft_rcv_process(IN void *context, IN void *data)
 			"0x%" PRIx64 "\n", cl_ntoh64(node_guid));
 	} else {
 		status = osm_switch_set_lft_block(p_sw, p_block, block_num);
-		if (status != IB_SUCCESS) {
+		if (status == IB_SUCCESS) {
+			if (sm->p_subn->first_time_master_sweep == FALSE) {
+				lft_change.p_sw = p_sw;
+				lft_change.flags = LFT_CHANGED_BLOCK;
+				lft_change.lft_top = 0;
+				lft_change.block_num = block_num;
+				osm_opensm_report_event(sm->p_subn->p_osm,
+							OSM_EVENT_ID_LFT_CHANGE,
+							&lft_change);
+			}
+		} else {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0402: "
-				"Setting forwarding table block failed (%s)"
-				", Switch 0x%" PRIx64 " %s\n",
+				"Setting forwarding table block %u failed (%s)"
+				", Switch 0x%" PRIx64 " %s\n", block_num,
 				ib_get_err_str(status), cl_ntoh64(node_guid),
 				p_sw->p_node->print_desc);
 		}
diff --git a/opensm/osm_link_mgr.c b/opensm/osm_link_mgr.c
index 5271d59..ed19d75 100644
--- a/opensm/osm_link_mgr.c
+++ b/opensm/osm_link_mgr.c
@@ -101,11 +101,13 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 	ib_api_status_t status;
 	uint8_t port_num, mtu, op_vls, smsl = OSM_DEFAULT_SL;
 	boolean_t esp0 = FALSE, send_set = FALSE, send_set2 = FALSE;
-	osm_physp_t *p_remote_physp, *physp0;
-	int qdr_change = 0, fdr10_change = 0;
+	osm_physp_t *p_remote_physp, *physp0 = NULL;
+	int issue_ext = 0, fdr10_change = 0;
 	int ret = 0;
 	ib_net32_t attr_mod, cap_mask;
 	boolean_t update_mkey = FALSE;
+	ib_net64_t m_key = 0;
+	osm_port_t *p_port;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -115,6 +117,27 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 
 	port_num = osm_physp_get_port_num(p_physp);
 
+	memcpy(payload, p_old_pi, sizeof(ib_port_info_t));
+
+	if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH ||
+	    port_num == 0) {
+		/* Need to make sure LID and SMLID fields in PortInfo are not 0 */
+		if (!p_pi->base_lid) {
+			p_port = osm_get_port_by_guid(sm->p_subn,
+						      osm_physp_get_port_guid(p_physp));
+			p_pi->base_lid = p_port->lid;
+			send_set = TRUE;
+		}
+
+		/* we are initializing the ports with our local sm_base_lid */
+		p_pi->master_sm_base_lid = sm->p_subn->sm_base_lid;
+		if (p_pi->master_sm_base_lid != p_old_pi->master_sm_base_lid)
+			send_set = TRUE;
+	}
+
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
+		physp0 = osm_node_get_physp_ptr(p_node, 0);
+
 	if (port_num == 0) {
 		/*
 		   CAs don't have a port 0, and for switch port 0,
@@ -142,7 +165,8 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 					PRIx64 "\n", smsl,
 					cl_ntoh64(osm_physp_get_port_guid
 						  (p_physp)));
-			} else {
+			/* Enter if base lid and master_sm_lid didn't change */
+			} else if (send_set == FALSE) {
 				/* This means the switch doesn't support
 				   enhanced port 0 and we don't need to
 				   change SMSL. Can skip it. */
@@ -157,8 +181,6 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 			esp0 = TRUE;
 	}
 
-	memcpy(payload, p_old_pi, sizeof(ib_port_info_t));
-
 	/*
 	   Should never write back a value that is bigger then 3 in
 	   the PortPhysicalState field - so can not simply copy!
@@ -171,6 +193,13 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 	p_pi->state_info2 = 0x02;
 	ib_port_info_set_port_state(p_pi, port_state);
 
+	/* Determine ports' M_Key */
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH &&
+	    osm_physp_get_port_num(p_physp) != 0)
+		m_key = ib_port_info_get_m_key(&physp0->port_info);
+	else
+		m_key = ib_port_info_get_m_key(p_pi);
+
 	/* Check whether this is base port0 smsl handling only */
 	if (port_num == 0 && esp0 == FALSE) {
 		ib_port_info_set_master_smsl(p_pi, smsl);
@@ -207,18 +236,6 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 				   sizeof(p_pi->subnet_prefix)))
 				send_set = TRUE;
 
-			p_pi->base_lid = osm_physp_get_base_lid(p_physp);
-			if (memcmp(&p_pi->base_lid, &p_old_pi->base_lid,
-				   sizeof(p_pi->base_lid)))
-				send_set = TRUE;
-
-			/* we are initializing the ports with our local sm_base_lid */
-			p_pi->master_sm_base_lid = sm->p_subn->sm_base_lid;
-			if (memcmp(&p_pi->master_sm_base_lid,
-				   &p_old_pi->master_sm_base_lid,
-				   sizeof(p_pi->master_sm_base_lid)))
-				send_set = TRUE;
-
 			smsl = link_mgr_get_smsl(sm, p_physp);
 			if (smsl != ib_port_info_get_master_smsl(p_old_pi)) {
 
@@ -334,19 +351,8 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 							    sm->p_subn->opt.
 							    force_link_speed);
 			if (memcmp(&p_pi->link_speed, &p_old_pi->link_speed,
-				   sizeof(p_pi->link_speed))) {
+				   sizeof(p_pi->link_speed)))
 				send_set = TRUE;
-				/* Determine whether QDR in LSE is being changed */
-				if ((ib_port_info_get_link_speed_enabled(p_pi) &
-				     IB_LINK_SPEED_ACTIVE_10 &&
-				     !(ib_port_info_get_link_speed_enabled(p_old_pi) &
-				      IB_LINK_SPEED_ACTIVE_10)) ||
-				    ((!(ib_port_info_get_link_speed_enabled(p_pi) &
-				       IB_LINK_SPEED_ACTIVE_10) &&
-				      ib_port_info_get_link_speed_enabled(p_old_pi) &
-				      IB_LINK_SPEED_ACTIVE_10)))
-				qdr_change = 1;
-			}
 		}
 
 		if (sm->p_subn->opt.fdr10 &&
@@ -371,13 +377,14 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 			}
 		}
 
-		if (osm_node_get_type(p_physp->p_node) == IB_NODE_TYPE_SWITCH) {
-			physp0 = osm_node_get_physp_ptr(p_physp->p_node, 0);
+		if (osm_node_get_type(p_physp->p_node) == IB_NODE_TYPE_SWITCH &&
+		    osm_physp_get_port_num(p_physp) != 0) {
 			cap_mask = physp0->port_info.capability_mask;
 		} else
 			cap_mask = p_pi->capability_mask;
-		if (!(cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS))
-			qdr_change = 0;
+
+		if (cap_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)
+			issue_ext = 1;
 
 		/* Do peer ports support extended link speeds ? */
 		if (port_num != 0 && p_remote_physp) {
@@ -432,19 +439,19 @@ static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 	}
 
 Send:
+	context.pi_context.active_transition = FALSE;
 	if (port_state != IB_LINK_NO_CHANGE &&
 	    port_state != ib_port_info_get_port_state(p_old_pi)) {
 		send_set = TRUE;
 		if (port_state == IB_LINK_ACTIVE)
 			context.pi_context.active_transition = TRUE;
-		else
-			context.pi_context.active_transition = FALSE;
 	}
 
 	context.pi_context.node_guid = osm_node_get_node_guid(p_node);
 	context.pi_context.port_guid = osm_physp_get_port_guid(p_physp);
 	context.pi_context.set_method = TRUE;
 	context.pi_context.light_sweep = FALSE;
+	context.pi_context.client_rereg = FALSE;
 
 	/* We need to send the PortInfoSet request with the new sm_lid
 	   in the following cases:
@@ -462,11 +469,12 @@ Send:
 		goto Exit;
 
 	attr_mod = cl_hton32(port_num);
-	if (qdr_change)
+	if (issue_ext)
 		attr_mod |= cl_hton32(1 << 31);	/* AM SMSupportExtendedSpeeds */
 	status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
 			     payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
-			     attr_mod, CL_DISP_MSGID_NONE, &context);
+			     attr_mod, FALSE, m_key,
+			     CL_DISP_MSGID_NONE, &context);
 	if (status)
 		ret = -1;
 
@@ -482,7 +490,7 @@ Send:
 		status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
 				     payload2, sizeof(payload2),
 				     IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO,
-				     cl_hton32(port_num),
+				     cl_hton32(port_num), FALSE, m_key,
 				     CL_DISP_MSGID_NONE, &context);
 		if (status)
 			ret = -1;
diff --git a/opensm/osm_log.c b/opensm/osm_log.c
index 2b7efe6..3460cc5 100644
--- a/opensm/osm_log.c
+++ b/opensm/osm_log.c
@@ -62,7 +62,7 @@ static int log_exit_count = 0;
 #include <unistd.h>
 #include <complib/cl_timer.h>
 
-static char *month_str[] = {
+static const char *month_str[] = {
 	"Jan",
 	"Feb",
 	"Mar",
@@ -119,7 +119,7 @@ void osm_log(IN osm_log_t * p_log, IN osm_log_level_t verbosity,
 	SYSTEMTIME st;
 	uint32_t pid = GetCurrentThreadId();
 #else
-	pid_t pid = 0;
+	pid_t pid;
 	time_t tim;
 	struct tm result;
 	uint64_t time_usecs;
diff --git a/opensm/osm_mcast_mgr.c b/opensm/osm_mcast_mgr.c
index fea0a69..ad67d48 100644
--- a/opensm/osm_mcast_mgr.c
+++ b/opensm/osm_mcast_mgr.c
@@ -5,6 +5,7 @@
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
  * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
  * Copyright (c) 2010 HNR Consulting. All rights reserved.
+ * Copyright (C) 2012-2013 Tokyo Institute of Technology. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -59,12 +60,7 @@
 #include <opensm/osm_switch.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_msgdef.h>
-
-typedef struct osm_mcast_work_obj {
-	cl_list_item_t list_item;
-	osm_port_t *p_port;
-	cl_map_item_t map_item;
-} osm_mcast_work_obj_t;
+#include <opensm/osm_mcast_mgr.h>
 
 static osm_mcast_work_obj_t *mcast_work_obj_new(IN osm_port_t * p_port)
 {
@@ -89,16 +85,16 @@ static void mcast_work_obj_delete(IN osm_mcast_work_obj_t * p_wobj)
 	free(p_wobj);
 }
 
-static int make_port_list(cl_qlist_t * list, osm_mgrp_box_t * mbox)
+int osm_mcast_make_port_list_and_map(cl_qlist_t * list, cl_qmap_t * map,
+				     osm_mgrp_box_t * mbox)
 {
-	cl_qmap_t map;
 	cl_map_item_t *map_item;
 	cl_list_item_t *list_item;
 	osm_mgrp_t *mgrp;
 	osm_mcm_port_t *mcm_port;
 	osm_mcast_work_obj_t *wobj;
 
-	cl_qmap_init(&map);
+	cl_qmap_init(map);
 	cl_qlist_init(list);
 
 	for (list_item = cl_qlist_head(&mbox->mgrp_list);
@@ -111,50 +107,33 @@ static int make_port_list(cl_qlist_t * list, osm_mgrp_box_t * mbox)
 			/* Acquire the port object for this port guid, then
 			   create the new worker object to build the list. */
 			mcm_port = cl_item_obj(map_item, mcm_port, map_item);
-			if (cl_qmap_get(&map, mcm_port->port->guid) !=
-			    cl_qmap_end(&map))
+			if (cl_qmap_get(map, mcm_port->port->guid) !=
+			    cl_qmap_end(map))
 				continue;
 			wobj = mcast_work_obj_new(mcm_port->port);
 			if (!wobj)
 				return -1;
 			cl_qlist_insert_tail(list, &wobj->list_item);
-			cl_qmap_insert(&map, mcm_port->port->guid,
+			cl_qmap_insert(map, mcm_port->port->guid,
 				       &wobj->map_item);
 		}
 	}
 	return 0;
 }
 
-static void drop_port_list(cl_qlist_t * list)
+void osm_mcast_drop_port_list(cl_qlist_t * list)
 {
 	while (cl_qlist_count(list))
 		mcast_work_obj_delete((osm_mcast_work_obj_t *)
 				      cl_qlist_remove_head(list));
 }
 
-/**********************************************************************
- Recursively remove nodes from the tree
- *********************************************************************/
-static void mcast_mgr_purge_tree_node(IN osm_mtree_node_t * p_mtn)
-{
-	uint8_t i;
-
-	for (i = 0; i < p_mtn->max_children; i++) {
-		if (p_mtn->child_array[i] &&
-		    (p_mtn->child_array[i] != OSM_MTREE_LEAF))
-			mcast_mgr_purge_tree_node(p_mtn->child_array[i]);
-		p_mtn->child_array[i] = NULL;
-	}
-
-	free(p_mtn);
-}
-
 void osm_purge_mtree(osm_sm_t * sm, IN osm_mgrp_box_t * mbox)
 {
 	OSM_LOG_ENTER(sm->p_log);
 
 	if (mbox->root)
-		mcast_mgr_purge_tree_node(mbox->root);
+		osm_mtree_destroy(mbox->root);
 	mbox->root = NULL;
 
 	OSM_LOG_EXIT(sm->p_log);
@@ -330,7 +309,7 @@ static osm_switch_t *mcast_mgr_find_optimal_switch(osm_sm_t * sm,
 /**********************************************************************
    This function returns the existing or optimal root switch for the tree.
 **********************************************************************/
-static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm, cl_qlist_t *list)
+osm_switch_t *osm_mcast_mgr_find_root_switch(osm_sm_t * sm, cl_qlist_t *list)
 {
 	osm_switch_t *p_sw = NULL;
 
@@ -352,6 +331,7 @@ static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw,
 				   uint32_t block_num, uint32_t position)
 {
 	osm_node_t *p_node;
+	osm_physp_t *p_physp;
 	osm_dr_path_t *p_path;
 	osm_madw_context_t context;
 	ib_api_status_t status;
@@ -370,7 +350,8 @@ static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw,
 
 	CL_ASSERT(p_node);
 
-	p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
+	p_physp = osm_node_get_physp_ptr(p_node, 0);
+	p_path = osm_physp_get_dr_path_ptr(p_physp);
 
 	/*
 	   Send multicast forwarding table blocks to the switch
@@ -394,11 +375,13 @@ static int mcast_mgr_set_mft_block(osm_sm_t * sm, IN osm_switch_t * p_sw,
 
 		status = osm_req_set(sm, p_path, (void *)block, sizeof(block),
 				     IB_MAD_ATTR_MCAST_FWD_TBL,
-				     cl_hton32(block_id_ho), CL_DISP_MSGID_NONE,
-				     &context);
+				     cl_hton32(block_id_ho), FALSE,
+				     ib_port_info_get_m_key(&p_physp->port_info),
+				     CL_DISP_MSGID_NONE, &context);
 		if (status != IB_SUCCESS) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A02: "
-				"Sending multicast fwd. tbl. block to %s failed (%s)\n",
+				"Sending multicast fwd. tbl. block 0x%X to %s "
+				"failed (%s)\n", block_id_ho,
 				p_node->print_desc, ib_get_err_str(status));
 			ret = -1;
 		}
@@ -459,7 +442,7 @@ static void mcast_mgr_subdivide(osm_sm_t * sm, uint16_t mlid_ho,
 			continue;
 		}
 
-		if (port_num > array_size) {
+		if (port_num >= array_size) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A04: "
 				"Error routing MLID 0x%X through switch 0x%"
 				PRIx64 " %s\n"
@@ -470,8 +453,6 @@ static void mcast_mgr_subdivide(osm_sm_t * sm, uint16_t mlid_ho,
 				cl_ntoh16(osm_port_get_base_lid
 					  (p_wobj->p_port)));
 			mcast_work_obj_delete(p_wobj);
-			/* This is means OpenSM has a bug. */
-			CL_ASSERT(FALSE);
 			continue;
 		}
 
@@ -494,7 +475,7 @@ static void mcast_mgr_purge_list(osm_sm_t * sm, cl_qlist_t * list)
 				osm_port_get_guid(wobj->p_port));
 		}
 	}
-	drop_port_list(list);
+	osm_mcast_drop_port_list(list);
 }
 
 /**********************************************************************
@@ -539,7 +520,7 @@ static osm_mtree_node_t *mcast_mgr_branch(osm_sm_t * sm, uint16_t mlid_ho,
 	depth++;
 
 	if (depth >= 64) {
-		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A21: "
 			"Maximal hops number is reached for MLID 0x%x."
 			" Break processing.", mlid_ho);
 		mcast_mgr_purge_list(sm, p_list);
@@ -725,6 +706,7 @@ static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
 						     osm_mgrp_box_t * mbox)
 {
 	cl_qlist_t port_list;
+	cl_qmap_t port_map;
 	uint32_t num_ports;
 	osm_switch_t *p_sw;
 	ib_api_status_t status = IB_SUCCESS;
@@ -741,7 +723,7 @@ static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
 	osm_purge_mtree(sm, mbox);
 
 	/* build the first "subset" containing all member ports */
-	if (make_port_list(&port_list, mbox)) {
+	if (osm_mcast_make_port_list_and_map(&port_list, &port_map, mbox)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A10: "
 			"Insufficient memory to make port list\n");
 		status = IB_ERROR;
@@ -753,7 +735,7 @@ static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 			"MLID 0x%X has %u members - nothing to do\n",
 			mbox->mlid, num_ports);
-		drop_port_list(&port_list);
+		osm_mcast_drop_port_list(&port_list);
 		goto Exit;
 	}
 
@@ -773,12 +755,12 @@ static ib_api_status_t mcast_mgr_build_spanning_tree(osm_sm_t * sm,
 	   Locate the switch around which to create the spanning
 	   tree for this multicast group.
 	 */
-	p_sw = mcast_mgr_find_root_switch(sm, &port_list);
+	p_sw = osm_mcast_mgr_find_root_switch(sm, &port_list);
 	if (p_sw == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A08: "
 			"Unable to locate a suitable switch for group 0x%X\n",
 			mbox->mlid);
-		drop_port_list(&port_list);
+		osm_mcast_drop_port_list(&port_list);
 		status = IB_ERROR;
 		goto Exit;
 	}
@@ -1070,10 +1052,13 @@ static void mcast_mgr_set_mfttop(IN osm_sm_t * sm, IN osm_switch_t * p_sw)
 		context.si_context.light_sweep = FALSE;
 		context.si_context.node_guid = osm_node_get_node_guid(p_node);
 		context.si_context.set_method = TRUE;
+		context.si_context.lft_top_change = FALSE;
 
 		status = osm_req_set(sm, p_path, (uint8_t *) & si,
 				     sizeof(si), IB_MAD_ATTR_SWITCH_INFO,
-				     0, CL_DISP_MSGID_NONE, &context);
+				     0, FALSE,
+				     ib_port_info_get_m_key(&p_physp->port_info),
+				     CL_DISP_MSGID_NONE, &context);
 
 		if (status != IB_SUCCESS)
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A1B: "
diff --git a/opensm/osm_mtree.c b/opensm/osm_mtree.c
index 12acd7b..7cc0422 100644
--- a/opensm/osm_mtree.c
+++ b/opensm/osm_mtree.c
@@ -70,7 +70,7 @@ osm_mtree_node_t *osm_mtree_node_new(IN const osm_switch_t * p_sw)
 
 void osm_mtree_destroy(IN osm_mtree_node_t * p_mtn)
 {
-	uint32_t i;
+	uint8_t i;
 
 	if (p_mtn == NULL)
 		return;
diff --git a/opensm/osm_multicast.c b/opensm/osm_multicast.c
index c43d58d..55476ab 100644
--- a/opensm/osm_multicast.c
+++ b/opensm/osm_multicast.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -338,12 +339,13 @@ osm_mcm_port_t *osm_mgrp_add_port(IN osm_subn_t * subn, osm_log_t * log,
 	return mcm_port;
 }
 
-void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
+boolean_t osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
 			  osm_mcm_alias_guid_t * mcm_alias_guid,
 			  ib_member_rec_t *mcmr)
 {
 	uint8_t join_state = mcmr->scope_state & 0xf;
 	uint8_t port_join_state, new_join_state;
+	boolean_t mgrp_deleted = FALSE;
 
 	/*
 	 * according to the same o15-0.1.14 we get the stored
@@ -406,9 +408,12 @@ void osm_mgrp_remove_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
 	    --mgrp->full_members == 0) {
 		mgrp_send_notice(subn, log, mgrp, 67);
 		osm_mgrp_cleanup(subn, mgrp);
+		mgrp_deleted = TRUE;
 	}
 
 	subn->p_osm->sa.dirty = TRUE;
+
+	return (mgrp_deleted);
 }
 
 void osm_mgrp_delete_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
@@ -416,14 +421,16 @@ void osm_mgrp_delete_port(osm_subn_t * subn, osm_log_t * log, osm_mgrp_t * mgrp,
 {
 	osm_mcm_alias_guid_t *mcm_alias_guid, *next_mcm_alias_guid;
 	ib_member_rec_t mcmrec;
+	boolean_t mgrp_deleted = FALSE;
 
 	next_mcm_alias_guid = (osm_mcm_alias_guid_t *) cl_qmap_head(&mgrp->mcm_alias_port_tbl);
-	while (next_mcm_alias_guid != (osm_mcm_alias_guid_t *) cl_qmap_end(&mgrp->mcm_alias_port_tbl)) {
+	while (next_mcm_alias_guid != (osm_mcm_alias_guid_t *) cl_qmap_end(&mgrp->mcm_alias_port_tbl) &&
+	      !mgrp_deleted) {
 		mcm_alias_guid = next_mcm_alias_guid;
 		next_mcm_alias_guid = (osm_mcm_alias_guid_t *) cl_qmap_next(&next_mcm_alias_guid->map_item);
 		if (mcm_alias_guid->p_base_mcm_port->port == port) {
 			mcmrec.scope_state = 0xf;
-			osm_mgrp_remove_port(subn, log, mgrp, mcm_alias_guid,
+			mgrp_deleted = osm_mgrp_remove_port(subn, log, mgrp, mcm_alias_guid,
 					     &mcmrec);
 		}
 	}
diff --git a/opensm/osm_node.c b/opensm/osm_node.c
index fc71e0f..c2ee7a4 100644
--- a/opensm/osm_node.c
+++ b/opensm/osm_node.c
@@ -99,6 +99,12 @@ osm_node_t *osm_node_new(IN const osm_madw_t * p_madw)
 	p_node->node_info = *p_ni;
 	p_node->physp_tbl_size = size + 1;
 
+	p_node->physp_discovered = malloc(sizeof(uint8_t) * p_node->physp_tbl_size);
+	if (!p_node->physp_discovered) {
+		free(p_node);
+		return NULL;
+	}
+	memset(p_node->physp_discovered, 0, sizeof(uint8_t) * p_node->physp_tbl_size);
 	/*
 	   Construct Physical Port objects owned by this Node.
 	   Then, initialize the Physical Port through with we
@@ -136,6 +142,9 @@ static void node_destroy(IN osm_node_t * p_node)
 	/* cleanup printable node_desc field */
 	if (p_node->print_desc)
 		free(p_node->print_desc);
+
+	/* cleanup physp_discovered array */
+	free(p_node->physp_discovered);
 }
 
 void osm_node_delete(IN OUT osm_node_t ** p_node)
diff --git a/opensm/osm_node_desc_rcv.c b/opensm/osm_node_desc_rcv.c
index 741c944..546ffed 100644
--- a/opensm/osm_node_desc_rcv.c
+++ b/opensm/osm_node_desc_rcv.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -79,8 +80,15 @@ static void nd_rcv_process_nd(IN osm_sm_t * sm, IN osm_node_t * p_node,
 		free(p_node->print_desc);
 	p_node->print_desc = tmp_desc;
 
+#ifdef ENABLE_OSM_PERF_MGR
+	/* update the perfmgr entry if available */
+	osm_perfmgr_update_nodename(&sm->p_subn->p_osm->perfmgr,
+				cl_ntoh64(osm_node_get_node_guid(p_node)),
+				p_node->print_desc);
+#endif				/* ENABLE_OSM_PERF_MGR */
+
 	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-		"Node 0x%" PRIx64 "\n\t\t\t\tDescription = %s\n",
+		"Node 0x%" PRIx64 ", Description = %s\n",
 		cl_ntoh64(osm_node_get_node_guid(p_node)), p_node->print_desc);
 
 	OSM_LOG_EXIT(sm->p_log);
diff --git a/opensm/osm_node_info_rcv.c b/opensm/osm_node_info_rcv.c
index 36d8046..4242924 100644
--- a/opensm/osm_node_info_rcv.c
+++ b/opensm/osm_node_info_rcv.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
  *
@@ -119,7 +119,7 @@ static void requery_dup_node_info(IN osm_sm_t * sm, osm_physp_t * p_physp,
 	context.ni_context.dup_count = count;
 
 	status = osm_req_get(sm, &path, IB_MAD_ATTR_NODE_INFO, 0,
-			     CL_DISP_MSGID_NONE, &context);
+			     TRUE, 0, CL_DISP_MSGID_NONE, &context);
 
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D02: "
@@ -153,7 +153,7 @@ static void ni_rcv_set_links(IN osm_sm_t * sm, osm_node_t * p_node,
 
 	p_neighbor_node = osm_get_node_by_guid(sm->p_subn,
 					       p_ni_context->node_guid);
-	if (!p_neighbor_node) {
+	if (PF(!p_neighbor_node)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D10: "
 			"Unexpected removal of neighbor node 0x%" PRIx64 "\n",
 			cl_ntoh64(p_ni_context->node_guid));
@@ -172,6 +172,19 @@ static void ni_rcv_set_links(IN osm_sm_t * sm, osm_node_t * p_node,
 		goto _exit;
 	}
 
+	p_physp = osm_node_get_physp_ptr(p_node, port_num);
+	/*
+	 * If the link went UP, after we already discovered it, we shouldn't
+	 * set the link between the ports and resweep.
+	 */
+	if (osm_physp_get_port_state(p_physp) == IB_LINK_DOWN &&
+	    p_node->physp_discovered[port_num]) {
+		/* Link down on another side. Don't create a link*/
+		p_node->physp_discovered[port_num] = 0;
+		sm->p_subn->force_heavy_sweep = TRUE;
+		goto _exit;
+	}
+
 	if (osm_node_has_any_link(p_node, port_num) &&
 	    sm->p_subn->force_heavy_sweep == FALSE &&
 	    (!p_ni_context->dup_count ||
@@ -294,11 +307,12 @@ static void ni_rcv_get_port_info(IN osm_sm_t * sm, IN osm_node_t * node,
 	context.pi_context.set_method = FALSE;
 	context.pi_context.light_sweep = FALSE;
 	context.pi_context.active_transition = FALSE;
+	context.pi_context.client_rereg = FALSE;
 
 	for (; port < num_ports; port++) {
 		status = osm_req_get(sm, osm_physp_get_dr_path_ptr(physp),
 				     IB_MAD_ATTR_PORT_INFO, cl_hton32(port),
-				     CL_DISP_MSGID_NONE, &context);
+				     TRUE, 0, CL_DISP_MSGID_NONE, &context);
 		if (status != IB_SUCCESS)
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR OD02: "
 				"Failure initiating PortInfo request (%s)\n",
@@ -307,7 +321,7 @@ static void ni_rcv_get_port_info(IN osm_sm_t * sm, IN osm_node_t * node,
 			status = osm_req_get(sm,
 					     osm_physp_get_dr_path_ptr(physp),
 					     IB_MAD_ATTR_MLNX_EXTENDED_PORT_INFO,
-					     cl_hton32(port),
+					     cl_hton32(port), TRUE, 0,
 					     CL_DISP_MSGID_NONE, &context);
 			if (status != IB_SUCCESS)
 				OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0B: "
@@ -331,8 +345,8 @@ void osm_req_get_node_desc(IN osm_sm_t * sm, osm_physp_t * p_physp)
 	    osm_node_get_node_guid(osm_physp_get_node_ptr(p_physp));
 
 	status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
-			     IB_MAD_ATTR_NODE_DESC, 0, CL_DISP_MSGID_NONE,
-			     &context);
+			     IB_MAD_ATTR_NODE_DESC, 0, TRUE, 0,
+			     CL_DISP_MSGID_NONE, &context);
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D03: "
 			"Failure initiating NodeDescription request (%s)\n",
@@ -430,7 +444,7 @@ static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
 		osm_node_init_physp(p_node, port_num, p_madw);
 
 		p_port = osm_port_new(p_ni, p_node);
-		if (p_port == NULL) {
+		if (PF(p_port == NULL)) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D04: "
 				"Unable to create new port object\n");
 			goto Exit;
@@ -443,7 +457,7 @@ static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
 		    (osm_port_t *) cl_qmap_insert(&sm->p_subn->port_guid_tbl,
 						  p_ni->port_guid,
 						  &p_port->map_item);
-		if (p_port_check != p_port) {
+		if (PF(p_port_check != p_port)) {
 			/*
 			   We should never be here!
 			   Somehow, this port GUID already exists in the table.
@@ -458,7 +472,7 @@ static void ni_rcv_process_existing_ca_or_router(IN osm_sm_t * sm,
 
 		p_alias_guid = osm_alias_guid_new(p_ni->port_guid,
 						  p_port);
-		if (!p_alias_guid) {
+		if (PF(!p_alias_guid)) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D11: "
 				"alias guid memory allocation failed"
 				" for port GUID 0x%" PRIx64 "\n",
@@ -495,7 +509,7 @@ alias_done:
 	} else {
 		osm_physp_t *p_physp = osm_node_get_physp_ptr(p_node, port_num);
 
-		if (p_physp == NULL) {
+		if (PF(p_physp == NULL)) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D1C: "
 				"No physical port found for node GUID 0x%"
 				PRIx64 " port %u. Might be duplicate port GUID\n",
@@ -524,6 +538,7 @@ static void ni_rcv_process_switch(IN osm_sm_t * sm, IN osm_node_t * p_node,
 				  IN const osm_madw_t * p_madw)
 {
 	ib_api_status_t status = IB_SUCCESS;
+	osm_physp_t *p_physp;
 	osm_madw_context_t context;
 	osm_dr_path_t *path;
 	ib_smp_t *p_smp;
@@ -532,17 +547,19 @@ static void ni_rcv_process_switch(IN osm_sm_t * sm, IN osm_node_t * p_node,
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
+	p_physp = osm_node_get_physp_ptr(p_node, 0);
 	/* update DR path of already initialized switch port 0 */
-	path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
+	path = osm_physp_get_dr_path_ptr(p_physp);
 	osm_dr_path_init(path, p_smp->hop_count, p_smp->initial_path);
 
 	context.si_context.node_guid = osm_node_get_node_guid(p_node);
 	context.si_context.set_method = FALSE;
 	context.si_context.light_sweep = FALSE;
+	context.si_context.lft_top_change = FALSE;
 
 	/* Request a SwitchInfo attribute */
-	status = osm_req_get(sm, path, IB_MAD_ATTR_SWITCH_INFO,
-			     0, CL_DISP_MSGID_NONE, &context);
+	status = osm_req_get(sm, path, IB_MAD_ATTR_SWITCH_INFO, 0, TRUE, 0,
+			     CL_DISP_MSGID_NONE, &context);
 	if (status != IB_SUCCESS)
 		/* continue despite error */
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D06: "
@@ -639,7 +656,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw)
 		ib_get_node_type_str(p_ni->node_type),
 		cl_ntoh64(p_ni->node_guid), cl_ntoh64(p_smp->trans_id));
 
-	if (port_num > p_ni->num_ports) {
+	if (PF(port_num > p_ni->num_ports)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0A: "
 			"New %s node GUID 0x%" PRIx64 "is non-compliant and "
 			"is being ignored since the "
@@ -651,7 +668,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw)
 	}
 
 	p_node = osm_node_new(p_madw);
-	if (p_node == NULL) {
+	if (PF(p_node == NULL)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D07: "
 			"Unable to create new node object\n");
 		goto Exit;
@@ -662,7 +679,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw)
 	   ports in the port table.
 	 */
 	p_port = osm_port_new(p_ni, p_node);
-	if (p_port == NULL) {
+	if (PF(p_port == NULL)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D14: "
 			"Unable to create new port object\n");
 		osm_node_delete(&p_node);
@@ -675,7 +692,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw)
 	p_port_check =
 	    (osm_port_t *) cl_qmap_insert(&sm->p_subn->port_guid_tbl,
 					  p_ni->port_guid, &p_port->map_item);
-	if (p_port_check != p_port) {
+	if (PF(p_port_check != p_port)) {
 		/*
 		   We should never be here!
 		   Somehow, this port GUID already exists in the table.
@@ -698,7 +715,7 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw)
 
 	p_alias_guid = osm_alias_guid_new(p_ni->port_guid,
 					  p_port);
-	if (!p_alias_guid) {
+	if (PF(!p_alias_guid)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D18: "
 			"alias guid memory allocation failed"
 			" for port GUID 0x%" PRIx64 "\n",
@@ -733,7 +750,7 @@ alias_done2:
 	/* If there were RouterInfo or other router attribute,
 	   this would be elsewhere */
 	if (p_ni->node_type == IB_NODE_TYPE_ROUTER) {
-		if ((p_rtr = osm_router_new(p_port)) == NULL)
+		if (PF((p_rtr = osm_router_new(p_port)) == NULL))
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D1A: "
 				"Unable to create new router object\n");
 		else {
@@ -742,7 +759,7 @@ alias_done2:
 			    (osm_router_t *) cl_qmap_insert(p_rtr_guid_tbl,
 							    p_ni->port_guid,
 							    &p_rtr->map_item);
-			if (p_rtr_check != p_rtr)
+			if (PF(p_rtr_check != p_rtr))
 				OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D1B: "
 					"Unable to add port GUID:0x%016" PRIx64
 					" to router table\n",
@@ -753,7 +770,7 @@ alias_done2:
 	p_node_check =
 	    (osm_node_t *) cl_qmap_insert(&sm->p_subn->node_guid_tbl,
 					  p_ni->node_guid, &p_node->map_item);
-	if (p_node_check != p_node) {
+	if (PF(p_node_check != p_node)) {
 		/*
 		   This node must have been inserted by another thread.
 		   This is unexpected, but is not an error.
@@ -817,7 +834,7 @@ static void ni_rcv_process_existing(IN osm_sm_t * sm, IN osm_node_t * p_node,
 		cl_ntoh64(p_ni->node_guid),
 		cl_ntoh64(p_smp->trans_id), p_node->discovery_count);
 
-	if (port_num > p_ni->num_ports) {
+	if (PF(port_num > p_ni->num_ports)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0C: "
 			"Existing %s node GUID 0x%" PRIx64 "is non-compliant "
 			"and is being ignored since the "
@@ -876,14 +893,14 @@ void osm_ni_rcv_process(IN void *context, IN void *data)
 
 	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_NODE_INFO);
 
-	if (p_ni->node_guid == 0) {
+	if (PF(p_ni->node_guid == 0)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D16: "
 			"Got Zero Node GUID! Found on the directed route:\n");
 		osm_dump_smp_dr_path_v2(sm->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
 		goto Exit;
 	}
 
-	if (p_ni->port_guid == 0) {
+	if (PF(p_ni->port_guid == 0)) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D17: "
 			"Got Zero Port GUID! Found on the directed route:\n");
 		osm_dump_smp_dr_path_v2(sm->p_log, p_smp, FILE_ID, OSM_LOG_ERROR);
diff --git a/opensm/osm_opensm.c b/opensm/osm_opensm.c
index 0909a36..f702c80 100644
--- a/opensm/osm_opensm.c
+++ b/opensm/osm_opensm.c
@@ -243,12 +243,18 @@ void osm_opensm_construct(IN osm_opensm_t * p_osm)
 	memset(p_osm, 0, sizeof(*p_osm));
 	p_osm->osm_version = OSM_VERSION;
 	osm_subn_construct(&p_osm->subn);
+	osm_db_construct(&p_osm->db);
+	osm_log_construct(&p_osm->log);
+}
+
+void osm_opensm_construct_finish(IN osm_opensm_t * p_osm)
+{
 	osm_sm_construct(&p_osm->sm);
 	osm_sa_construct(&p_osm->sa);
-	osm_db_construct(&p_osm->db);
 	osm_mad_pool_construct(&p_osm->mad_pool);
+	p_osm->mad_pool_constructed = TRUE;
 	osm_vl15_construct(&p_osm->vl15);
-	osm_log_construct(&p_osm->log);
+	p_osm->vl15_constructed = TRUE;
 }
 
 static void destroy_routing_engines(osm_opensm_t *osm)
@@ -312,7 +318,8 @@ void osm_opensm_destroy(IN osm_opensm_t * p_osm)
 	cl_disp_shutdown(&p_osm->disp);
 
 	/* dump SA DB */
-	if (p_osm->subn.opt.sa_db_dump)
+	if ((p_osm->sm.p_subn->sm_state == IB_SMINFO_STATE_MASTER) &&
+	     p_osm->subn.opt.sa_db_dump)
 		osm_sa_db_file_dump(p_osm);
 
 	/* do the destruction in reverse order as init */
@@ -324,9 +331,17 @@ void osm_opensm_destroy(IN osm_opensm_t * p_osm)
 	osm_perfmgr_destroy(&p_osm->perfmgr);
 #endif				/* ENABLE_OSM_PERF_MGR */
 	osm_congestion_control_destroy(&p_osm->cc);
+}
+
+void osm_opensm_destroy_finish(IN osm_opensm_t * p_osm)
+{
 	osm_db_destroy(&p_osm->db);
-	osm_vl15_destroy(&p_osm->vl15, &p_osm->mad_pool);
-	osm_mad_pool_destroy(&p_osm->mad_pool);
+	if (p_osm->vl15_constructed && p_osm->mad_pool_constructed)
+		osm_vl15_destroy(&p_osm->vl15, &p_osm->mad_pool);
+	if (p_osm->mad_pool_constructed)
+		osm_mad_pool_destroy(&p_osm->mad_pool);
+	p_osm->vl15_constructed = FALSE;
+	p_osm->mad_pool_constructed = FALSE;
 	osm_vendor_delete(&p_osm->p_vendor);
 	osm_subn_destroy(&p_osm->subn);
 	cl_disp_destroy(&p_osm->disp);
@@ -336,8 +351,8 @@ void osm_opensm_destroy(IN osm_opensm_t * p_osm)
 #else
 	cl_event_destroy(&p_osm->stats.event);
 #endif
-	close_node_name_map(p_osm->node_name_map);
-
+	if (p_osm->node_name_map)
+		close_node_name_map(p_osm->node_name_map);
 	cl_plock_destroy(&p_osm->lock);
 
 	osm_log_destroy(&p_osm->log);
@@ -354,7 +369,8 @@ static void load_plugins(osm_opensm_t *osm, const char *plugin_names)
 		epi = osm_epi_construct(osm, name);
 		if (!epi)
 			osm_log_v2(&osm->log, OSM_LOG_ERROR, FILE_ID,
-				   "cannot load plugin \'%s\'\n", name);
+				   "ERR 1000: cannot load plugin \'%s\'\n",
+				   name);
 		else
 			cl_qlist_insert_tail(&osm->plugin_list, &epi->list);
 		name = strtok_r(NULL, " \t\n", &p);
@@ -427,10 +443,22 @@ ib_api_status_t osm_opensm_init(IN osm_opensm_t * p_osm,
 
 	p_osm->p_vendor =
 	    osm_vendor_new(&p_osm->log, p_opt->transaction_timeout);
-	if (p_osm->p_vendor == NULL) {
+	if (p_osm->p_vendor == NULL)
 		status = IB_INSUFFICIENT_RESOURCES;
-		goto Exit;
-	}
+
+Exit:
+	OSM_LOG(&p_osm->log, OSM_LOG_FUNCS, "]\n");	/* Format Waived */
+	return status;
+}
+
+ib_api_status_t osm_opensm_init_finish(IN osm_opensm_t * p_osm,
+				       IN const osm_subn_opt_t * p_opt)
+{
+	ib_api_status_t status;
+
+	osm_opensm_construct_finish(p_osm);
+
+	p_osm->subn.sm_port_guid = p_opt->guid;
 
 	status = osm_mad_pool_init(&p_osm->mad_pool);
 	if (status != IB_SUCCESS)
diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c
index c5c71f6..bf2bfc9 100644
--- a/opensm/osm_perfmgr.c
+++ b/opensm/osm_perfmgr.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2007 The Regents of the University of California.
  * Copyright (c) 2007-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2009,2010 HNR Consulting. All rights reserved.
+ * Copyright (c) 2013 Lawrence Livermore National Security. All rights * reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -70,7 +71,7 @@
 
 #define PERFMGR_INITIAL_TID_VALUE 0xcafe
 
-#if ENABLE_OSM_PERF_MGR_PROFILE
+#ifdef ENABLE_OSM_PERF_MGR_PROFILE
 struct {
 	double fastest_us;
 	double slowest_us;
@@ -117,7 +118,7 @@ static inline void diff_time(struct timeval *before, struct timeval *after,
 #endif
 
 /**********************************************************************
- * Internal helper functions.
+ * Internal helper functions
  **********************************************************************/
 static void init_monitored_nodes(osm_perfmgr_t * pm)
 {
@@ -166,7 +167,7 @@ static inline void decrement_outstanding_queries(osm_perfmgr_t * pm)
 
 /**********************************************************************
  * Receive the MAD from the vendor layer and post it for processing by
- * the dispatcher.
+ * the dispatcher
  **********************************************************************/
 static void perfmgr_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,
 				      osm_madw_t * p_req_madw)
@@ -175,6 +176,9 @@ static void perfmgr_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,
 
 	OSM_LOG_ENTER(pm->log);
 
+	CL_ASSERT(p_madw);
+	CL_ASSERT(p_req_madw != NULL);
+
 	osm_madw_copy_context(p_madw, p_req_madw);
 	osm_mad_pool_put(pm->mad_pool, p_req_madw);
 
@@ -191,7 +195,7 @@ static void perfmgr_mad_recv_callback(osm_madw_t * p_madw, void *bind_context,
 }
 
 /**********************************************************************
- * Process MAD send errors.
+ * Process MAD send errors
  **********************************************************************/
 static void perfmgr_mad_send_err_callback(void *bind_context,
 					  osm_madw_t * p_madw)
@@ -357,16 +361,18 @@ static ib_net16_t get_lid(osm_node_t * p_node, uint8_t port,
 }
 
 /**********************************************************************
- * Form and send the Port Counters MAD for a single port.
+ * Build a Performance Management class MAD
  **********************************************************************/
-static ib_api_status_t perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr,
-					   ib_net16_t dest_lid,
-					   ib_net32_t dest_qp, uint16_t pkey_ix,
-					   uint8_t port, uint8_t mad_method,
-					   osm_madw_context_t * p_context)
+static osm_madw_t *perfmgr_build_mad(osm_perfmgr_t * perfmgr,
+				     ib_net16_t dest_lid,
+				     uint8_t sl,
+				     ib_net32_t dest_qp,
+				     uint16_t pkey_ix,
+				     uint8_t mad_method,
+				     ib_net16_t attr_id,
+				     osm_madw_context_t * p_context,
+				     ib_perfmgt_mad_t ** p_pm_mad)
 {
-	ib_api_status_t status = IB_SUCCESS;
-	ib_port_counters_t *port_counter = NULL;
 	ib_perfmgt_mad_t *pm_mad = NULL;
 	osm_madw_t *p_madw = NULL;
 
@@ -375,7 +381,7 @@ static ib_api_status_t perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr,
 	p_madw = osm_mad_pool_get(perfmgr->mad_pool, perfmgr->bind_handle,
 				  MAD_BLOCK_SIZE, NULL);
 	if (p_madw == NULL)
-		return IB_INSUFFICIENT_MEMORY;
+		return NULL;
 
 	pm_mad = osm_madw_get_perfmgt_mad_ptr(p_madw);
 
@@ -393,40 +399,95 @@ static ib_api_status_t perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr,
 		pm_mad->header.trans_id =
 		    cl_hton64((uint64_t) cl_atomic_inc(&perfmgr->trans_id) &
 			      (uint64_t) (0xFFFFFFFF));
-	pm_mad->header.attr_id = IB_MAD_ATTR_PORT_CNTRS;
+	pm_mad->header.attr_id = attr_id;
 	pm_mad->header.resv = 0;
 	pm_mad->header.attr_mod = 0;
 
-	port_counter = (ib_port_counters_t *) & pm_mad->data;
-	memset(port_counter, 0, sizeof(*port_counter));
-	port_counter->port_select = port;
-	port_counter->counter_select = 0xFFFF;
-
 	p_madw->mad_addr.dest_lid = dest_lid;
 	p_madw->mad_addr.addr_type.gsi.remote_qp = dest_qp;
 	p_madw->mad_addr.addr_type.gsi.remote_qkey =
 	    cl_hton32(IB_QP1_WELL_KNOWN_Q_KEY);
 	p_madw->mad_addr.addr_type.gsi.pkey_ix = pkey_ix;
-	p_madw->mad_addr.addr_type.gsi.service_level = 0;
+	p_madw->mad_addr.addr_type.gsi.service_level = sl;
 	p_madw->mad_addr.addr_type.gsi.global_route = FALSE;
 	p_madw->resp_expected = TRUE;
 
 	if (p_context)
 		p_madw->context = *p_context;
 
-	status = osm_vendor_send(perfmgr->bind_handle, p_madw, TRUE);
+	if (p_pm_mad)
+		*p_pm_mad = pm_mad;
+
+	OSM_LOG_EXIT(perfmgr->log);
+
+	return (p_madw);
+}
 
+/**********************************************************************
+ * Send a Performance Management class MAD
+ **********************************************************************/
+static ib_api_status_t perfmgr_send_mad(osm_perfmgr_t *perfmgr,
+					osm_madw_t * const p_madw)
+{
+	ib_api_status_t status = osm_vendor_send(perfmgr->bind_handle, p_madw,
+						 TRUE);
 	if (status == IB_SUCCESS) {
 		/* pause thread if there are too many outstanding requests */
 		cl_atomic_inc(&(perfmgr->outstanding_queries));
-		if (perfmgr->outstanding_queries >
-		    perfmgr->max_outstanding_queries) {
+		while (perfmgr->outstanding_queries >
+		       (int32_t)perfmgr->max_outstanding_queries) {
+			cl_spinlock_acquire(&perfmgr->lock);
 			perfmgr->sweep_state = PERFMGR_SWEEP_SUSPENDED;
+			cl_spinlock_release(&perfmgr->lock);
 			cl_event_wait_on(&perfmgr->sig_query, EVENT_NO_TIMEOUT,
 					 TRUE);
-			perfmgr->sweep_state = PERFMGR_SWEEP_ACTIVE;
+
+			cl_spinlock_acquire(&perfmgr->lock);
+			if (perfmgr->sweep_state == PERFMGR_SWEEP_SUSPENDED) {
+				perfmgr->sweep_state = PERFMGR_SWEEP_ACTIVE;
+				cl_spinlock_release(&perfmgr->lock);
+			} else {
+				cl_spinlock_release(&perfmgr->lock);
+				OSM_LOG(perfmgr->log, OSM_LOG_ERROR, "ERR 54FF: "
+					"PM was NOT in Suspended state???\n");
+			}
 		}
 	}
+	return (status);
+}
+
+
+/**********************************************************************
+ * Form and send the PortCounters MAD for a single port
+ **********************************************************************/
+static ib_api_status_t perfmgr_send_pc_mad(osm_perfmgr_t * perfmgr,
+					   ib_net16_t dest_lid,
+					   ib_net32_t dest_qp, uint16_t pkey_ix,
+					   uint8_t port, uint8_t mad_method,
+					   uint16_t counter_select,
+					   osm_madw_context_t * p_context,
+					   uint8_t sl)
+{
+	ib_api_status_t status = IB_SUCCESS;
+	ib_port_counters_t *port_counter = NULL;
+	ib_perfmgt_mad_t *pm_mad = NULL;
+	osm_madw_t *p_madw = NULL;
+
+	OSM_LOG_ENTER(perfmgr->log);
+
+	p_context->perfmgr_context.mad_attr_id = IB_MAD_ATTR_PORT_CNTRS;
+	p_madw = perfmgr_build_mad(perfmgr, dest_lid, sl, dest_qp, pkey_ix,
+				mad_method, IB_MAD_ATTR_PORT_CNTRS, p_context,
+				&pm_mad);
+	if (p_madw == NULL)
+		return IB_INSUFFICIENT_MEMORY;
+
+	port_counter = (ib_port_counters_t *) & pm_mad->data;
+	memset(port_counter, 0, sizeof(*port_counter));
+	port_counter->port_select = port;
+	port_counter->counter_select = cl_hton16(counter_select);
+
+	status = perfmgr_send_mad(perfmgr, p_madw);
 
 	OSM_LOG_EXIT(perfmgr->log);
 	return status;
@@ -446,8 +507,8 @@ static void collect_guids(cl_map_item_t * p_map_item, void *context)
 
 	OSM_LOG_ENTER(pm->log);
 
-	if (cl_qmap_get(&pm->monitored_map, node_guid)
-	    == cl_qmap_end(&pm->monitored_map)) {
+	if (cl_qmap_get(&pm->monitored_map, node_guid) ==
+	    cl_qmap_end(&pm->monitored_map)) {
 
 		if (pm->ignore_cas &&
 		    (node->node_info.node_type == IB_NODE_TYPE_CA))
@@ -469,6 +530,7 @@ static void collect_guids(cl_map_item_t * p_map_item, void *context)
 		mon_node->guid = node_guid;
 		mon_node->name = strdup(node->print_desc);
 		mon_node->num_ports = num_ports;
+		mon_node->node_type = node->node_info.node_type;
 		/* check for enhanced switch port 0 */
 		mon_node->esp0 = (node->sw &&
 				  ib_switch_info_is_enhanced_port0(&node->sw->
@@ -491,7 +553,94 @@ Exit:
 }
 
 /**********************************************************************
- * query the Port Counters of all the nodes in the subnet.
+ * Form and send the ClassPortInfo MAD for a single port
+ **********************************************************************/
+static ib_api_status_t perfmgr_send_cpi_mad(osm_perfmgr_t * pm,
+					    ib_net16_t dest_lid,
+					    ib_net32_t dest_qp,
+					    uint16_t pkey_ix,
+					    uint8_t port,
+					    osm_madw_context_t * p_context,
+					    uint8_t sl)
+{
+	ib_api_status_t status = IB_SUCCESS;
+	osm_madw_t *p_madw = NULL;
+
+	OSM_LOG_ENTER(pm->log);
+
+	p_context->perfmgr_context.mad_attr_id = IB_MAD_ATTR_CLASS_PORT_INFO;
+	p_madw = perfmgr_build_mad(pm, dest_lid, sl, dest_qp,
+				   pkey_ix, IB_MAD_METHOD_GET,
+				   IB_MAD_ATTR_CLASS_PORT_INFO, p_context,
+				   NULL);
+	if (p_madw == NULL)
+		return IB_INSUFFICIENT_MEMORY;
+
+	status = perfmgr_send_mad(pm, p_madw);
+
+	OSM_LOG_EXIT(pm->log);
+	return status;
+}
+
+/**********************************************************************
+ * return if some form of PortCountersExtended (PCE || PCE NoIETF) are supported
+ **********************************************************************/
+static inline boolean_t pce_supported(monitored_node_t *mon_node, uint8_t port)
+{
+	monitored_port_t *mon_port = &(mon_node->port[port]);
+	return (mon_port->cpi_valid
+		&& (mon_port->cap_mask & IB_PM_EXT_WIDTH_SUPPORTED
+		|| mon_port->cap_mask & IB_PM_EXT_WIDTH_NOIETF_SUP));
+}
+
+/**********************************************************************
+ * return if "full" PortCountersExtended (IETF) is indicated
+ **********************************************************************/
+static inline boolean_t ietf_supported(monitored_node_t *mon_node, uint8_t port)
+{
+	monitored_port_t *mon_port = &(mon_node->port[port]);
+	return (mon_port->cpi_valid
+		&& (mon_port->cap_mask & IB_PM_EXT_WIDTH_SUPPORTED));
+}
+
+/**********************************************************************
+ * Form and send the PortCountersExtended MAD for a single port
+ **********************************************************************/
+static ib_api_status_t perfmgr_send_pce_mad(osm_perfmgr_t * perfmgr,
+					    ib_net16_t dest_lid,
+					    ib_net32_t dest_qp,
+					    uint16_t pkey_ix,
+					    uint8_t port, uint8_t mad_method,
+					    osm_madw_context_t * p_context,
+					    uint8_t sl)
+{
+	ib_api_status_t status = IB_SUCCESS;
+	ib_port_counters_ext_t *port_counter_ext = NULL;
+	ib_perfmgt_mad_t *pm_mad = NULL;
+	osm_madw_t *p_madw = NULL;
+
+	OSM_LOG_ENTER(perfmgr->log);
+
+	p_context->perfmgr_context.mad_attr_id = IB_MAD_ATTR_PORT_CNTRS_EXT;
+	p_madw = perfmgr_build_mad(perfmgr, dest_lid, sl, dest_qp, pkey_ix,
+				mad_method, IB_MAD_ATTR_PORT_CNTRS_EXT, p_context,
+				&pm_mad);
+	if (p_madw == NULL)
+		return IB_INSUFFICIENT_MEMORY;
+
+	port_counter_ext = (ib_port_counters_ext_t *) & pm_mad->data;
+	memset(port_counter_ext, 0, sizeof(*port_counter_ext));
+	port_counter_ext->port_select = port;
+	port_counter_ext->counter_select = cl_hton16(0x00FF);
+
+	status = perfmgr_send_mad(perfmgr, p_madw);
+
+	OSM_LOG_EXIT(perfmgr->log);
+	return status;
+}
+
+/**********************************************************************
+ * query the Port Counters of all the nodes in the subnet
  **********************************************************************/
 static void perfmgr_query_counters(cl_map_item_t * p_map_item, void *context)
 {
@@ -557,22 +706,65 @@ static void perfmgr_query_counters(cl_map_item_t * p_map_item, void *context)
 		mad_context.perfmgr_context.node_guid = node_guid;
 		mad_context.perfmgr_context.port = port;
 		mad_context.perfmgr_context.mad_method = IB_MAD_METHOD_GET;
+
+		if (pm->query_cpi && !mon_node->port[port].cpi_valid) {
+			status = perfmgr_send_cpi_mad(pm, lid, remote_qp,
+						mon_node->port[port].pkey_ix,
+						port, &mad_context,
+						0); /* FIXME SL != 0 */
+			if (status != IB_SUCCESS)
+				OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5410: "
+					"Failed to issue ClassPortInfo query "
+					"for node 0x%" PRIx64
+					" port %d (%s)\n",
+					node->node_info.node_guid, port,
+					node->print_desc);
+			if (mon_node->node_type == IB_NODE_TYPE_SWITCH)
+				goto Exit; /* only need to issue 1 CPI query
+						for switches */
+		} else {
+
+#ifdef ENABLE_OSM_PERF_MGR_PROFILE
+			gettimeofday(&mad_context.perfmgr_context.query_start, NULL);
+#endif
+			OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Getting stats for node 0x%"
+				PRIx64 " port %d (lid %u) (%s)\n", node_guid, port,
+				cl_ntoh16(lid), node->print_desc);
+			status = perfmgr_send_pc_mad(pm, lid, remote_qp,
+						     mon_node->port[port].pkey_ix,
+						     port, IB_MAD_METHOD_GET,
+						     0xffff,
+						     &mad_context,
+						     0); /* FIXME SL != 0 */
+			if (status != IB_SUCCESS)
+				OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5409: "
+					"Failed to issue port counter query for node 0x%"
+					PRIx64 " port %d (%s)\n",
+					node->node_info.node_guid, port,
+					node->print_desc);
+
+			if (pce_supported(mon_node, port)) {
+
 #if ENABLE_OSM_PERF_MGR_PROFILE
-		gettimeofday(&mad_context.perfmgr_context.query_start, NULL);
+				gettimeofday(&mad_context.perfmgr_context.query_start, NULL);
 #endif
-		OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Getting stats for node 0x%"
-			PRIx64 " port %d (lid %u) (%s)\n", node_guid, port,
-			cl_ntoh16(lid), node->print_desc);
-		status = perfmgr_send_pc_mad(pm, lid, remote_qp,
-					     mon_node->port[port].pkey_ix,
-					     port, IB_MAD_METHOD_GET,
-					     &mad_context);
-		if (status != IB_SUCCESS)
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5409: "
-				"Failed to issue port counter query for node 0x%"
-				PRIx64 " port %d (%s)\n",
-				node->node_info.node_guid, port,
-				node->print_desc);
+				status = perfmgr_send_pce_mad(pm, lid, remote_qp,
+							      mon_node->port[port].pkey_ix,
+							      port,
+							      IB_MAD_METHOD_GET,
+							      &mad_context,
+							      0); /* FIXME SL != 0 */
+				if (status != IB_SUCCESS)
+					OSM_LOG(pm->log, OSM_LOG_ERROR,
+						"ERR 5417: Failed to issue "
+						"port counter query for "
+						"node 0x%" PRIx64 " port "
+						"%d (%s)\n",
+						node->node_info.node_guid,
+						port,
+						node->print_desc);
+			}
+		}
 	}
 Exit:
 	cl_plock_release(&pm->osm->lock);
@@ -580,7 +772,7 @@ Exit:
 }
 
 /**********************************************************************
- * Discovery stuff.
+ * Discovery stuff
  * This code should not be here, but merged with main OpenSM
  **********************************************************************/
 extern int wait_for_pending_transactions(osm_stats_t * stats);
@@ -629,7 +821,7 @@ static int sweep_hop_1(osm_sm_t * sm)
 		osm_dr_path_init(&hop_1_path, 1, path_array);
 		CL_PLOCK_ACQUIRE(sm->p_lock);
 		status = osm_req_get(sm, &hop_1_path, IB_MAD_ATTR_NODE_INFO, 0,
-				     CL_DISP_MSGID_NONE, &context);
+				     TRUE, 0, CL_DISP_MSGID_NONE, &context);
 		CL_PLOCK_RELEASE(sm->p_lock);
 
 		if (status != IB_SUCCESS)
@@ -663,7 +855,7 @@ static int sweep_hop_1(osm_sm_t * sm)
 			osm_dr_path_init(&hop_1_path, 1, path_array);
 			CL_PLOCK_ACQUIRE(sm->p_lock);
 			status = osm_req_get(sm, &hop_1_path,
-					     IB_MAD_ATTR_NODE_INFO, 0,
+					     IB_MAD_ATTR_NODE_INFO, 0, TRUE, 0,
 					     CL_DISP_MSGID_NONE, &context);
 			CL_PLOCK_RELEASE(sm->p_lock);
 
@@ -727,7 +919,7 @@ static int sweep_hop_0(osm_sm_t * sm)
 	osm_dr_path_init(&dr_path, 0, path_array);
 	CL_PLOCK_ACQUIRE(sm->p_lock);
 	status = osm_req_get(sm, &dr_path, IB_MAD_ATTR_NODE_INFO, 0,
-			     CL_DISP_MSGID_NONE, NULL);
+			     TRUE, 0, CL_DISP_MSGID_NONE, NULL);
 	CL_PLOCK_RELEASE(sm->p_lock);
 
 	if (status != IB_SUCCESS)
@@ -796,17 +988,27 @@ _exit:
 }
 
 /**********************************************************************
- * Main PerfMgr processor - query the performance counters.
+ * Main PerfMgr processor - query the performance counters
  **********************************************************************/
 void osm_perfmgr_process(osm_perfmgr_t * pm)
 {
-#if ENABLE_OSM_PERF_MGR_PROFILE
+#ifdef ENABLE_OSM_PERF_MGR_PROFILE
 	struct timeval before, after;
 #endif
 
 	if (pm->state != PERFMGR_STATE_ENABLED)
 		return;
 
+	cl_spinlock_acquire(&pm->lock);
+	if (pm->sweep_state == PERFMGR_SWEEP_ACTIVE ||
+	    pm->sweep_state == PERFMGR_SWEEP_SUSPENDED) {
+		cl_spinlock_release(&pm->lock);
+		return;
+	}
+
+	pm->sweep_state = PERFMGR_SWEEP_ACTIVE;
+	cl_spinlock_release(&pm->lock);
+
 	if (pm->subn->sm_state == IB_SMINFO_STATE_STANDBY ||
 	    pm->subn->sm_state == IB_SMINFO_STATE_NOTACTIVE)
 		perfmgr_discovery(pm->subn->p_osm);
@@ -825,14 +1027,15 @@ void osm_perfmgr_process(osm_perfmgr_t * pm)
 			    ib_node_info_get_local_port_num(&p_node->node_info);
 		} else
 			OSM_LOG(pm->log, OSM_LOG_ERROR,
-				"ERR 5487: No PerfMgr port object\n");
+				"ERR 5487: No PerfMgr port object for "
+				"port GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(pm->port_guid));
 		CL_PLOCK_RELEASE(pm->sm->p_lock);
 	}
 
-#if ENABLE_OSM_PERF_MGR_PROFILE
+#ifdef ENABLE_OSM_PERF_MGR_PROFILE
 	gettimeofday(&before, NULL);
 #endif
-	pm->sweep_state = PERFMGR_SWEEP_ACTIVE;
 	/* With the global lock held, collect the node guids */
 	/* FIXME we should be able to track SA notices
 	 * and not have to sweep the node_guid_tbl each pass
@@ -848,7 +1051,7 @@ void osm_perfmgr_process(osm_perfmgr_t * pm)
 	/* clean out any nodes found to be removed during the sweep */
 	remove_marked_nodes(pm);
 
-#if ENABLE_OSM_PERF_MGR_PROFILE
+#ifdef ENABLE_OSM_PERF_MGR_PROFILE
 	/* spin on outstanding queries */
 	while (pm->outstanding_queries > 0)
 		cl_event_wait_on(&pm->sig_sweep, 1000, TRUE);
@@ -865,12 +1068,14 @@ void osm_perfmgr_process(osm_perfmgr_t * pm)
 	clear_mad_stats();
 #endif
 
+	cl_spinlock_acquire(&pm->lock);
 	pm->sweep_state = PERFMGR_SWEEP_SLEEP;
+	cl_spinlock_release(&pm->lock);
 }
 
 /**********************************************************************
  * PerfMgr timer - loop continuously and signal SM to run PerfMgr
- * processor if enabled.
+ * processor if enabled
  **********************************************************************/
 static void perfmgr_sweep(void *arg)
 {
@@ -900,7 +1105,7 @@ void osm_perfmgr_destroy(osm_perfmgr_t * pm)
 /**********************************************************************
  * Detect if someone else on the network could have cleared the counters
  * without us knowing.  This is easy to detect because the counters never
- * wrap but are "sticky"
+ * wrap but are "sticky".
  *
  * The one time this will not work is if the port is getting errors fast
  * enough to have the reading overtake the previous reading.  In this case,
@@ -908,11 +1113,9 @@ void osm_perfmgr_destroy(osm_perfmgr_t * pm)
  **********************************************************************/
 static void perfmgr_check_oob_clear(osm_perfmgr_t * pm,
 				    monitored_node_t * mon_node, uint8_t port,
-				    perfmgr_db_err_reading_t * cr,
-				    perfmgr_db_data_cnt_reading_t * dc)
+				    perfmgr_db_err_reading_t * cr)
 {
 	perfmgr_db_err_reading_t prev_err;
-	perfmgr_db_data_cnt_reading_t prev_dc;
 
 	if (perfmgr_db_get_prev_err(pm->db, mon_node->guid, port, &prev_err)
 	    != PERFMGR_EVENT_DB_SUCCESS) {
@@ -922,6 +1125,35 @@ static void perfmgr_check_oob_clear(osm_perfmgr_t * pm,
 		return;
 	}
 
+	OSM_LOG(pm->log, OSM_LOG_DEBUG,
+		"Errors vs previous node %s (0x%" PRIx64 ") port %u\n"
+		"SE:   %"PRIu64" ?< %"PRIu64"\n"
+		"LE:   %"PRIu64" ?< %"PRIu64"\n"
+		"LD:   %"PRIu64" ?< %"PRIu64"\n"
+		"RE:   %"PRIu64" ?< %"PRIu64"\n"
+		"RPE:  %"PRIu64" ?< %"PRIu64"\n"
+		"SRE:  %"PRIu64" ?< %"PRIu64"\n"
+		"XD:   %"PRIu64" ?< %"PRIu64"\n"
+		"XCE:  %"PRIu64" ?< %"PRIu64"\n"
+		"RCE:  %"PRIu64" ?< %"PRIu64"\n"
+		"LI:   %"PRIu64" ?< %"PRIu64"\n"
+		"BO:   %"PRIu64" ?< %"PRIu64"\n"
+		"VL15: %"PRIu64" ?< %"PRIu64"\n"
+		,
+		mon_node->name, mon_node->guid, port,
+		cr->symbol_err_cnt, prev_err.symbol_err_cnt,
+		cr->link_err_recover, prev_err.link_err_recover,
+		cr->link_downed, prev_err.link_downed,
+		cr->rcv_err, prev_err.rcv_err,
+		cr->rcv_rem_phys_err, prev_err.rcv_rem_phys_err,
+		cr->rcv_switch_relay_err, prev_err.rcv_switch_relay_err,
+		cr->xmit_discards, prev_err.xmit_discards,
+		cr->xmit_constraint_err, prev_err.xmit_constraint_err,
+		cr->rcv_constraint_err, prev_err.rcv_constraint_err,
+		cr->link_integrity, prev_err.link_integrity,
+		cr->buffer_overrun, prev_err.buffer_overrun,
+		cr->vl15_dropped, prev_err.vl15_dropped);
+
 	if (cr->symbol_err_cnt < prev_err.symbol_err_cnt ||
 	    cr->link_err_recover < prev_err.link_err_recover ||
 	    cr->link_downed < prev_err.link_downed ||
@@ -940,31 +1172,11 @@ static void perfmgr_check_oob_clear(osm_perfmgr_t * pm,
 			mon_node->name, mon_node->guid, port);
 		perfmgr_db_clear_prev_err(pm->db, mon_node->guid, port);
 	}
-
-	/* FIXME handle extended counters */
-	if (perfmgr_db_get_prev_dc(pm->db, mon_node->guid, port, &prev_dc)
-	    != PERFMGR_EVENT_DB_SUCCESS) {
-		OSM_LOG(pm->log, OSM_LOG_VERBOSE,
-			"Failed to find previous data count "
-			"reading for %s (0x%" PRIx64 ") port %u\n",
-			mon_node->name, mon_node->guid, port);
-		return;
-	}
-
-	if (dc->xmit_data < prev_dc.xmit_data ||
-	    dc->rcv_data < prev_dc.rcv_data ||
-	    dc->xmit_pkts < prev_dc.xmit_pkts ||
-	    dc->rcv_pkts < prev_dc.rcv_pkts) {
-		OSM_LOG(pm->log, OSM_LOG_ERROR,
-			"PerfMgr: ERR 540B: Detected an out of band data counter "
-			"clear on node %s (0x%" PRIx64 ") port %u\n",
-			mon_node->name, mon_node->guid, port);
-		perfmgr_db_clear_prev_dc(pm->db, mon_node->guid, port);
-	}
 }
 
 /**********************************************************************
  * Return 1 if the value is "close" to overflowing
+ * "close" is defined at 25% for now
  **********************************************************************/
 static int counter_overflow_4(uint8_t val)
 {
@@ -986,9 +1198,14 @@ static int counter_overflow_32(ib_net32_t val)
 	return (cl_ntoh32(val) >= (UINT32_MAX - (UINT32_MAX / 4)));
 }
 
+static int counter_overflow_64(ib_net64_t val)
+{
+	return (cl_ntoh64(val) >= (UINT64_MAX - (UINT64_MAX / 4)));
+}
+
 /**********************************************************************
  * Check if the port counters have overflowed and if so issue a clear
- * MAD to the port.
+ * MAD to the port
  **********************************************************************/
 static void perfmgr_check_overflow(osm_perfmgr_t * pm,
 				   monitored_node_t * mon_node, int16_t pkey_ix,
@@ -997,6 +1214,7 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
 	osm_madw_context_t mad_context;
 	ib_api_status_t status;
 	ib_net32_t remote_qp;
+	uint16_t counter_select;
 
 	OSM_LOG_ENTER(pm->log);
 
@@ -1012,10 +1230,11 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
 	    counter_overflow_4(PC_LINK_INT(pc->link_int_buffer_overrun)) ||
 	    counter_overflow_4(PC_BUF_OVERRUN(pc->link_int_buffer_overrun)) ||
 	    counter_overflow_16(pc->vl15_dropped) ||
-	    counter_overflow_32(pc->xmit_data) ||
-	    counter_overflow_32(pc->rcv_data) ||
-	    counter_overflow_32(pc->xmit_pkts) ||
-	    counter_overflow_32(pc->rcv_pkts)) {
+	    (!pce_supported(mon_node, port) &&
+	    (counter_overflow_32(pc->xmit_data) ||
+	     counter_overflow_32(pc->rcv_data) ||
+	     counter_overflow_32(pc->xmit_pkts) ||
+	     counter_overflow_32(pc->rcv_pkts)))) {
 		osm_node_t *p_node = NULL;
 		ib_net16_t lid = 0;
 
@@ -1045,10 +1264,22 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
 		mad_context.perfmgr_context.node_guid = mon_node->guid;
 		mad_context.perfmgr_context.port = port;
 		mad_context.perfmgr_context.mad_method = IB_MAD_METHOD_SET;
-		/* clear port counters */
+
+		/* apparently some HW uses the same counters for the 32 and 64
+		 * bit versions and a clear of them in the PortCounters
+		 * attribute also clears the ExtendedPortCounters equivalant
+		 * counters
+		 */
+		if (pce_supported(mon_node, port))
+			counter_select = 0x0fff;
+		else
+			counter_select = 0xffff;
+
 		status = perfmgr_send_pc_mad(pm, lid, remote_qp, pkey_ix,
 					     port, IB_MAD_METHOD_SET,
-					     &mad_context);
+					     counter_select,
+					     &mad_context,
+					     0); /* FIXME SL != 0 */
 		if (status != IB_SUCCESS)
 			OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 5411: "
 				"Failed to send clear counters MAD for %s (0x%"
@@ -1056,6 +1287,79 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
 				mon_node->name, mon_node->guid, port);
 
 		perfmgr_db_clear_prev_err(pm->db, mon_node->guid, port);
+		if (!pce_supported(mon_node, port))
+			perfmgr_db_clear_prev_dc(pm->db, mon_node->guid, port);
+	}
+
+Exit:
+	OSM_LOG_EXIT(pm->log);
+}
+
+/**********************************************************************
+ * Check if the port counters have overflowed and if so issue a clear
+ * MAD to the port
+ **********************************************************************/
+static void perfmgr_check_pce_overflow(osm_perfmgr_t * pm,
+				       monitored_node_t * mon_node,
+				       int16_t pkey_ix,
+				       uint8_t port,
+				       ib_port_counters_ext_t * pc)
+{
+	osm_madw_context_t mad_context;
+	ib_api_status_t status;
+	ib_net32_t remote_qp;
+
+	OSM_LOG_ENTER(pm->log);
+
+	if (counter_overflow_64(pc->xmit_data) ||
+	    counter_overflow_64(pc->rcv_data) ||
+	    counter_overflow_64(pc->xmit_pkts) ||
+	    counter_overflow_64(pc->rcv_pkts) ||
+	    (ietf_supported(mon_node, port) &&
+	    (counter_overflow_64(pc->unicast_xmit_pkts) ||
+	    counter_overflow_64(pc->unicast_rcv_pkts) ||
+	    counter_overflow_64(pc->multicast_xmit_pkts) ||
+	    counter_overflow_64(pc->multicast_rcv_pkts)))) {
+		osm_node_t *p_node = NULL;
+		ib_net16_t lid = 0;
+
+		if (!mon_node->port[port].valid)
+			goto Exit;
+
+		osm_log(pm->log, OSM_LOG_VERBOSE,
+			"PerfMgr: PortCountersExtended overflow: %s (0x%"
+			PRIx64 ") port %d; clearing counters\n",
+			mon_node->name, mon_node->guid, port);
+
+		cl_plock_acquire(&pm->osm->lock);
+		p_node =
+		    osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+		lid = get_lid(p_node, port, mon_node);
+		cl_plock_release(&pm->osm->lock);
+		if (lid == 0) {
+			OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 5418: "
+				"Failed to clear counters for %s (0x%"
+				PRIx64 ") port %d; failed to get lid\n",
+				mon_node->name, mon_node->guid, port);
+			goto Exit;
+		}
+
+		remote_qp = get_qp(NULL, port);
+
+		mad_context.perfmgr_context.node_guid = mon_node->guid;
+		mad_context.perfmgr_context.port = port;
+		mad_context.perfmgr_context.mad_method = IB_MAD_METHOD_SET;
+		/* clear port counters */
+		status = perfmgr_send_pce_mad(pm, lid, remote_qp, pkey_ix,
+					      port, IB_MAD_METHOD_SET,
+					      &mad_context,
+					      0); /* FIXME SL != 0 */
+		if (status != IB_SUCCESS)
+			OSM_LOG(pm->log, OSM_LOG_ERROR, "PerfMgr: ERR 5419: "
+				"Failed to send clear counters MAD for %s (0x%"
+				PRIx64 ") port %d\n",
+				mon_node->name, mon_node->guid, port);
+
 		perfmgr_db_clear_prev_dc(pm->db, mon_node->guid, port);
 	}
 
@@ -1162,17 +1466,196 @@ Exit:
 	return pkey_ix;
 }
 
+static boolean_t handle_redirect(osm_perfmgr_t *pm,
+			    ib_class_port_info_t *cpi,
+			    monitored_node_t *p_mon_node,
+			    uint8_t port,
+			    osm_madw_context_t *mad_context)
+{
+	char gid_str[INET6_ADDRSTRLEN];
+	ib_api_status_t status;
+	boolean_t valid = TRUE;
+	int16_t pkey_ix = 0;
+	uint8_t mad_method;
+
+	OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+		"Redirection to LID %u GID %s QP 0x%x received\n",
+		cl_ntoh16(cpi->redir_lid),
+		inet_ntop(AF_INET6, cpi->redir_gid.raw, gid_str,
+			  sizeof gid_str), cl_ntoh32(cpi->redir_qp));
+
+	if (!pm->subn->opt.perfmgr_redir) {
+		OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+			"Redirection requested but disabled\n");
+		valid = FALSE;
+	}
+
+	/* valid redirection ? */
+	if (cpi->redir_lid == 0) {
+		if (!ib_gid_is_notzero(&cpi->redir_gid)) {
+			OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+				"Invalid redirection "
+				"(both redirect LID and GID are zero)\n");
+			valid = FALSE;
+		}
+	}
+	if (cpi->redir_qp == 0) {
+		OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Invalid RedirectQP\n");
+		valid = FALSE;
+	}
+	if (cpi->redir_pkey == 0) {
+		OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Invalid RedirectP_Key\n");
+		valid = FALSE;
+	}
+	if (cpi->redir_qkey != IB_QP1_WELL_KNOWN_Q_KEY) {
+		OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Invalid RedirectQ_Key\n");
+		valid = FALSE;
+	}
+
+	pkey_ix = validate_redir_pkey(pm, cpi->redir_pkey);
+	if (pkey_ix == -1) {
+		OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+			"Index for Pkey 0x%x not found\n",
+			cl_ntoh16(cpi->redir_pkey));
+		valid = FALSE;
+	}
+
+	if (cpi->redir_lid == 0) {
+		/* GID redirection: get PathRecord information */
+		OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+			"GID redirection not currently supported\n");
+		goto Exit;
+	}
+
+	if (!valid)
+		goto Exit;
+
+	/* LID redirection support (easier than GID redirection) */
+	cl_plock_acquire(&pm->osm->lock);
+	p_mon_node->port[port].redirection = TRUE;
+	p_mon_node->port[port].valid = valid;
+	memcpy(&p_mon_node->port[port].gid, &cpi->redir_gid,
+	       sizeof(ib_gid_t));
+	p_mon_node->port[port].lid = cpi->redir_lid;
+	p_mon_node->port[port].qp = cpi->redir_qp;
+	p_mon_node->port[port].pkey = cpi->redir_pkey;
+	if (pkey_ix != -1)
+		p_mon_node->port[port].pkey_ix = pkey_ix;
+	cl_plock_release(&pm->osm->lock);
+
+	/* either */
+	if (pm->query_cpi)
+	{
+		/* issue a CPI query to the redirected location */
+		mad_method = IB_MAD_METHOD_GET;
+		p_mon_node->port[port].cpi_valid = FALSE;
+		status = perfmgr_send_cpi_mad(pm, cpi->redir_lid,
+						cpi->redir_qp, pkey_ix,
+						port, mad_context,
+						0); /* FIXME SL != 0 */
+	} else {
+		/* reissue the original query to the redirected location */
+		mad_method = mad_context->perfmgr_context.mad_method;
+		if (mad_context->perfmgr_context.mad_attr_id
+		    == IB_MAD_ATTR_PORT_CNTRS) {
+			status = perfmgr_send_pc_mad(pm, cpi->redir_lid, cpi->redir_qp,
+						     pkey_ix, port,
+						     mad_method,
+						     0xffff,
+						     mad_context,
+						     0); /* FIXME SL != 0 */
+		} else {
+			status = perfmgr_send_pce_mad(pm, cpi->redir_lid,
+						      cpi->redir_qp,
+						      pkey_ix, port,
+						      mad_method,
+						      mad_context,
+						      0); /* FIXME SL != 0 */
+		}
+	}
+	if (status != IB_SUCCESS)
+		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5414: "
+			"Failed to send redirected MAD "
+			"with method 0x%x for node %s "
+			"(NodeGuid 0x%" PRIx64 ") port %d\n",
+			mad_method, p_mon_node->name, p_mon_node->guid, port);
+Exit:
+	return (valid);
+}
+
+/**********************************************************************
+ * Detect if someone else on the network could have cleared the counters
+ * without us knowing.  This is easy to detect because the counters never
+ * wrap but are "sticky" PortCountersExtended version.
+ *
+ * The one time this will not work is if the port is getting errors fast
+ * enough to have the reading overtake the previous reading.  In this case,
+ * counters will be missed.
+ **********************************************************************/
+static void perfmgr_check_data_cnt_oob_clear(osm_perfmgr_t * pm,
+					monitored_node_t * mon_node,
+					uint8_t port,
+					perfmgr_db_data_cnt_reading_t * dc)
+{
+	perfmgr_db_data_cnt_reading_t prev_dc;
+
+	if (perfmgr_db_get_prev_dc(pm->db, mon_node->guid, port, &prev_dc)
+	    != PERFMGR_EVENT_DB_SUCCESS) {
+		OSM_LOG(pm->log, OSM_LOG_VERBOSE,
+			"Failed to find previous data count "
+			"reading for %s (0x%" PRIx64 ") port %u\n",
+			mon_node->name, mon_node->guid, port);
+		return;
+	}
+
+	OSM_LOG(pm->log, OSM_LOG_DEBUG,
+		"Data vs previous node %s (0x%" PRIx64 ") port %u\n"
+		"TX:    %"PRIu64" ?< %"PRIu64"\n"
+		"RX:    %"PRIu64" ?< %"PRIu64"\n"
+		"TXP:   %"PRIu64" ?< %"PRIu64"\n"
+		"RXP:   %"PRIu64" ?< %"PRIu64"\n"
+		"UTXP:  %"PRIu64" ?< %"PRIu64"\n"
+		"URXP:  %"PRIu64" ?< %"PRIu64"\n"
+		"MTXP:  %"PRIu64" ?< %"PRIu64"\n"
+		"MRXP:  %"PRIu64" ?< %"PRIu64"\n"
+		,
+		mon_node->name, mon_node->guid, port,
+		dc->xmit_data, prev_dc.xmit_data,
+		dc->rcv_data, prev_dc.rcv_data,
+		dc->xmit_pkts, prev_dc.xmit_pkts,
+		dc->rcv_pkts, prev_dc.rcv_pkts,
+		dc->unicast_xmit_pkts, prev_dc.unicast_xmit_pkts,
+		dc->unicast_rcv_pkts, prev_dc.unicast_rcv_pkts,
+		dc->multicast_xmit_pkts, prev_dc.multicast_xmit_pkts,
+		dc->multicast_rcv_pkts, prev_dc.multicast_rcv_pkts);
+
+	if (dc->xmit_data < prev_dc.xmit_data ||
+	    dc->rcv_data < prev_dc.rcv_data ||
+	    dc->xmit_pkts < prev_dc.xmit_pkts ||
+	    dc->rcv_pkts < prev_dc.rcv_pkts ||
+	    (ietf_supported(mon_node, port) &&
+	    (dc->unicast_xmit_pkts < prev_dc.unicast_xmit_pkts ||
+	    dc->unicast_rcv_pkts < prev_dc.unicast_rcv_pkts ||
+	    dc->multicast_xmit_pkts < prev_dc.multicast_xmit_pkts ||
+	    dc->multicast_rcv_pkts < prev_dc.multicast_rcv_pkts))) {
+		OSM_LOG(pm->log, OSM_LOG_ERROR,
+			"PerfMgr: ERR 540B: Detected an out of band data counter "
+			"clear on node %s (0x%" PRIx64 ") port %u\n",
+			mon_node->name, mon_node->guid, port);
+
+		perfmgr_db_clear_prev_dc(pm->db, mon_node->guid, port);
+	}
+}
+
 /**********************************************************************
  * The dispatcher uses a thread pool which will call this function when
- * there is a thread available to process the mad received on the wire.
+ * there is a thread available to process the mad received on the wire
  **********************************************************************/
 static void pc_recv_process(void *context, void *data)
 {
 	osm_perfmgr_t *pm = context;
 	osm_madw_t *p_madw = data;
 	osm_madw_context_t *mad_context = &p_madw->context;
-	ib_port_counters_t *wire_read =
-	    (ib_port_counters_t *) & osm_madw_get_perfmgt_mad_ptr(p_madw)->data;
 	ib_mad_t *p_mad = osm_madw_get_mad_ptr(p_madw);
 	uint64_t node_guid = mad_context->perfmgr_context.node_guid;
 	uint8_t port = mad_context->perfmgr_context.port;
@@ -1180,8 +1663,7 @@ static void pc_recv_process(void *context, void *data)
 	perfmgr_db_data_cnt_reading_t data_reading;
 	cl_map_item_t *p_node;
 	monitored_node_t *p_mon_node;
-	int16_t pkey_ix = 0;
-	boolean_t valid = TRUE;
+	ib_class_port_info_t *cpi = NULL;
 
 	OSM_LOG_ENTER(pm->log);
 
@@ -1202,133 +1684,118 @@ static void pc_recv_process(void *context, void *data)
 		PRIx64 " port %u\n", p_mad->status, node_guid, port);
 
 	CL_ASSERT(p_mad->attr_id == IB_MAD_ATTR_PORT_CNTRS ||
+		  p_mad->attr_id == IB_MAD_ATTR_PORT_CNTRS_EXT ||
 		  p_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO);
 
-	/* Response could also be redirection (IBM eHCA PMA does this) */
-	if (p_mad->status & IB_MAD_STATUS_REDIRECT &&
-	    p_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO) {
-		char gid_str[INET6_ADDRSTRLEN];
-		ib_class_port_info_t *cpi =
-		    (ib_class_port_info_t *) &
-		    (osm_madw_get_perfmgt_mad_ptr(p_madw)->data);
-		ib_api_status_t status;
+	cl_plock_acquire(&pm->osm->lock);
+	/* validate port number */
+	if (port >= p_mon_node->num_ports) {
+		cl_plock_release(&pm->osm->lock);
+		OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5413: "
+			"Invalid port num %d for GUID 0x%016"
+			PRIx64 " num ports %d\n", port, node_guid,
+			p_mon_node->num_ports);
+		goto Exit;
+	}
+	cl_plock_release(&pm->osm->lock);
 
-		OSM_LOG(pm->log, OSM_LOG_VERBOSE,
-			"Redirection to LID %u GID %s QP 0x%x received\n",
-			cl_ntoh16(cpi->redir_lid),
-			inet_ntop(AF_INET6, cpi->redir_gid.raw, gid_str,
-				  sizeof gid_str), cl_ntoh32(cpi->redir_qp));
+	/* capture CLASS_PORT_INFO data */
+	if (p_mad->attr_id == IB_MAD_ATTR_CLASS_PORT_INFO) {
+		boolean_t cpi_valid = TRUE;
 
-		if (!pm->subn->opt.perfmgr_redir) {
-			OSM_LOG(pm->log, OSM_LOG_VERBOSE,
-				"Redirection requested but disabled\n");
-			valid = FALSE;
-		}
+		cpi = (ib_class_port_info_t *) &
+		    (osm_madw_get_perfmgt_mad_ptr(p_madw)->data);
 
-		/* valid redirection ? */
-		if (cpi->redir_lid == 0) {
-			if (!ib_gid_is_notzero(&cpi->redir_gid)) {
-				OSM_LOG(pm->log, OSM_LOG_VERBOSE,
-					"Invalid redirection "
-					"(both redirect LID and GID are zero)\n");
-				valid = FALSE;
+		/* Response could be redirection (IBM eHCA PMA does this) */
+		if (p_mad->status & IB_MAD_STATUS_REDIRECT)
+			cpi_valid = handle_redirect(pm, cpi, p_mon_node, port,
+							mad_context);
+
+		if (pm->query_cpi && cpi_valid) {
+			cl_plock_acquire(&pm->osm->lock);
+			if (p_mon_node->node_type == IB_NODE_TYPE_SWITCH) {
+				int i = 0;
+				for (i = p_mon_node->esp0 ? 0 : 1;
+				     i < p_mon_node->num_ports;
+				     i++) {
+					p_mon_node->port[i].cap_mask = cpi->cap_mask;
+					p_mon_node->port[i].cpi_valid = cpi_valid;
+				}
+			} else {
+				p_mon_node->port[port].cap_mask = cpi->cap_mask;
+				p_mon_node->port[port].cpi_valid = cpi_valid;
 			}
+			cl_plock_release(&pm->osm->lock);
 		}
-		if (cpi->redir_qp == 0) {
-			OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Invalid RedirectQP\n");
-			valid = FALSE;
-		}
-		if (cpi->redir_pkey == 0) {
-			OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Invalid RedirectP_Key\n");
-			valid = FALSE;
-		}
-		if (cpi->redir_qkey != IB_QP1_WELL_KNOWN_Q_KEY) {
-			OSM_LOG(pm->log, OSM_LOG_VERBOSE, "Invalid RedirectQ_Key\n");
-			valid = FALSE;
-		}
-
-		pkey_ix = validate_redir_pkey(pm, cpi->redir_pkey);
-		if (pkey_ix == -1) {
-			OSM_LOG(pm->log, OSM_LOG_VERBOSE,
-				"Index for Pkey 0x%x not found\n",
-				cl_ntoh16(cpi->redir_pkey));
-			valid = FALSE;
-		}
+		goto Exit;
+	}
 
-		if (cpi->redir_lid == 0) {
-			/* GID redirection: get PathRecord information */
-			OSM_LOG(pm->log, OSM_LOG_VERBOSE,
-				"GID redirection not currently supported\n");
-			goto Exit;
+	if (p_mad->attr_id == IB_MAD_ATTR_PORT_CNTRS_EXT) {
+		ib_port_counters_ext_t *ext_wire_read =
+				(ib_port_counters_ext_t *)
+				&osm_madw_get_perfmgt_mad_ptr(p_madw)->data;
+
+		/* convert wire data to perfmgr data counter reading */
+		perfmgr_db_fill_data_cnt_read_pce(ext_wire_read, &data_reading,
+						  ietf_supported(p_mon_node,
+								 port));
+
+		/* add counter */
+		if (mad_context->perfmgr_context.mad_method
+		    == IB_MAD_METHOD_GET) {
+			/* detect an out of band clear on the port */
+			perfmgr_check_data_cnt_oob_clear(pm, p_mon_node, port,
+						    &data_reading);
+
+			perfmgr_db_add_dc_reading(pm->db, node_guid, port,
+						  &data_reading,
+						  ietf_supported(p_mon_node,
+								 port));
+		} else {
+			perfmgr_db_clear_prev_dc(pm->db, node_guid, port);
 		}
 
-		/* LID redirection support (easier than GID redirection) */
-		cl_plock_acquire(&pm->osm->lock);
-		/* Now, validate port number */
-		if (port >= p_mon_node->num_ports) {
-			cl_plock_release(&pm->osm->lock);
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5413: "
-				"Invalid port num %d for GUID 0x%016"
-				PRIx64 " num ports %d\n", port, node_guid,
-				p_mon_node->num_ports);
-			goto Exit;
+		perfmgr_check_pce_overflow(pm, p_mon_node,
+					   p_mon_node->port[port].pkey_ix,
+					   port, ext_wire_read);
+	} else {
+		boolean_t pce_sup = pce_supported(p_mon_node, port);
+		ib_port_counters_t *wire_read =
+				(ib_port_counters_t *)
+				&osm_madw_get_perfmgt_mad_ptr(p_madw)->data;
+
+		perfmgr_db_fill_err_read(wire_read, &err_reading);
+		if (!pce_sup)
+			perfmgr_db_fill_data_cnt_read_pc(wire_read, &data_reading);
+
+		if (mad_context->perfmgr_context.mad_method == IB_MAD_METHOD_GET) {
+			/* detect an out of band clear on the port */
+			perfmgr_check_oob_clear(pm, p_mon_node, port, &err_reading);
+			if (!pce_sup)
+				perfmgr_check_data_cnt_oob_clear(pm, p_mon_node, port,
+							    &data_reading);
+
+			/* log errors from this reading */
+			if (pm->subn->opt.perfmgr_log_errors)
+				perfmgr_log_errors(pm, p_mon_node, port, &err_reading);
+
+			perfmgr_db_add_err_reading(pm->db, node_guid, port,
+						   &err_reading);
+			if (!pce_sup)
+				perfmgr_db_add_dc_reading(pm->db, node_guid, port,
+							  &data_reading, 0);
+		} else {
+			perfmgr_db_clear_prev_err(pm->db, node_guid, port);
+			if (!pce_sup)
+				perfmgr_db_clear_prev_dc(pm->db, node_guid, port);
 		}
-		p_mon_node->port[port].redirection = TRUE;
-		p_mon_node->port[port].valid = valid;
-		memcpy(&p_mon_node->port[port].gid, &cpi->redir_gid,
-		       sizeof(ib_gid_t));
-		p_mon_node->port[port].lid = cpi->redir_lid;
-		p_mon_node->port[port].qp = cpi->redir_qp;
-		p_mon_node->port[port].pkey = cpi->redir_pkey;
-		if (pkey_ix != -1)
-			p_mon_node->port[port].pkey_ix = pkey_ix;
-		cl_plock_release(&pm->osm->lock);
 
-		if (!valid)
-			goto Exit;
+		perfmgr_check_overflow(pm, p_mon_node, p_mon_node->port[port].pkey_ix,
+				       port, wire_read);
 
-		/* Finally, reissue the query to the redirected location */
-		status = perfmgr_send_pc_mad(pm, cpi->redir_lid, cpi->redir_qp,
-					     pkey_ix, port,
-					     mad_context->perfmgr_context.
-					     mad_method, mad_context);
-		if (status != IB_SUCCESS)
-			OSM_LOG(pm->log, OSM_LOG_ERROR, "ERR 5414: "
-				"Failed to send redirected MAD with method 0x%x for node 0x%"
-				PRIx64 " port %d\n",
-				mad_context->perfmgr_context.mad_method,
-				node_guid, port);
-		goto Exit;
 	}
 
-	perfmgr_db_fill_err_read(wire_read, &err_reading);
-	/* FIXME separate query for extended counters if they are supported
-	 * on the port.
-	 */
-	perfmgr_db_fill_data_cnt_read_pc(wire_read, &data_reading);
-
-	/* detect an out of band clear on the port */
-	if (mad_context->perfmgr_context.mad_method != IB_MAD_METHOD_SET)
-		perfmgr_check_oob_clear(pm, p_mon_node, port, &err_reading,
-					&data_reading);
-
-	if (mad_context->perfmgr_context.mad_method == IB_MAD_METHOD_GET) {
-		/* log errors from this reading */
-		if (pm->subn->opt.perfmgr_log_errors)
-			perfmgr_log_errors(pm, p_mon_node, port, &err_reading);
-
-		perfmgr_db_add_err_reading(pm->db, node_guid, port,
-					   &err_reading);
-		perfmgr_db_add_dc_reading(pm->db, node_guid, port,
-					  &data_reading);
-	} else {
-		perfmgr_db_clear_prev_err(pm->db, node_guid, port);
-		perfmgr_db_clear_prev_dc(pm->db, node_guid, port);
-	}
-
-	perfmgr_check_overflow(pm, p_mon_node, pkey_ix, port, wire_read);
-
-#if ENABLE_OSM_PERF_MGR_PROFILE
+#ifdef ENABLE_OSM_PERF_MGR_PROFILE
 	do {
 		struct timeval proc_time;
 		gettimeofday(&proc_time, NULL);
@@ -1368,6 +1835,8 @@ ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * pm, osm_opensm_t * osm,
 	pm->trans_id = PERFMGR_INITIAL_TID_VALUE;
 	pm->state =
 	    p_opt->perfmgr ? PERFMGR_STATE_ENABLED : PERFMGR_STATE_DISABLE;
+	pm->sweep_state = PERFMGR_SWEEP_SLEEP;
+	cl_spinlock_init(&pm->lock);
 	pm->sweep_time_s = p_opt->perfmgr_sweep_time_s;
 	pm->max_outstanding_queries = p_opt->perfmgr_max_outstanding_queries;
 	pm->ignore_cas = p_opt->perfmgr_ignore_cas;
@@ -1398,6 +1867,7 @@ ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * pm, osm_opensm_t * osm,
 		cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000);
 
 	pm->rm_nodes = p_opt->perfmgr_rm_nodes;
+	pm->query_cpi = p_opt->perfmgr_query_cpi;
 	status = IB_SUCCESS;
 Exit:
 	OSM_LOG_EXIT(pm->log);
@@ -1454,4 +1924,11 @@ void osm_perfmgr_print_counters(osm_perfmgr_t * pm, char *nodename, FILE * fp,
 	} else
 		perfmgr_db_print_all(pm->db, fp, err_only);
 }
+
+void osm_perfmgr_update_nodename(osm_perfmgr_t *pm, uint64_t node_guid,
+				char *nodename)
+{
+	if (pm->db)
+		perfmgr_db_update_name(pm->db, node_guid, nodename);
+}
 #endif				/* ENABLE_OSM_PERF_MGR */
diff --git a/opensm/osm_perfmgr_db.c b/opensm/osm_perfmgr_db.c
index 98b587d..92e1a39 100644
--- a/opensm/osm_perfmgr_db.c
+++ b/opensm/osm_perfmgr_db.c
@@ -197,6 +197,19 @@ Exit:
 }
 
 perfmgr_db_err_t
+perfmgr_db_update_name(perfmgr_db_t * db, uint64_t node_guid, char *name)
+{
+	db_node_t *node = NULL;
+
+	cl_plock_excl_acquire(&db->lock);
+	node = get(db, node_guid);
+	if (node)
+		snprintf(node->node_name, sizeof(node->node_name), "%s", name);
+	cl_plock_release(&db->lock);
+	return (PERFMGR_EVENT_DB_SUCCESS);
+}
+
+perfmgr_db_err_t
 perfmgr_db_delete_entry(perfmgr_db_t * db, uint64_t guid)
 {
 	cl_map_item_t * rc = cl_qmap_remove(&db->pc_data, guid);
@@ -400,6 +413,9 @@ perfmgr_db_add_err_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,
 
 	p_port->err_previous = *reading;
 
+	/* mark the time this total was updated */
+	p_port->err_total.time = reading->time;
+
 	osm_opensm_report_event(db->perfmgr->osm, OSM_EVENT_ID_PORT_ERRORS,
 				&epi_pe_data);
 
@@ -479,7 +495,8 @@ debug_dump_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port_num,
  **********************************************************************/
 perfmgr_db_err_t
 perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,
-			  perfmgr_db_data_cnt_reading_t * reading)
+			  perfmgr_db_data_cnt_reading_t * reading,
+			  int ietf_sup)
 {
 	db_port_t *p_port = NULL;
 	db_node_t *node = NULL;
@@ -512,21 +529,28 @@ perfmgr_db_add_dc_reading(perfmgr_db_t * db, uint64_t guid, uint8_t port,
 	p_port->dc_total.xmit_pkts += epi_dc_data.xmit_pkts;
 	epi_dc_data.rcv_pkts = reading->rcv_pkts - previous->rcv_pkts;
 	p_port->dc_total.rcv_pkts += epi_dc_data.rcv_pkts;
-	epi_dc_data.unicast_xmit_pkts =
-	    reading->unicast_xmit_pkts - previous->unicast_xmit_pkts;
-	p_port->dc_total.unicast_xmit_pkts += epi_dc_data.unicast_xmit_pkts;
-	epi_dc_data.unicast_rcv_pkts =
-	    reading->unicast_rcv_pkts - previous->unicast_rcv_pkts;
-	p_port->dc_total.unicast_rcv_pkts += epi_dc_data.unicast_rcv_pkts;
-	epi_dc_data.multicast_xmit_pkts =
-	    reading->multicast_xmit_pkts - previous->multicast_xmit_pkts;
-	p_port->dc_total.multicast_xmit_pkts += epi_dc_data.multicast_xmit_pkts;
-	epi_dc_data.multicast_rcv_pkts =
-	    reading->multicast_rcv_pkts - previous->multicast_rcv_pkts;
-	p_port->dc_total.multicast_rcv_pkts += epi_dc_data.multicast_rcv_pkts;
+
+	if (ietf_sup)
+	{
+		epi_dc_data.unicast_xmit_pkts =
+		    reading->unicast_xmit_pkts - previous->unicast_xmit_pkts;
+		p_port->dc_total.unicast_xmit_pkts += epi_dc_data.unicast_xmit_pkts;
+		epi_dc_data.unicast_rcv_pkts =
+		    reading->unicast_rcv_pkts - previous->unicast_rcv_pkts;
+		p_port->dc_total.unicast_rcv_pkts += epi_dc_data.unicast_rcv_pkts;
+		epi_dc_data.multicast_xmit_pkts =
+		    reading->multicast_xmit_pkts - previous->multicast_xmit_pkts;
+		p_port->dc_total.multicast_xmit_pkts += epi_dc_data.multicast_xmit_pkts;
+		epi_dc_data.multicast_rcv_pkts =
+		    reading->multicast_rcv_pkts - previous->multicast_rcv_pkts;
+		p_port->dc_total.multicast_rcv_pkts += epi_dc_data.multicast_rcv_pkts;
+	}
 
 	p_port->dc_previous = *reading;
 
+	/* mark the time this total was updated */
+	p_port->dc_total.time = reading->time;
+
 	osm_opensm_report_event(db->perfmgr->osm,
 				OSM_EVENT_ID_PORT_DATA_COUNTERS, &epi_dc_data);
 
@@ -634,6 +658,7 @@ static void dump_node_mr(db_node_t * node, FILE * fp)
 	int i = 0;
 
 	fprintf(fp, "\nName\tGUID\tActive\tPort\tLast Reset\t"
+		"Last Error Update\tLast Data Update\t"
 		"%s\t%s\t"
 		"%s\t%s\t%s\t%s\t%s\t%s\t%s\t"
 		"%s\t%s\t%s\t%s\t%s\t%s\t%s\t"
@@ -659,15 +684,22 @@ static void dump_node_mr(db_node_t * node, FILE * fp)
 		"multicast_xmit_pkts",
 		"multicast_rcv_pkts");
 	for (i = (node->esp0) ? 0 : 1; i < node->num_ports; i++) {
-		char *since = ctime(&node->ports[i].last_reset);
+		char lr[128];
+		char *last_reset = ctime_r(&node->ports[i].last_reset, lr);
+		char leu[128];
+		char *last_err_update = ctime_r(&node->ports[i].err_total.time, leu);
+		char ldu[128];
+		char *last_data_update = ctime_r(&node->ports[i].dc_total.time, ldu);
 
 		if (!node->ports[i].valid)
 			continue;
 
-		since[strlen(since) - 1] = '\0';	/* remove \n */
+		last_reset[strlen(last_reset) - 1] = '\0';	/* remove \n */
+		last_err_update[strlen(last_err_update) - 1] = '\0';	/* remove \n */
+		last_data_update[strlen(last_data_update) - 1] = '\0';	/* remove \n */
 
 		fprintf(fp,
-			"%s\t0x%" PRIx64 "\t%s\t%d\t%s\t%" PRIu64 "\t%" PRIu64 "\t"
+			"%s\t0x%" PRIx64 "\t%s\t%d\t%s\t%s\t%s\t%" PRIu64 "\t%" PRIu64 "\t"
 			"%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t"
 			"%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64
 			"\t%" PRIu64 "\t%" PRIu64 "\t" "%" PRIu64 "\t%" PRIu64
@@ -675,7 +707,7 @@ static void dump_node_mr(db_node_t * node, FILE * fp)
 			"\t%" PRIu64 "\t%" PRIu64 "\n", node->node_name,
 			node->node_guid,
 			node->active ? "TRUE" : "FALSE",
-			i, since,
+			i, last_reset, last_err_update, last_data_update,
 			node->ports[i].err_total.symbol_err_cnt,
 			node->ports[i].err_total.link_err_recover,
 			node->ports[i].err_total.link_downed,
@@ -701,11 +733,11 @@ static void dump_node_mr(db_node_t * node, FILE * fp)
 
 static void dump_hr_dc(FILE *fp, uint64_t val64, int data)
 {
-	char *unit = "";
+	const char *unit = "";
 	uint64_t tmp = val64;
 	float val = 0.0;
 	int ui = 0;
-	int div = 1;
+	uint64_t div = 1;
 
 	tmp /= 1024;
 	while (tmp) {
@@ -767,12 +799,20 @@ static void dump_node_hr(db_node_t * node, FILE * fp, char *port, int err_only)
 		}
 	}
 	for (/* set above */; i < num_ports; i++) {
-		char *since = ctime(&node->ports[i].last_reset);
+		char lr[128];
+		char *last_reset = ctime_r(&node->ports[i].last_reset, lr);
+		char leu[128];
+		char *last_err_update = ctime_r(&node->ports[i].err_total.time, leu);
+		char ldu[128];
+		char *last_data_update = ctime_r(&node->ports[i].dc_total.time, ldu);
 
 		if (!node->ports[i].valid)
 			continue;
 
-		since[strlen(since) - 1] = '\0';	/* remove \n */
+		last_reset[strlen(last_reset) - 1] = '\0';	/* remove \n */
+		last_err_update[strlen(last_err_update) - 1] = '\0';	/* remove \n */
+		last_data_update[strlen(last_data_update) - 1] = '\0';	/* remove \n */
+
 		perfmgr_db_err_reading_t *err = &node->ports[i].err_total;
 
 		if (err_only
@@ -790,9 +830,12 @@ static void dump_node_hr(db_node_t * node, FILE * fp, char *port, int err_only)
 		    && err->vl15_dropped == 0)
 			continue;
 
-		fprintf(fp, "\"%s\" 0x%" PRIx64 " active %s port %d (Since %s)\n",
+		fprintf(fp, "\"%s\" 0x%" PRIx64 " active %s port %d\n"
+				    "     Last Reset           : %s\n"
+				    "     Last Error Update    : %s\n",
 			node->node_name, node->node_guid,
-			node->active ? "TRUE":"FALSE", i, since);
+			node->active ? "TRUE":"FALSE", i, last_reset,
+			last_err_update);
 
 		if (!err_only || err->symbol_err_cnt != 0)
 			fprintf(fp, "     symbol_err_cnt       : %" PRIu64 "\n",
@@ -831,6 +874,11 @@ static void dump_node_hr(db_node_t * node, FILE * fp, char *port, int err_only)
 			fprintf(fp, "     vl15_dropped         : %" PRIu64 "\n",
 				err->vl15_dropped);
 
+		if (err_only)
+			continue;
+
+		fprintf(fp, "     Last Data Update     : %s\n",
+			last_data_update);
 		fprintf(fp, "     xmit_data            : %" PRIu64,
 			node->ports[i].dc_total.xmit_data);
 		dump_hr_dc(fp, node->ports[i].dc_total.xmit_data, 1);
@@ -1010,18 +1058,22 @@ perfmgr_db_fill_data_cnt_read_pc(ib_port_counters_t * wire_read,
 }
 
 void
-perfmgr_db_fill_data_cnt_read_epc(ib_port_counters_ext_t * wire_read,
-				  perfmgr_db_data_cnt_reading_t * reading)
+perfmgr_db_fill_data_cnt_read_pce(ib_port_counters_ext_t * wire_read,
+				  perfmgr_db_data_cnt_reading_t * reading,
+				  int ietf_sup)
 {
 	reading->xmit_data = cl_ntoh64(wire_read->xmit_data);
 	reading->rcv_data = cl_ntoh64(wire_read->rcv_data);
 	reading->xmit_pkts = cl_ntoh64(wire_read->xmit_pkts);
 	reading->rcv_pkts = cl_ntoh64(wire_read->rcv_pkts);
-	reading->unicast_xmit_pkts = cl_ntoh64(wire_read->unicast_xmit_pkts);
-	reading->unicast_rcv_pkts = cl_ntoh64(wire_read->unicast_rcv_pkts);
-	reading->multicast_xmit_pkts =
-	    cl_ntoh64(wire_read->multicast_xmit_pkts);
-	reading->multicast_rcv_pkts = cl_ntoh64(wire_read->multicast_rcv_pkts);
+	if (ietf_sup)
+	{
+		reading->unicast_xmit_pkts = cl_ntoh64(wire_read->unicast_xmit_pkts);
+		reading->unicast_rcv_pkts = cl_ntoh64(wire_read->unicast_rcv_pkts);
+		reading->multicast_xmit_pkts =
+		    cl_ntoh64(wire_read->multicast_xmit_pkts);
+		reading->multicast_rcv_pkts = cl_ntoh64(wire_read->multicast_rcv_pkts);
+	}
 	reading->time = time(NULL);
 }
 #endif				/* ENABLE_OSM_PERF_MGR */
diff --git a/opensm/osm_pkey.c b/opensm/osm_pkey.c
index 1ae9f4e..6b6eefe 100644
--- a/opensm/osm_pkey.c
+++ b/opensm/osm_pkey.c
@@ -58,7 +58,7 @@
 
 void osm_pkey_tbl_construct(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
-	cl_ptr_vector_construct(&p_pkey_tbl->accum_pkeys);
+	cl_map_construct(&p_pkey_tbl->accum_pkeys);
 	cl_ptr_vector_construct(&p_pkey_tbl->blocks);
 	cl_ptr_vector_construct(&p_pkey_tbl->new_blocks);
 	cl_map_construct(&p_pkey_tbl->keys);
@@ -82,7 +82,8 @@ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl)
 			free(p_block);
 	cl_ptr_vector_destroy(&p_pkey_tbl->new_blocks);
 
-	cl_ptr_vector_destroy(&p_pkey_tbl->accum_pkeys);
+	cl_map_remove_all(&p_pkey_tbl->accum_pkeys);
+	cl_map_destroy(&p_pkey_tbl->accum_pkeys);
 
 	cl_map_remove_all(&p_pkey_tbl->keys);
 	cl_map_destroy(&p_pkey_tbl->keys);
@@ -90,7 +91,7 @@ void osm_pkey_tbl_destroy(IN osm_pkey_tbl_t * p_pkey_tbl)
 
 ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
-	cl_ptr_vector_init(&p_pkey_tbl->accum_pkeys, 0, 1);
+	cl_map_init(&p_pkey_tbl->accum_pkeys, 1);
 	cl_ptr_vector_init(&p_pkey_tbl->blocks, 0, 1);
 	cl_ptr_vector_init(&p_pkey_tbl->new_blocks, 0, 1);
 	cl_map_init(&p_pkey_tbl->keys, 1);
@@ -98,6 +99,7 @@ ib_api_status_t osm_pkey_tbl_init(IN osm_pkey_tbl_t * p_pkey_tbl)
 	p_pkey_tbl->last_pkey_idx = 0;
 	p_pkey_tbl->used_blocks = 0;
 	p_pkey_tbl->max_blocks = 0;
+	p_pkey_tbl->rcv_blocks_cnt = 0;
 	return IB_SUCCESS;
 }
 
@@ -192,46 +194,44 @@ cl_status_t osm_pkey_tbl_set_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl,
 					 IN uint16_t pkey_idx)
 {
 	uintptr_t ptr = pkey_idx + 1; /* 0 means not found so bias by 1 */
+	uint16_t *p_prev_pkey_idx;
+	cl_status_t status = CL_SUCCESS;
 
 	if (pkey_idx >= p_pkey_tbl->last_pkey_idx)
 		p_pkey_tbl->last_pkey_idx = pkey_idx + 1;
 
-	return cl_ptr_vector_set(&p_pkey_tbl->accum_pkeys, pkey, (void *)ptr);
+	p_prev_pkey_idx = (uint16_t *) cl_map_get(&p_pkey_tbl->accum_pkeys, pkey);
+
+	if (p_prev_pkey_idx != NULL)
+		cl_map_remove(&p_pkey_tbl->accum_pkeys, pkey);
+
+	if (cl_map_insert(&p_pkey_tbl->accum_pkeys, pkey, (void *) ptr) == NULL)
+		status = CL_INSUFFICIENT_MEMORY;
+
+	return status;
+
 }
 
 /*
-  Clears the given pkey (along with it's overall index) in the accum_pkeys array.
-*/
-void osm_pkey_tbl_clear_accum_pkeys(IN osm_pkey_tbl_t * p_pkey_tbl,
-				    IN uint16_t pkey)
++ * Find the next last pkey index
++*/
+void osm_pkey_find_last_accum_pkey_index(IN osm_pkey_tbl_t * p_pkey_tbl)
 {
 	void *ptr;
 	uintptr_t pkey_idx_ptr;
-	uint16_t pkey_idx, last_pkey_idx;
-	uint32_t i;
-
-	ptr = cl_ptr_vector_get(&p_pkey_tbl->accum_pkeys, pkey);
-	if (ptr == NULL)
-		return;
-
-	cl_ptr_vector_set(&p_pkey_tbl->accum_pkeys, pkey, NULL);
-
-	pkey_idx_ptr = (uintptr_t) ptr;
-	pkey_idx = pkey_idx_ptr;
-
-	if (p_pkey_tbl->last_pkey_idx == pkey_idx) {
-		last_pkey_idx = 0;
-		for (i = 1; i < cl_ptr_vector_get_size(&p_pkey_tbl->accum_pkeys); i++) {
-			ptr = cl_ptr_vector_get(&p_pkey_tbl->accum_pkeys, i);
-			if (ptr != NULL) {
-				pkey_idx_ptr = (uintptr_t) ptr;
-				pkey_idx = pkey_idx_ptr;
-				if (pkey_idx > last_pkey_idx)
-					last_pkey_idx = pkey_idx;
-			}
-		}
-		p_pkey_tbl->last_pkey_idx = last_pkey_idx;
+	uint16_t pkey_idx, last_pkey_idx = 0;
+	cl_map_iterator_t map_iter = cl_map_head(&p_pkey_tbl->accum_pkeys);
+
+	while (map_iter != cl_map_end(&p_pkey_tbl->accum_pkeys)) {
+		ptr = (uint16_t *) cl_map_obj(map_iter);
+		CL_ASSERT(ptr);
+		pkey_idx_ptr = (uintptr_t) ptr;
+		pkey_idx = pkey_idx_ptr;
+		if (pkey_idx > last_pkey_idx)
+			last_pkey_idx = pkey_idx;
+		map_iter = cl_map_next(map_iter);
 	}
+	p_pkey_tbl->last_pkey_idx = last_pkey_idx;
 }
 
 /*
@@ -369,16 +369,10 @@ ib_net16_t osm_physp_find_common_pkey(IN const osm_physp_t * p_physp1,
 	uint64_t pkey1_base, pkey2_base;
 	const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;
 	cl_map_iterator_t map_iter1, map_iter2;
-	ib_net16_t key;
-	const osm_pkey_tbl_t *pkey_tbl;
-	cl_map_iterator_t map_iter, map_end;
 
 	pkey_tbl1 = osm_physp_get_pkey_tbl(p_physp1);
 	pkey_tbl2 = osm_physp_get_pkey_tbl(p_physp2);
 
-	if (allow_both_pkeys)
-		goto SearchByKeys;
-
 	map_iter1 = cl_map_head(&pkey_tbl1->keys);
 	map_iter2 = cl_map_head(&pkey_tbl2->keys);
 
@@ -403,34 +397,81 @@ ib_net16_t osm_physp_find_common_pkey(IN const osm_physp_t * p_physp1,
 			map_iter1 = cl_map_next(map_iter1);
 	}
 
-	return 0;
+	if (!allow_both_pkeys)
+		return 0;
 
-SearchByKeys:
+	/*
+	   When using allow_both_pkeys, the keys in pkey tables are the
+	   pkey value including membership bit.
+	   Therefore, in order to complete the search, we also need to
+	   compare port\s 1 full pkeys with port 2 limited pkeys, and
+	   port 2 full pkeys with port 1 full pkeys.
+	*/
 
-	/* Select to iterate over the table with the least elements */
-	if (cl_map_count(&pkey_tbl1->keys) < cl_map_count(&pkey_tbl2->keys)) {
-		map_iter = cl_map_head(&pkey_tbl1->keys);
-		map_end = cl_map_end(&pkey_tbl1->keys);
-		pkey_tbl = pkey_tbl2;
-	} else {
-		map_iter = cl_map_head(&pkey_tbl2->keys);
-		map_end = cl_map_end(&pkey_tbl2->keys);
-		pkey_tbl =  pkey_tbl1;
+	map_iter1 = cl_map_head(&pkey_tbl1->keys);
+	map_iter2 = cl_map_head(&pkey_tbl2->keys);
+
+	/* comparing pkey_tbl1 full with pkey_tbl2 limited */
+	while ((map_iter1 != cl_map_end(&pkey_tbl1->keys)) &&
+	       (map_iter2 != cl_map_end(&pkey_tbl2->keys))) {
+		pkey1 = (ib_net16_t *) cl_map_obj(map_iter1);
+		pkey2 = (ib_net16_t *) cl_map_obj(map_iter2);
+
+		if (!ib_pkey_is_full_member(*pkey1)) {
+			map_iter1 = cl_map_next(map_iter1);
+			continue;
+		}
+		if (ib_pkey_is_full_member(*pkey2)) {
+			map_iter2 = cl_map_next(map_iter2);
+			continue;
+		}
+
+		if (match_pkey(pkey1, pkey2))
+			return *pkey1;
+
+		/* advance the lower value if they are not equal */
+		pkey1_base = ib_pkey_get_base(cl_map_key(map_iter1));
+		pkey2_base = ib_pkey_get_base(cl_map_key(map_iter2));
+		if (pkey2_base == pkey1_base) {
+			map_iter1 = cl_map_next(map_iter1);
+			map_iter2 = cl_map_next(map_iter2);
+		} else if (pkey2_base < pkey1_base)
+			map_iter2 = cl_map_next(map_iter2);
+		else
+			map_iter1 = cl_map_next(map_iter1);
 	}
 
-	while (map_iter != map_end) {
-		pkey1 = (ib_net16_t *) cl_map_obj(map_iter);
-		key = cl_map_key(map_iter);
+	map_iter1 = cl_map_head(&pkey_tbl1->keys);
+	map_iter2 = cl_map_head(&pkey_tbl2->keys);
 
-		pkey2 = cl_map_get(&pkey_tbl->keys, key | IB_PKEY_TYPE_MASK);
-		if (!pkey2)
-			pkey2 = cl_map_get(&pkey_tbl->keys,
-					key & ~IB_PKEY_TYPE_MASK);
+	/* comparing pkey_tbl1 limited with pkey_tbl2 full */
+	while ((map_iter1 != cl_map_end(&pkey_tbl1->keys)) &&
+	       (map_iter2 != cl_map_end(&pkey_tbl2->keys))) {
+		pkey1 = (ib_net16_t *) cl_map_obj(map_iter1);
+		pkey2 = (ib_net16_t *) cl_map_obj(map_iter2);
 
-		if (pkey2 && match_pkey(pkey1, pkey2))
-			return (pkey_tbl == pkey_tbl2 ? *pkey1 : *pkey2);
+		if (ib_pkey_is_full_member(*pkey1)) {
+			map_iter1 = cl_map_next(map_iter1);
+			continue;
+		}
+		if (!ib_pkey_is_full_member(*pkey2)) {
+			map_iter2 = cl_map_next(map_iter2);
+			continue;
+		}
 
-		map_iter = cl_map_next(map_iter);
+		if (match_pkey(pkey1, pkey2))
+			return *pkey1;
+
+		/* advance the lower value if they are not equal */
+		pkey1_base = ib_pkey_get_base(cl_map_key(map_iter1));
+		pkey2_base = ib_pkey_get_base(cl_map_key(map_iter2));
+		if (pkey2_base == pkey1_base) {
+			map_iter1 = cl_map_next(map_iter1);
+			map_iter2 = cl_map_next(map_iter2);
+		} else if (pkey2_base < pkey1_base)
+			map_iter2 = cl_map_next(map_iter2);
+		else
+			map_iter1 = cl_map_next(map_iter1);
 	}
 
 	return 0;
diff --git a/opensm/osm_pkey_mgr.c b/opensm/osm_pkey_mgr.c
index 7a1f31c..0809d1e 100644
--- a/opensm/osm_pkey_mgr.c
+++ b/opensm/osm_pkey_mgr.c
@@ -92,7 +92,7 @@ pkey_mgr_process_physical_port(IN osm_log_t * p_log,
 	osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);
 	osm_pkey_tbl_t *p_pkey_tbl;
 	ib_net16_t *p_orig_pkey;
-	char *stat = NULL;
+	const char *stat = NULL;
 	osm_pending_pkey_t *p_pending;
 
 	p_pkey_tbl = &p_physp->pkeys;
@@ -178,18 +178,26 @@ pkey_mgr_update_pkey_entry(IN osm_sm_t * sm,
 {
 	osm_madw_context_t context;
 	osm_node_t *p_node = osm_physp_get_node_ptr(p_physp);
+	osm_physp_t *physp0;
 	uint32_t attr_mod;
+	ib_net64_t m_key;
 
 	context.pkey_context.node_guid = osm_node_get_node_guid(p_node);
 	context.pkey_context.port_guid = osm_physp_get_port_guid(p_physp);
 	context.pkey_context.set_method = TRUE;
 	attr_mod = block_index;
-	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH &&
+	    osm_physp_get_port_num(p_physp) != 0) {
 		attr_mod |= osm_physp_get_port_num(p_physp) << 16;
+		physp0 = osm_node_get_physp_ptr(p_node, 0);
+		m_key = ib_port_info_get_m_key(&physp0->port_info);
+	} else
+		m_key = ib_port_info_get_m_key(&p_physp->port_info);
 	return osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
 			   (uint8_t *) block, sizeof(*block),
 			   IB_MAD_ATTR_P_KEY_TABLE,
-			   cl_hton32(attr_mod), CL_DISP_MSGID_NONE, &context);
+			   cl_hton32(attr_mod), FALSE, m_key,
+			   CL_DISP_MSGID_NONE, &context);
 }
 
 static ib_api_status_t
@@ -200,6 +208,8 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
 	osm_madw_context_t context;
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	ib_port_info_t *p_pi;
+	ib_net64_t m_key;
+	osm_physp_t *physp0;
 	ib_api_status_t status;
 	uint8_t enforce_bits;
 
@@ -234,17 +244,22 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
 	p_pi->state_info2 = 0;
 	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);
 
+	physp0 = osm_node_get_physp_ptr(p_physp->p_node, 0);
+	m_key = ib_port_info_get_m_key(&physp0->port_info);
+
 	context.pi_context.node_guid =
 	    osm_node_get_node_guid(osm_physp_get_node_ptr(p_physp));
 	context.pi_context.port_guid = osm_physp_get_port_guid(p_physp);
 	context.pi_context.set_method = TRUE;
 	context.pi_context.light_sweep = FALSE;
 	context.pi_context.active_transition = FALSE;
+	context.pi_context.client_rereg = FALSE;
 
 	status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
 			     payload, sizeof(payload),
 			     IB_MAD_ATTR_PORT_INFO,
 			     cl_hton32(osm_physp_get_port_num(p_physp)),
+			     FALSE, m_key,
 			     CL_DISP_MSGID_NONE, &context);
 	if (status != IB_SUCCESS)
 		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0511: "
@@ -265,24 +280,30 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
 }
 
 static void clear_accum_pkey_index(osm_pkey_tbl_t * p_pkey_tbl,
-                                   uint16_t pkey_index)
+				   uint16_t pkey_index)
 {
 	uint16_t pkey_idx_bias, pkey_idx;
-	uint32_t i;
 	void *ptr;
 	uintptr_t pkey_idx_ptr;
+	cl_map_iterator_t map_iter, map_iter_temp;
+
+	map_iter = cl_map_head(&p_pkey_tbl->accum_pkeys);
 
 	pkey_idx_bias = pkey_index + 1; // adjust for pkey index bias in accum_pkeys
-	for (i = 1; i < cl_ptr_vector_get_size(&p_pkey_tbl->accum_pkeys); i++) {
-		ptr = cl_ptr_vector_get(&p_pkey_tbl->accum_pkeys, i);
-		if (ptr != NULL) {
-			pkey_idx_ptr = (uintptr_t) ptr;
-			pkey_idx = pkey_idx_ptr;
-			if (pkey_idx == pkey_idx_bias) {
-				osm_pkey_tbl_clear_accum_pkeys(p_pkey_tbl, i);
-				break;
-			}
+
+	while (map_iter != cl_map_end(&p_pkey_tbl->accum_pkeys)) {
+		map_iter_temp = cl_map_next(map_iter);
+		ptr = (uint16_t *) cl_map_obj(map_iter);
+		CL_ASSERT(ptr);
+		pkey_idx_ptr = (uintptr_t) ptr;
+		pkey_idx = pkey_idx_ptr;
+		if (pkey_idx == pkey_idx_bias) {
+			cl_map_remove_item(&p_pkey_tbl->accum_pkeys, map_iter);
+			if (p_pkey_tbl->last_pkey_idx == pkey_idx)
+				osm_pkey_find_last_accum_pkey_index(p_pkey_tbl);
+			break;
 		}
+		map_iter = map_iter_temp;
 	}
 }
 
@@ -362,17 +383,14 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
 			pkey_index = p_pending->index;
 			found = TRUE;
 		} else {
-			if (p_pending->pkey < cl_ptr_vector_get_size(&p_pkey_tbl->accum_pkeys)) {
-				ptr = cl_ptr_vector_get(&p_pkey_tbl->accum_pkeys,
-							p_pending->pkey);
-				if (ptr != NULL) {
-					pkey_idx_ptr = (uintptr_t) ptr;
-					pkey_idx = pkey_idx_ptr;
-					pkey_idx--; /* adjust pkey index for bias */
-					block_index = pkey_idx / IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
-					pkey_index = pkey_idx % IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
-					found = TRUE;
-				}
+			ptr = cl_map_get(&p_pkey_tbl->accum_pkeys,p_pending->pkey);
+			if (ptr != NULL) {
+				pkey_idx_ptr = (uintptr_t) ptr;
+				pkey_idx = pkey_idx_ptr;
+				pkey_idx--; /* adjust pkey index for bias */
+				block_index = pkey_idx / IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+				pkey_index = pkey_idx % IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
+				found = TRUE;
 			}
 
 			if (!found) {
@@ -481,7 +499,7 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
 					       block_index);
 		if (status == IB_SUCCESS)
 			OSM_LOG(p_log, OSM_LOG_DEBUG,
-				"Updated pkey table block %d for node 0x%016"
+				"Updated pkey table block %u for node 0x%016"
 				PRIx64 " port %u (%s)\n", block_index,
 				cl_ntoh64(osm_node_get_node_guid(p_node)),
 				osm_physp_get_port_num(p_physp),
@@ -489,7 +507,7 @@ static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
 		else {
 			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0506: "
 				"pkey_mgr_update_pkey_entry() failed to update "
-				"pkey table block %d for node 0x%016" PRIx64
+				"pkey table block %u for node 0x%016" PRIx64
 				" port %u (%s)\n", block_index,
 				cl_ntoh64(osm_node_get_node_guid(p_node)),
 				osm_physp_get_port_num(p_physp),
@@ -546,7 +564,7 @@ static int update_peer_block(osm_log_t * p_log, osm_sm_t * sm,
 					       peer_block_idx) != IB_SUCCESS) {
 			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0509: "
 				"pkey_mgr_update_pkey_entry() failed to update "
-				"pkey table block %d for node 0x%016"
+				"pkey table block %u for node 0x%016"
 				PRIx64 " port %u (%s)\n",
 				peer_block_idx,
 				cl_ntoh64(osm_node_get_node_guid(p_node)),
diff --git a/opensm/osm_pkey_rcv.c b/opensm/osm_pkey_rcv.c
index b818485..20c6cca 100644
--- a/opensm/osm_pkey_rcv.c
+++ b/opensm/osm_pkey_rcv.c
@@ -134,7 +134,8 @@ void osm_pkey_rcv_process(IN void *context, IN void *data)
 			       p_pkey_tbl, FILE_ID, OSM_LOG_DEBUG);
 
 	osm_physp_set_pkey_tbl(sm->p_log, sm->p_subn,
-			       p_physp, p_pkey_tbl, block_num);
+			       p_physp, p_pkey_tbl, block_num,
+			       p_context->set_method);
 
 Exit:
 	cl_plock_release(sm->p_lock);
diff --git a/opensm/osm_port.c b/opensm/osm_port.c
index 6e73e66..bcee338 100644
--- a/opensm/osm_port.c
+++ b/opensm/osm_port.c
@@ -599,7 +599,8 @@ boolean_t osm_link_is_healthy(IN const osm_physp_t * p_physp)
 void osm_physp_set_pkey_tbl(IN osm_log_t * p_log, IN const osm_subn_t * p_subn,
 			    IN osm_physp_t * p_physp,
 			    IN ib_pkey_table_t * p_pkey_tbl,
-			    IN uint16_t block_num)
+			    IN uint16_t block_num,
+			    IN boolean_t is_set)
 {
 	uint16_t max_blocks;
 
@@ -639,6 +640,9 @@ void osm_physp_set_pkey_tbl(IN osm_log_t * p_log, IN const osm_subn_t * p_subn,
 		return;
 	}
 
+	/* decrement block received counter */
+	if(!is_set)
+		p_physp->pkeys.rcv_blocks_cnt--;
 	osm_pkey_tbl_set(&p_physp->pkeys, block_num, p_pkey_tbl,
 			 p_subn->opt.allow_both_pkeys);
 }
diff --git a/opensm/osm_port_info_rcv.c b/opensm/osm_port_info_rcv.c
index c3bc66c..5c12989 100644
--- a/opensm/osm_port_info_rcv.c
+++ b/opensm/osm_port_info_rcv.c
@@ -1,8 +1,9 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -69,7 +70,7 @@
 static void pi_rcv_check_and_fix_lid(osm_log_t * log, ib_port_info_t * pi,
 				     osm_physp_t * p)
 {
-	if (cl_ntoh16(pi->base_lid) > IB_LID_UCAST_END_HO) {
+	if (PF(cl_ntoh16(pi->base_lid) > IB_LID_UCAST_END_HO)) {
 		OSM_LOG(log, OSM_LOG_ERROR, "ERR 0F04: "
 			"Got invalid base LID %u from the network. "
 			"Corrected to %u\n", cl_ntoh16(pi->base_lid),
@@ -84,7 +85,7 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp,
 	osm_madw_context_t context;
 	ib_api_status_t status;
 	ib_net64_t port_guid;
-	uint8_t rate, mtu;
+	uint8_t rate, mtu, mpb;
 	unsigned data_vls;
 	cl_qmap_t *p_sm_tbl;
 	osm_remote_sm_t *p_sm;
@@ -94,7 +95,8 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp,
 	port_guid = osm_physp_get_port_guid(p_physp);
 
 	/* HACK extended port 0 should be handled too! */
-	if (osm_physp_get_port_num(p_physp) != 0) {
+	if (osm_physp_get_port_num(p_physp) != 0 &&
+	    ib_port_info_get_port_state(p_pi) != IB_LINK_DOWN) {
 		/* track the minimal endport MTU, rate, and operational VLs */
 		mtu = ib_port_info_get_mtu_cap(p_pi);
 		if (mtu < sm->p_subn->min_ca_mtu) {
@@ -124,6 +126,14 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp,
 		}
 	}
 
+	/* Check M_Key vs M_Key protect, can we control the port ? */
+	mpb = ib_port_info_get_mpb(p_pi);
+	if (mpb > 0 && p_pi->m_key == 0) {
+		OSM_LOG(sm->p_log, OSM_LOG_INFO,
+			"Port 0x%" PRIx64 " has unknown M_Key, protection level %u\n",
+			cl_ntoh64(port_guid), mpb);
+	}
+
 	if (port_guid != sm->p_subn->sm_port_guid) {
 		p_sm_tbl = &sm->p_subn->sm_guid_tbl;
 		if (p_pi->capability_mask & IB_PORT_CAP_IS_SM) {
@@ -145,8 +155,8 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp,
 					cl_ntoh64(port_guid));
 			else {
 				OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-					"Detected another SM. Requesting SMInfo"
-					"\n\t\t\t\tPort 0x%" PRIx64 "\n",
+					"Detected another SM. Requesting SMInfo "
+					"from port 0x%" PRIx64 "\n",
 					cl_ntoh64(port_guid));
 
 				/*
@@ -161,14 +171,18 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN osm_physp_t * p_physp,
 						     osm_physp_get_dr_path_ptr
 						     (p_physp),
 						     IB_MAD_ATTR_SM_INFO, 0,
+						     FALSE,
+						     ib_port_info_get_m_key(&p_physp->port_info),
 						     CL_DISP_MSGID_NONE,
 						     &context);
 
 				if (status != IB_SUCCESS)
 					OSM_LOG(sm->p_log, OSM_LOG_ERROR,
 						"ERR 0F05: "
-						"Failure requesting SMInfo (%s)\n",
-						ib_get_err_str(status));
+						"Failure requesting SMInfo (%s) "
+						"from port 0x%" PRIx64 "\n",
+						ib_get_err_str(status),
+						cl_ntoh64(port_guid));
 			}
 		} else {
 			p_sm =
@@ -193,6 +207,7 @@ static void pi_rcv_process_switch_port(IN osm_sm_t * sm, IN osm_node_t * p_node,
 	osm_madw_context_t context;
 	osm_physp_t *p_remote_physp;
 	osm_node_t *p_remote_node;
+	unsigned data_vls;
 	uint8_t port_num;
 	uint8_t remote_port_num;
 	osm_dr_path_t path;
@@ -276,6 +291,7 @@ static void pi_rcv_process_switch_port(IN osm_sm_t * sm, IN osm_node_t * p_node,
 
 				status = osm_req_get(sm, &path,
 						     IB_MAD_ATTR_NODE_INFO, 0,
+						     TRUE, 0,
 						     CL_DISP_MSGID_NONE,
 						     &context);
 
@@ -321,8 +337,30 @@ static void pi_rcv_process_switch_port(IN osm_sm_t * sm, IN osm_node_t * p_node,
 			/* PortState is not used on BSP0 but just in case it is DOWN */
 			p_physp->port_info = *p_pi;
 		pi_rcv_process_endport(sm, p_physp, p_pi);
+	} else {
+		if (ib_port_info_get_port_state(p_pi) == IB_LINK_DOWN)
+			goto Exit;
+
+		p_remote_physp = osm_physp_get_remote(p_physp);
+		if (p_remote_physp) {
+			p_remote_node = osm_physp_get_node_ptr(p_remote_physp);
+			if (p_remote_node->sw) {
+				data_vls = 1U << (ib_port_info_get_op_vls(p_pi) - 1);
+				if (data_vls >= IB_MAX_NUM_VLS)
+					data_vls = IB_MAX_NUM_VLS - 1;
+				if ((uint8_t)data_vls < sm->p_subn->min_sw_data_vls) {
+					OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
+						"Setting switch port minimal data VLs to:%u defined by node:0x%"
+						PRIx64 ", port:%u\n", data_vls,
+						cl_ntoh64(osm_node_get_node_guid(p_node)),
+						port_num);
+					sm->p_subn->min_sw_data_vls = data_vls;
+				}
+			}
+		}
 	}
 
+Exit:
 	OSM_LOG_EXIT(sm->p_log);
 }
 
@@ -352,6 +390,8 @@ static void get_pkey_table(IN osm_log_t * p_log, IN osm_sm_t * sm,
 	osm_madw_context_t context;
 	ib_api_status_t status;
 	osm_dr_path_t path;
+	osm_physp_t *physp0;
+	ib_net64_t m_key;
 	uint8_t port_num;
 	uint16_t block_num, max_blocks;
 	uint32_t attr_mod_ho;
@@ -391,14 +431,20 @@ static void get_pkey_table(IN osm_log_t * p_log, IN osm_sm_t * sm,
 			      1) / IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
 	}
 
+	p_physp->pkeys.rcv_blocks_cnt = max_blocks;
 	for (block_num = 0; block_num < max_blocks; block_num++) {
-		if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH)
+		if (osm_node_get_type(p_node) != IB_NODE_TYPE_SWITCH ||
+		    osm_physp_get_port_num(p_physp) == 0) {
 			attr_mod_ho = block_num;
-		else
+			m_key = ib_port_info_get_m_key(&p_physp->port_info);
+		} else {
 			attr_mod_ho = block_num | (port_num << 16);
+			physp0 = osm_node_get_physp_ptr(p_node, 0);
+			m_key = ib_port_info_get_m_key(&physp0->port_info);
+		}
 		status = osm_req_get(sm, &path, IB_MAD_ATTR_P_KEY_TABLE,
-				     cl_hton32(attr_mod_ho),
-				     CL_DISP_MSGID_NONE, &context);
+				     cl_hton32(attr_mod_ho), FALSE,
+				     m_key, CL_DISP_MSGID_NONE, &context);
 
 		if (status != IB_SUCCESS) {
 			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0F12: "
@@ -505,6 +551,11 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 
 	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_PORT_INFO);
 
+	/*
+	 * Attribute modifier has already been validated upon MAD receive,
+	 * which means that port_num has to be valid - it originated from
+	 * the request attribute modifier.
+	 */
 	port_num = (uint8_t) cl_ntoh32(p_smp->attr_mod);
 
 	port_guid = p_context->port_guid;
@@ -515,10 +566,12 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 
 	/* On receipt of client reregister, clear the reregister bit so
 	   reregistering won't be sent again and again */
-	if (ib_port_info_get_client_rereg(p_pi)) {
+	if (p_context->set_method &&
+	    (ib_port_info_get_client_rereg(p_pi) || p_context->client_rereg)) {
 		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 			"Client reregister received on response\n");
 		ib_port_info_set_client_rereg(p_pi, 0);
+		p_context->client_rereg = FALSE;
 	}
 
 	/*
@@ -540,7 +593,7 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 
 	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
 	p_port = osm_get_port_by_guid(sm->p_subn, port_guid);
-	if (!p_port) {
+	if (PF(!p_port)) {
 		CL_PLOCK_RELEASE(sm->p_lock);
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F06: "
 			"No port object for port with GUID 0x%" PRIx64
@@ -554,6 +607,17 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 	p_node = p_port->p_node;
 	CL_ASSERT(p_node);
 
+	if (PF(p_pi->local_port_num > p_node->node_info.num_ports)) {
+		CL_PLOCK_RELEASE(sm->p_lock);
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F15: "
+			"Received PortInfo for port GUID 0x%" PRIx64 " is "
+			"non-compliant and is being ignored since the "
+			"local port num %u > num ports %u\n",
+			cl_ntoh64(port_guid), p_pi->local_port_num,
+			p_node->node_info.num_ports);
+		goto Exit;
+	}
+
 	/*
 	   If we were setting the PortInfo, then receiving
 	   this attribute was not part of sweeping the subnet.
@@ -599,13 +663,18 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 		switch (osm_node_get_type(p_node)) {
 		case IB_NODE_TYPE_CA:
 		case IB_NODE_TYPE_ROUTER:
-			p_port->discovery_count++;
+			if (!p_node->physp_discovered[port_num]) {
+				p_port->discovery_count++;
+				p_node->physp_discovered[port_num] = 1;
+			}
 			pi_rcv_process_ca_or_router_port(sm, p_node, p_physp,
 							 p_pi);
 			break;
 		case IB_NODE_TYPE_SWITCH:
-			if (port_num == 0)
+			if (!p_node->physp_discovered[port_num]) {
 				p_port->discovery_count++;
+				p_node->physp_discovered[port_num] = 1;
+			}
 			pi_rcv_process_switch_port(sm, p_node, p_physp, p_pi);
 			break;
 		default:
diff --git a/opensm/osm_prtn.c b/opensm/osm_prtn.c
index b4ee965..bd0ac67 100644
--- a/opensm/osm_prtn.c
+++ b/opensm/osm_prtn.c
@@ -105,13 +105,13 @@ void osm_prtn_delete(IN osm_subn_t * p_subn, IN OUT osm_prtn_t ** pp_prtn)
 			/* osm_mgrp_cleanup will not delete
 			 * "well_known" groups */
 			p->mgrps[i]->well_known = FALSE;
-			osm_mgrp_cleanup(p_subn, p->mgrps[i]);
 			OSM_LOG(&p_subn->p_osm->log, OSM_LOG_DEBUG,
 				"removing mgroup %s from partition (0x%x)\n",
 				inet_ntop(AF_INET6,
 					  p->mgrps[i]->mcmember_rec.mgid.raw,
 					  gid_str, sizeof gid_str),
 				cl_hton16(p->pkey));
+			osm_mgrp_cleanup(p_subn, p->mgrps[i]);
 		}
 
 		free(p->mgrps);
@@ -253,10 +253,10 @@ ib_api_status_t osm_prtn_add_mcgroup(osm_log_t * p_log, osm_subn_t * p_subn,
 	mc_rec.mgid = *mgid;
 
 	mc_rec.qkey = CL_HTON32(Q_Key);
-	mc_rec.mtu = mtu | (2 << 6);
+	mc_rec.mtu = mtu | (IB_PATH_SELECTOR_EXACTLY << 6);
 	mc_rec.tclass = tclass;
 	mc_rec.pkey = pkey;
-	mc_rec.rate = rate | (2 << 6);
+	mc_rec.rate = rate | (IB_PATH_SELECTOR_EXACTLY << 6);
 	mc_rec.pkt_life = p_subn->opt.subnet_timeout;
 	mc_rec.sl_flow_hop = ib_member_set_sl_flow_hop(sl, FlowLabel, hop_limit);
 	/* Scope in MCMemberRecord (if present) needs to be consistent with MGID */
@@ -376,6 +376,7 @@ ib_api_status_t osm_prtn_make_partitions(osm_log_t * p_log, osm_subn_t * p_subn)
 	struct stat statbuf;
 	const char *file_name;
 	boolean_t is_config = TRUE;
+	boolean_t is_wrong_config = FALSE;
 	ib_api_status_t status = IB_SUCCESS;
 	cl_map_item_t *p_next;
 	osm_prtn_t *p;
@@ -383,12 +384,13 @@ ib_api_status_t osm_prtn_make_partitions(osm_log_t * p_log, osm_subn_t * p_subn)
 	file_name = p_subn->opt.partition_config_file ?
 	    p_subn->opt.partition_config_file : OSM_DEFAULT_PARTITION_CONFIG_FILE;
 	if (stat(file_name, &statbuf)) {
-		OSM_LOG(p_log, OSM_LOG_ERROR, "Partition configuration "
+		OSM_LOG(p_log, OSM_LOG_VERBOSE, "Partition configuration "
 			"%s is not accessible (%s)\n", file_name,
 			strerror(errno));
 		is_config = FALSE;
 	}
 
+retry_default:
 	/* clean up current port maps */
 	p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);
 	while (p_next != cl_qmap_end(&p_subn->prtn_pkey_tbl)) {
@@ -404,9 +406,11 @@ ib_api_status_t osm_prtn_make_partitions(osm_log_t * p_log, osm_subn_t * p_subn)
 	if (status != IB_SUCCESS)
 		goto _err;
 
-	if (is_config && osm_prtn_config_parse_file(p_log, p_subn, file_name))
+	if (is_config && osm_prtn_config_parse_file(p_log, p_subn, file_name)) {
 		OSM_LOG(p_log, OSM_LOG_VERBOSE, "Partition configuration "
 			"was not fully processed\n");
+		is_wrong_config = TRUE;
+	}
 
 	/* and now clean up empty partitions */
 	p_next = cl_qmap_head(&p_subn->prtn_pkey_tbl);
@@ -421,6 +425,13 @@ ib_api_status_t osm_prtn_make_partitions(osm_log_t * p_log, osm_subn_t * p_subn)
 		}
 	}
 
+	if (is_config && is_wrong_config) {
+		OSM_LOG(p_log, OSM_LOG_ERROR, "Partition configuration "
+			"in error; retrying with default config\n");
+		is_config = FALSE;
+		goto retry_default;
+	}
+
 _err:
 	return status;
 }
diff --git a/opensm/osm_prtn_config.c b/opensm/osm_prtn_config.c
index 8714eba..100282a 100644
--- a/opensm/osm_prtn_config.c
+++ b/opensm/osm_prtn_config.c
@@ -248,7 +248,7 @@ static int partition_create(unsigned lineno, struct part_conf *conf,
 		struct precreate_mgroup broadcast_mgroup;
 		memset(&broadcast_mgroup, 0, sizeof(broadcast_mgroup));
 		broadcast_mgroup.mgid = osm_ipoib_broadcast_mgid;
-		pkey |= cl_hton16(0x8000);
+		pkey = CL_HTON16(0x8000) | conf->p_prtn->pkey;
 		memcpy(&broadcast_mgroup.mgid.raw[4], &pkey , sizeof(pkey));
 		broadcast_mgroup.flags.mtu = conf->flags.mtu;
 		broadcast_mgroup.flags.rate = conf->flags.rate;
@@ -296,12 +296,14 @@ static int parse_group_flag(unsigned lineno, osm_log_t * p_log,
 		else
 			flags->scope_mask |= (1<<scope);
 	} else if (!strncmp(flag, "Q_Key", strlen(flag))) {
+		rc = 1;
 		if (!val || (flags->Q_Key = strtoul(val, NULL, 0)) == 0)
 			OSM_LOG(p_log, OSM_LOG_VERBOSE,
 				"PARSE WARN: line %d: "
 				"flag \'Q_Key\' requires valid value"
 				" - using '0'\n", lineno);
 	} else if (!strncmp(flag, "TClass", strlen(flag))) {
+		rc =1;
 		if (!val || (flags->TClass = strtoul(val, NULL, 0)) == 0)
 			OSM_LOG(p_log, OSM_LOG_VERBOSE,
 				"PARSE WARN: line %d: "
@@ -406,7 +408,7 @@ static int partition_add_port(unsigned lineno, struct part_conf *conf,
 			membership = FULL;
 		else if (!strncmp(flag, "both", strlen(flag)))
 			membership = BOTH;
-		else if (!strncmp(flag, "limited", strlen(flag))) {
+		else if (strncmp(flag, "limited", strlen(flag))) {
 			OSM_LOG(conf->p_log, OSM_LOG_VERBOSE,
 				"PARSE WARN: line %d: "
 				"unrecognized port flag \'%s\'."
@@ -694,6 +696,9 @@ done:
 	return len;
 }
 
+/**
+ * @return 1 on error, 0 on success
+ */
 int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 			       const char *file_name)
 {
@@ -701,6 +706,7 @@ int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 	struct part_conf *conf = NULL;
 	FILE *file;
 	int lineno;
+	int is_parse_success;
 
 	file = fopen(file_name, "r");
 	if (!file) {
@@ -712,6 +718,8 @@ int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 
 	lineno = 0;
 
+	is_parse_success = 0;
+
 	while (fgets(line, sizeof(line) - 1, file) != NULL) {
 		char *q, *p = line;
 
@@ -739,6 +747,7 @@ int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 					"PARSE ERROR: line %d: "
 					"internal: cannot create config\n",
 					lineno);
+				is_parse_success = -1;
 				break;
 			}
 
@@ -748,9 +757,12 @@ int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 
 			len = parse_part_conf(conf, p, lineno);
 			if (len < 0) {
+				is_parse_success = -1;
 				break;
 			}
 
+			is_parse_success = 1;
+
 			p += len;
 
 			if (q) {
@@ -758,9 +770,12 @@ int osm_prtn_config_parse_file(osm_log_t * p_log, osm_subn_t * p_subn,
 				conf = NULL;
 			}
 		} while (q);
+
+		if (is_parse_success == -1)
+			break;
 	}
 
 	fclose(file);
 
-	return 0;
+	return (is_parse_success == 1) ? 0 : 1;
 }
diff --git a/opensm/osm_qos.c b/opensm/osm_qos.c
index bfcf1e3..a301803 100644
--- a/opensm/osm_qos.c
+++ b/opensm/osm_qos.c
@@ -91,8 +91,16 @@ static qos_mad_item_t *osm_qos_mad_create(IN osm_sm_t * sm,
 	osm_madw_context_t context;
 	osm_madw_t *p_madw;
 	osm_node_t *p_node;
+	osm_physp_t *physp0;
+	ib_net64_t m_key;
 
 	p_node = osm_physp_get_node_ptr(p);
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH &&
+	    osm_physp_get_port_num(p) != 0) {
+		physp0 = osm_node_get_physp_ptr(p_node, 0);
+		m_key = ib_port_info_get_m_key(&physp0->port_info);
+	} else
+		m_key = ib_port_info_get_m_key(&p->port_info);
 
 	switch (attr_id){
 	case IB_MAD_ATTR_SLVL_TABLE:
@@ -118,6 +126,7 @@ static qos_mad_item_t *osm_qos_mad_create(IN osm_sm_t * sm,
 	p_madw = osm_prepare_req_set(sm, osm_physp_get_dr_path_ptr(p),
 				     p_data, data_size,
 				     attr_id, cl_hton32(attr_mod),
+				     FALSE, m_key,
 				     CL_DISP_MSGID_NONE, &context);
 
 	if (p_madw == NULL) {
@@ -144,6 +153,7 @@ static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm,
 						unsigned block_num,
 						cl_qlist_t *mad_list)
 {
+	struct osm_routing_engine *re = sm->p_subn->p_osm->routing_engine_used;
 	ib_vl_arb_table_t block;
 	uint32_t attr_mod;
 	unsigned vl_mask, i;
@@ -152,6 +162,11 @@ static ib_api_status_t vlarb_update_table_block(osm_sm_t * sm,
 
 	memset(&block, 0, sizeof(block));
 	memcpy(&block, table_block, block_length * sizeof(block.vl_entry[0]));
+
+	if (re && re->update_vlarb)
+		re->update_vlarb(re->context, p, port_num, &block,
+				 block_length, block_num);
+
 	for (i = 0; i < block_length; i++)
 		block.vl_entry[i].vl &= vl_mask;
 
diff --git a/opensm/osm_qos_parser_y.c b/opensm/osm_qos_parser_y.c
index 81c2491..29749f5 100644
--- a/opensm/osm_qos_parser_y.c
+++ b/opensm/osm_qos_parser_y.c
@@ -1,8 +1,10 @@
-/* A Bison parser, made by GNU Bison 2.5.  */
 
-/* Bison implementation for Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1.  */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   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
@@ -44,7 +46,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.5"
+#define YYBISON_VERSION "2.4.1"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -65,7 +67,7 @@
 
 /* Copy the first part of user declarations.  */
 
-/* Line 268 of yacc.c  */
+/* Line 189 of yacc.c  */
 #line 1 "osm_qos_parser_y.y"
 
 /*
@@ -256,8 +258,8 @@ static cl_list_t __ulp_match_rules;
 
 
 
-/* Line 268 of yacc.c  */
-#line 261 "osm_qos_parser_y.c"
+/* Line 189 of yacc.c  */
+#line 263 "osm_qos_parser_y.c"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -456,8 +458,8 @@ typedef int YYSTYPE;
 /* Copy the second part of user declarations.  */
 
 
-/* Line 343 of yacc.c  */
-#line 461 "osm_qos_parser_y.c"
+/* Line 264 of yacc.c  */
+#line 463 "osm_qos_parser_y.c"
 
 #ifdef short
 # undef short
@@ -507,7 +509,7 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
+# if YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -560,11 +562,11 @@ YYID (yyi)
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#     ifndef EXIT_SUCCESS
-#      define EXIT_SUCCESS 0
+#     ifndef _STDLIB_H
+#      define _STDLIB_H 1
 #     endif
 #    endif
 #   endif
@@ -587,24 +589,24 @@ YYID (yyi)
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
 #  endif
-#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
+#  if (defined __cplusplus && ! defined _STDLIB_H \
        && ! ((defined YYMALLOC || defined malloc) \
 	     && (defined YYFREE || defined free)))
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef EXIT_SUCCESS
-#    define EXIT_SUCCESS 0
+#   ifndef _STDLIB_H
+#    define _STDLIB_H 1
 #   endif
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
-#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
@@ -633,7 +635,23 @@ union yyalloc
      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
       + YYSTACK_GAP_MAXIMUM)
 
-# define YYCOPY_NEEDED 1
+/* Copy COUNT objects from FROM to TO.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(To, From, Count) \
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#  else
+#   define YYCOPY(To, From, Count)		\
+      do					\
+	{					\
+	  YYSIZE_T yyi;				\
+	  for (yyi = 0; yyi < (Count); yyi++)	\
+	    (To)[yyi] = (From)[yyi];		\
+	}					\
+      while (YYID (0))
+#  endif
+# endif
 
 /* Relocate STACK from its old location to the new one.  The
    local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -653,26 +671,6 @@ union yyalloc
 
 #endif
 
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from FROM to TO.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(To, From, Count) \
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-#  else
-#   define YYCOPY(To, From, Count)		\
-      do					\
-	{					\
-	  YYSIZE_T yyi;				\
-	  for (yyi = 0; yyi < (Count); yyi++)	\
-	    (To)[yyi] = (From)[yyi];		\
-	}					\
-      while (YYID (0))
-#  endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  3
 /* YYLAST -- Last index in YYTABLE.  */
@@ -853,12 +851,12 @@ static const yytype_uint16 yyrline[] =
     1362,  1384,  1401,  1406,  1423,  1428,  1446,  1451,  1468,  1473,
     1490,  1506,  1523,  1528,  1547,  1552,  1569,  1574,  1592,  1597,
     1602,  1607,  1612,  1617,  1618,  1621,  1628,  1629,  1632,  1639,
-    1671,  1704,  1747,  1764,  1787,  1792,  1815,  1820,  1840,  1845,
-    1865,  1871,  1891,  1897,  1917,  1923,  1958,  1963,  1996,  2013,
-    2036,  2041,  2075,  2080,  2097,  2102,  2119,  2124,  2147,  2152,
-    2185,  2190,  2223,  2234,  2241,  2242,  2245,  2252,  2253,  2258,
-    2261,  2262,  2265,  2273,  2279,  2287,  2293,  2299,  2302,  2308,
-    2320,  2332,  2340,  2347,  2353
+    1670,  1702,  1745,  1762,  1785,  1790,  1813,  1818,  1838,  1843,
+    1863,  1869,  1889,  1895,  1915,  1921,  1956,  1961,  1994,  2011,
+    2034,  2039,  2073,  2078,  2095,  2100,  2117,  2122,  2145,  2150,
+    2183,  2188,  2221,  2232,  2239,  2240,  2243,  2250,  2251,  2256,
+    2259,  2260,  2263,  2271,  2277,  2285,  2291,  2297,  2300,  2306,
+    2318,  2330,  2338,  2345,  2351
 };
 #endif
 
@@ -1031,8 +1029,8 @@ static const yytype_uint8 yyr2[] =
        5,     3,     1,     1,     1
 };
 
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
-   Performed when YYTABLE doesn't specify something else to do.  Zero
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
@@ -1159,7 +1157,8 @@ static const yytype_int16 yypgoto[] =
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If YYTABLE_NINF, syntax error.  */
+   number is the opposite.  If zero, do what YYDEFACT says.
+   If YYTABLE_NINF, syntax error.  */
 #define YYTABLE_NINF -244
 static const yytype_int16 yytable[] =
 {
@@ -1193,12 +1192,6 @@ static const yytype_int16 yytable[] =
      323,     0,   328,     0,     0,   310
 };
 
-#define yypact_value_is_default(yystate) \
-  ((yystate) == (-294))
-
-#define yytable_value_is_error(yytable_value) \
-  YYID (0)
-
 static const yytype_int16 yycheck[] =
 {
       33,    34,    35,    36,   130,    38,   120,    40,   122,    42,
@@ -1283,18 +1276,9 @@ static const yytype_uint8 yystos[] =
 
 /* Like YYERROR except do call yyerror.  This remains here temporarily
    to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  However,
-   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
-   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
-   discussed.  */
+   Once GCC version 2 has supplanted version 1, this can go.  */
 
 #define YYFAIL		goto yyerrlab
-#if defined YYFAIL
-  /* This is here to suppress warnings from the GCC cpp's
-     -Wunused-macros.  Normally we don't worry about that warning, but
-     some users do, and we want to make it easy for users to remove
-     YYFAIL uses, which will produce warnings from Bison 2.5.  */
-#endif
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
@@ -1304,6 +1288,7 @@ do								\
     {								\
       yychar = (Token);						\
       yylval = (Value);						\
+      yytoken = YYTRANSLATE (yychar);				\
       YYPOPSTACK (1);						\
       goto yybackup;						\
     }								\
@@ -1345,10 +1330,19 @@ while (YYID (0))
 #endif
 
 
-/* This macro is provided for backward compatibility. */
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+   This macro was not mandated originally: define only if we know
+   we won't break user code: when these are the locations we know.  */
 
 #ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# if YYLTYPE_IS_TRIVIAL
+#  define YY_LOCATION_PRINT(File, Loc)			\
+     fprintf (File, "%d.%d-%d.%d",			\
+	      (Loc).first_line, (Loc).first_column,	\
+	      (Loc).last_line,  (Loc).last_column)
+# else
+#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
 #endif
 
 
@@ -1540,6 +1534,7 @@ int yydebug;
 # define YYMAXDEPTH 10000
 #endif
 
+

 
 #if YYERROR_VERBOSE
 
@@ -1642,142 +1637,115 @@ yytnamerr (char *yyres, const char *yystr)
 }
 # endif
 
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
-   about the unexpected token YYTOKEN for the state stack whose top is
-   YYSSP.
-
-   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
-   not large enough to hold the message.  In that case, also set
-   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
-   required number of bytes is too large to store.  */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
-                yytype_int16 *yyssp, int yytoken)
+/* Copy into YYRESULT an error message about the unexpected token
+   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
+   including the terminating null byte.  If YYRESULT is null, do not
+   copy anything; just return the number of bytes that would be
+   copied.  As a special case, return 0 if an ordinary "syntax error"
+   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
+   size calculation.  */
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
 {
-  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
-  YYSIZE_T yysize = yysize0;
-  YYSIZE_T yysize1;
-  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-  /* Internationalized format string. */
-  const char *yyformat = 0;
-  /* Arguments of yyformat. */
-  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-  /* Number of reported tokens (one for the "unexpected", one per
-     "expected"). */
-  int yycount = 0;
-
-  /* There are many possibilities here to consider:
-     - Assume YYFAIL is not used.  It's too flawed to consider.  See
-       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
-       for details.  YYERROR is fine as it does not invoke this
-       function.
-     - If this state is a consistent state with a default action, then
-       the only way this function was invoked is if the default action
-       is an error action.  In that case, don't check for expected
-       tokens because there are none.
-     - The only way there can be no lookahead present (in yychar) is if
-       this state is a consistent state with a default action.  Thus,
-       detecting the absence of a lookahead is sufficient to determine
-       that there is no unexpected or expected token to report.  In that
-       case, just report a simple "syntax error".
-     - Don't assume there isn't a lookahead just because this state is a
-       consistent state with a default action.  There might have been a
-       previous inconsistent state, consistent state with a non-default
-       action, or user semantic action that manipulated yychar.
-     - Of course, the expected token list depends on states to have
-       correct lookahead information, and it depends on the parser not
-       to perform extra reductions after fetching a lookahead from the
-       scanner and before detecting a syntax error.  Thus, state merging
-       (from LALR or IELR) and default reductions corrupt the expected
-       token list.  However, the list is correct for canonical LR with
-       one exception: it will still contain any token that will not be
-       accepted due to an error action in a later state.
-  */
-  if (yytoken != YYEMPTY)
-    {
-      int yyn = yypact[*yyssp];
-      yyarg[yycount++] = yytname[yytoken];
-      if (!yypact_value_is_default (yyn))
-        {
-          /* Start YYX at -YYN if negative to avoid negative indexes in
-             YYCHECK.  In other words, skip the first -YYN actions for
-             this state because they are default actions.  */
-          int yyxbegin = yyn < 0 ? -yyn : 0;
-          /* Stay within bounds of both yycheck and yytname.  */
-          int yychecklim = YYLAST - yyn + 1;
-          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-          int yyx;
-
-          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
-                && !yytable_value_is_error (yytable[yyx + yyn]))
-              {
-                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-                  {
-                    yycount = 1;
-                    yysize = yysize0;
-                    break;
-                  }
-                yyarg[yycount++] = yytname[yyx];
-                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
-                if (! (yysize <= yysize1
-                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-                  return 2;
-                yysize = yysize1;
-              }
-        }
-    }
+  int yyn = yypact[yystate];
 
-  switch (yycount)
-    {
-# define YYCASE_(N, S)                      \
-      case N:                               \
-        yyformat = S;                       \
-      break
-      YYCASE_(0, YY_("syntax error"));
-      YYCASE_(1, YY_("syntax error, unexpected %s"));
-      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
-      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
-      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
-      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
-    }
+  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+    return 0;
+  else
+    {
+      int yytype = YYTRANSLATE (yychar);
+      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+      YYSIZE_T yysize = yysize0;
+      YYSIZE_T yysize1;
+      int yysize_overflow = 0;
+      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+      int yyx;
+
+# if 0
+      /* This is so xgettext sees the translatable formats that are
+	 constructed on the fly.  */
+      YY_("syntax error, unexpected %s");
+      YY_("syntax error, unexpected %s, expecting %s");
+      YY_("syntax error, unexpected %s, expecting %s or %s");
+      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+# endif
+      char *yyfmt;
+      char const *yyf;
+      static char const yyunexpected[] = "syntax error, unexpected %s";
+      static char const yyexpecting[] = ", expecting %s";
+      static char const yyor[] = " or %s";
+      char yyformat[sizeof yyunexpected
+		    + sizeof yyexpecting - 1
+		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+		       * (sizeof yyor - 1))];
+      char const *yyprefix = yyexpecting;
+
+      /* Start YYX at -YYN if negative to avoid negative indexes in
+	 YYCHECK.  */
+      int yyxbegin = yyn < 0 ? -yyn : 0;
+
+      /* Stay within bounds of both yycheck and yytname.  */
+      int yychecklim = YYLAST - yyn + 1;
+      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+      int yycount = 1;
+
+      yyarg[0] = yytname[yytype];
+      yyfmt = yystpcpy (yyformat, yyunexpected);
+
+      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+	  {
+	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+	      {
+		yycount = 1;
+		yysize = yysize0;
+		yyformat[sizeof yyunexpected - 1] = '\0';
+		break;
+	      }
+	    yyarg[yycount++] = yytname[yyx];
+	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+	    yysize_overflow |= (yysize1 < yysize);
+	    yysize = yysize1;
+	    yyfmt = yystpcpy (yyfmt, yyprefix);
+	    yyprefix = yyor;
+	  }
 
-  yysize1 = yysize + yystrlen (yyformat);
-  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-    return 2;
-  yysize = yysize1;
+      yyf = YY_(yyformat);
+      yysize1 = yysize + yystrlen (yyf);
+      yysize_overflow |= (yysize1 < yysize);
+      yysize = yysize1;
 
-  if (*yymsg_alloc < yysize)
-    {
-      *yymsg_alloc = 2 * yysize;
-      if (! (yysize <= *yymsg_alloc
-             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
-        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
-      return 1;
-    }
+      if (yysize_overflow)
+	return YYSIZE_MAXIMUM;
 
-  /* Avoid sprintf, as that infringes on the user's name space.
-     Don't have undefined behavior even if the translation
-     produced a string with the wrong number of "%s"s.  */
-  {
-    char *yyp = *yymsg;
-    int yyi = 0;
-    while ((*yyp = *yyformat) != '\0')
-      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
-        {
-          yyp += yytnamerr (yyp, yyarg[yyi++]);
-          yyformat += 2;
-        }
-      else
-        {
-          yyp++;
-          yyformat++;
-        }
-  }
-  return 0;
+      if (yyresult)
+	{
+	  /* Avoid sprintf, as that infringes on the user's name space.
+	     Don't have undefined behavior even if the translation
+	     produced a string with the wrong number of "%s"s.  */
+	  char *yyp = yyresult;
+	  int yyi = 0;
+	  while ((*yyp = *yyf) != '\0')
+	    {
+	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+		{
+		  yyp += yytnamerr (yyp, yyarg[yyi++]);
+		  yyf += 2;
+		}
+	      else
+		{
+		  yyp++;
+		  yyf++;
+		}
+	    }
+	}
+      return yysize;
+    }
 }
 #endif /* YYERROR_VERBOSE */
+

 
 /*-----------------------------------------------.
 | Release the memory associated to this symbol.  |
@@ -1810,7 +1778,6 @@ yydestruct (yymsg, yytype, yyvaluep)
     }
 }
 
-
 /* Prevent warnings from -Wmissing-prototypes.  */
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
@@ -1837,9 +1804,10 @@ YYSTYPE yylval;
 int yynerrs;
 
 
-/*----------.
-| yyparse.  |
-`----------*/
+
+/*-------------------------.
+| yyparse or yypush_parse.  |
+`-------------------------*/
 
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1863,6 +1831,8 @@ yyparse ()
 #endif
 #endif
 {
+
+
     int yystate;
     /* Number of tokens to shift before error messages enabled.  */
     int yyerrstatus;
@@ -2017,7 +1987,7 @@ yybackup:
 
   /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
-  if (yypact_value_is_default (yyn))
+  if (yyn == YYPACT_NINF)
     goto yydefault;
 
   /* Not known => get a lookahead token if don't already have one.  */
@@ -2048,8 +2018,8 @@ yybackup:
   yyn = yytable[yyn];
   if (yyn <= 0)
     {
-      if (yytable_value_is_error (yyn))
-        goto yyerrlab;
+      if (yyn == 0 || yyn == YYTABLE_NINF)
+	goto yyerrlab;
       yyn = -yyn;
       goto yyreduce;
     }
@@ -2104,7 +2074,7 @@ yyreduce:
     {
         case 17:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 361 "osm_qos_parser_y.y"
     {
                         __parser_port_group_start();
@@ -2113,7 +2083,7 @@ yyreduce:
 
   case 18:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 366 "osm_qos_parser_y.y"
     {
                         if ( __parser_port_group_end() )
@@ -2123,7 +2093,7 @@ yyreduce:
 
   case 36:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 429 "osm_qos_parser_y.y"
     {
                         __parser_vlarb_scope_start();
@@ -2132,7 +2102,7 @@ yyreduce:
 
   case 37:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 434 "osm_qos_parser_y.y"
     {
                         if ( __parser_vlarb_scope_end() )
@@ -2142,7 +2112,7 @@ yyreduce:
 
   case 49:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 475 "osm_qos_parser_y.y"
     {
                         __parser_sl2vl_scope_start();
@@ -2151,7 +2121,7 @@ yyreduce:
 
   case 50:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 480 "osm_qos_parser_y.y"
     {
                         if ( __parser_sl2vl_scope_end() )
@@ -2161,7 +2131,7 @@ yyreduce:
 
   case 64:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 546 "osm_qos_parser_y.y"
     {
                         __parser_qos_level_start();
@@ -2170,7 +2140,7 @@ yyreduce:
 
   case 65:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 551 "osm_qos_parser_y.y"
     {
                         if ( __parser_qos_level_end() )
@@ -2180,7 +2150,7 @@ yyreduce:
 
   case 80:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 600 "osm_qos_parser_y.y"
     {
                         __parser_match_rule_start();
@@ -2189,7 +2159,7 @@ yyreduce:
 
   case 81:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 605 "osm_qos_parser_y.y"
     {
                         if ( __parser_match_rule_end() )
@@ -2199,7 +2169,7 @@ yyreduce:
 
   case 91:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 645 "osm_qos_parser_y.y"
     {
                         /* parsing default ulp rule: "default: num" */
@@ -2222,7 +2192,7 @@ yyreduce:
 
   case 92:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 663 "osm_qos_parser_y.y"
     {
                         /* "any, service-id ... : sl" - one instance of list of ranges */
@@ -2248,7 +2218,7 @@ yyreduce:
 
   case 94:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 684 "osm_qos_parser_y.y"
     {
                         /* "any, pkey ... : sl" - one instance of list of ranges */
@@ -2274,7 +2244,7 @@ yyreduce:
 
   case 96:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 705 "osm_qos_parser_y.y"
     {
                         /* any, target-port-guid ... : sl */
@@ -2314,7 +2284,7 @@ yyreduce:
 
   case 98:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 740 "osm_qos_parser_y.y"
     {
 			/* any, source-port-guid ... : sl */
@@ -2354,7 +2324,7 @@ yyreduce:
 
   case 100:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 775 "osm_qos_parser_y.y"
     {
 			/* any, source-target-port-guid ... : sl */
@@ -2397,7 +2367,7 @@ yyreduce:
 
   case 102:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 813 "osm_qos_parser_y.y"
     {
                         /* "sdp : sl" - default SL for SDP */
@@ -2415,7 +2385,7 @@ yyreduce:
 
   case 104:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 826 "osm_qos_parser_y.y"
     {
                         /* sdp with port numbers */
@@ -2454,7 +2424,7 @@ yyreduce:
 
   case 106:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 860 "osm_qos_parser_y.y"
     {
                         /* "rds : sl" - default SL for RDS */
@@ -2472,7 +2442,7 @@ yyreduce:
 
   case 108:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 873 "osm_qos_parser_y.y"
     {
                         /* rds with port numbers */
@@ -2511,7 +2481,7 @@ yyreduce:
 
   case 110:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 907 "osm_qos_parser_y.y"
     {
                         /* "iSER : sl" - default SL for iSER */
@@ -2529,7 +2499,7 @@ yyreduce:
 
   case 112:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 920 "osm_qos_parser_y.y"
     {
                         /* iser with port numbers */
@@ -2568,7 +2538,7 @@ yyreduce:
 
   case 114:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 954 "osm_qos_parser_y.y"
     {
                         /* srp with target guids - this rule is similar
@@ -2609,7 +2579,7 @@ yyreduce:
 
   case 116:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 990 "osm_qos_parser_y.y"
     {
                         /* ipoib w/o any pkeys (default pkey) */
@@ -2634,7 +2604,7 @@ yyreduce:
 
   case 118:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1010 "osm_qos_parser_y.y"
     {
                         /* ipoib with pkeys */
@@ -2671,105 +2641,105 @@ yyreduce:
 
   case 120:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1044 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 121:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1047 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 122:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1050 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 123:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1053 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 124:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1056 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 125:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1059 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 126:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1062 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 127:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1065 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 128:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1068 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 129:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1071 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 130:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1074 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 131:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1077 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 132:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1080 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 133:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1083 "osm_qos_parser_y.y"
     { __parser_ulp_match_rule_start(); }
     break;
 
   case 134:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1086 "osm_qos_parser_y.y"
     {
                         /* get the SL for ULP rules */
@@ -2801,7 +2771,7 @@ yyreduce:
 
   case 135:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1125 "osm_qos_parser_y.y"
     {
                             /* 'name' of 'port-group' - one instance */
@@ -2828,7 +2798,7 @@ yyreduce:
 
   case 136:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1148 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -2837,7 +2807,7 @@ yyreduce:
 
   case 137:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1153 "osm_qos_parser_y.y"
     {
                             /* 'use' of 'port-group' - one instance */
@@ -2864,7 +2834,7 @@ yyreduce:
 
   case 138:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1176 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -2873,7 +2843,7 @@ yyreduce:
 
   case 139:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1181 "osm_qos_parser_y.y"
     {
                             /* 'port-name' in 'port-group' - any num of instances */
@@ -2943,7 +2913,7 @@ yyreduce:
 
   case 140:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1247 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -2952,7 +2922,7 @@ yyreduce:
 
   case 141:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1252 "osm_qos_parser_y.y"
     {
                             /* 'port-guid' in 'port-group' - any num of instances */
@@ -2976,7 +2946,7 @@ yyreduce:
 
   case 142:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1272 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -2985,7 +2955,7 @@ yyreduce:
 
   case 143:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1277 "osm_qos_parser_y.y"
     {
                             /* 'pkey' in 'port-group' - any num of instances */
@@ -3009,7 +2979,7 @@ yyreduce:
 
   case 144:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1297 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3018,7 +2988,7 @@ yyreduce:
 
   case 145:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1302 "osm_qos_parser_y.y"
     {
                             /* 'partition' in 'port-group' - any num of instances */
@@ -3030,7 +3000,7 @@ yyreduce:
 
   case 146:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1310 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3039,7 +3009,7 @@ yyreduce:
 
   case 147:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1315 "osm_qos_parser_y.y"
     {
                             /* 'node-type' in 'port-group' - any num of instances */
@@ -3048,7 +3018,7 @@ yyreduce:
 
   case 148:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1320 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3057,7 +3027,7 @@ yyreduce:
 
   case 156:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1336 "osm_qos_parser_y.y"
     {
                             p_current_port_group->node_types |=
@@ -3067,7 +3037,7 @@ yyreduce:
 
   case 157:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1342 "osm_qos_parser_y.y"
     {
                             p_current_port_group->node_types |=
@@ -3077,7 +3047,7 @@ yyreduce:
 
   case 158:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1348 "osm_qos_parser_y.y"
     {
                             p_current_port_group->node_types |=
@@ -3087,7 +3057,7 @@ yyreduce:
 
   case 159:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1354 "osm_qos_parser_y.y"
     {
                             p_current_port_group->node_types |=
@@ -3099,7 +3069,7 @@ yyreduce:
 
   case 160:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1362 "osm_qos_parser_y.y"
     {
                             osm_port_t * p_osm_port =
@@ -3114,7 +3084,7 @@ yyreduce:
 
   case 161:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1384 "osm_qos_parser_y.y"
     {
                             /* 'group' in 'vlarb-scope' - any num of instances */
@@ -3135,7 +3105,7 @@ yyreduce:
 
   case 162:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1401 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3144,7 +3114,7 @@ yyreduce:
 
   case 163:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1406 "osm_qos_parser_y.y"
     {
                             /* 'across' in 'vlarb-scope' - any num of instances */
@@ -3165,7 +3135,7 @@ yyreduce:
 
   case 164:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1423 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3174,7 +3144,7 @@ yyreduce:
 
   case 165:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1428 "osm_qos_parser_y.y"
     {
                             /* 'vl-high-limit' in 'vlarb-scope' - one instance of one number */
@@ -3196,7 +3166,7 @@ yyreduce:
 
   case 166:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1446 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3205,7 +3175,7 @@ yyreduce:
 
   case 167:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1451 "osm_qos_parser_y.y"
     {
                             /* 'vlarb-high' in 'vlarb-scope' - list of pairs of numbers with ':' and ',' */
@@ -3226,7 +3196,7 @@ yyreduce:
 
   case 168:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1468 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3235,7 +3205,7 @@ yyreduce:
 
   case 169:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1473 "osm_qos_parser_y.y"
     {
                             /* 'vlarb-low' in 'vlarb-scope' - list of pairs of numbers with ':' and ',' */
@@ -3256,7 +3226,7 @@ yyreduce:
 
   case 170:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1490 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3265,7 +3235,7 @@ yyreduce:
 
   case 171:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1506 "osm_qos_parser_y.y"
     {
                             /* 'group' in 'sl2vl-scope' - any num of instances */
@@ -3286,7 +3256,7 @@ yyreduce:
 
   case 172:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1523 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3295,7 +3265,7 @@ yyreduce:
 
   case 173:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1528 "osm_qos_parser_y.y"
     {
                             /* 'across' in 'sl2vl-scope' - any num of instances */
@@ -3318,7 +3288,7 @@ yyreduce:
 
   case 174:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1547 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3327,7 +3297,7 @@ yyreduce:
 
   case 175:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1552 "osm_qos_parser_y.y"
     {
                             /* 'across-from' in 'sl2vl-scope' - any num of instances */
@@ -3348,7 +3318,7 @@ yyreduce:
 
   case 176:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1569 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3357,7 +3327,7 @@ yyreduce:
 
   case 177:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1574 "osm_qos_parser_y.y"
     {
                             /* 'across-to' in 'sl2vl-scope' - any num of instances */
@@ -3379,7 +3349,7 @@ yyreduce:
 
   case 178:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1592 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3388,7 +3358,7 @@ yyreduce:
 
   case 179:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1597 "osm_qos_parser_y.y"
     {
                             /* 'from' in 'sl2vl-scope' - any num of instances */
@@ -3397,7 +3367,7 @@ yyreduce:
 
   case 180:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1602 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3406,7 +3376,7 @@ yyreduce:
 
   case 181:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1607 "osm_qos_parser_y.y"
     {
                             /* 'to' in 'sl2vl-scope' - any num of instances */
@@ -3415,7 +3385,7 @@ yyreduce:
 
   case 182:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1612 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
@@ -3424,7 +3394,7 @@ yyreduce:
 
   case 185:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1621 "osm_qos_parser_y.y"
     {
                             int i;
@@ -3435,7 +3405,7 @@ yyreduce:
 
   case 188:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1632 "osm_qos_parser_y.y"
     {
                             int i;
@@ -3446,7 +3416,7 @@ yyreduce:
 
   case 189:
 
-/* Line 1806 of yacc.c  */
+/* Line 1455 of yacc.c  */
 #line 1639 "osm_qos_parser_y.y"
     {
                             int i;
@@ -3460,8 +3430,7 @@ yyreduce:
                                 num_pair = (uint64_t*)cl_list_obj(list_iterator);
                                 if (num_pair)
                                 {
-                                    if ( num_pair[0] < 0 ||
-                                         num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )
+                                    if ( num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )
                                     {
                                         yyerror("port number out of range 'from' list");
                                         free(num_pair);
@@ -3482,8 +3451,8 @@ yyreduce:
 
   case 190:
 
-/* Line 1806 of yacc.c  */
-#line 1671 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1670 "osm_qos_parser_y.y"
     {
                             int i;
                             cl_list_iterator_t    list_iterator;
@@ -3496,8 +3465,7 @@ yyreduce:
                                 num_pair = (uint64_t*)cl_list_obj(list_iterator);
                                 if (num_pair)
                                 {
-                                    if ( num_pair[0] < 0 ||
-                                         num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )
+                                    if ( num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )
                                     {
                                         yyerror("port number out of range 'to' list");
                                         free(num_pair);
@@ -3518,8 +3486,8 @@ yyreduce:
 
   case 191:
 
-/* Line 1806 of yacc.c  */
-#line 1704 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1702 "osm_qos_parser_y.y"
     {
                             /* 'sl2vl-table' - one instance of exactly
                                OSM_QOS_POLICY_SL2VL_TABLE_LEN numbers */
@@ -3565,8 +3533,8 @@ yyreduce:
 
   case 192:
 
-/* Line 1806 of yacc.c  */
-#line 1747 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1745 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -3574,8 +3542,8 @@ yyreduce:
 
   case 193:
 
-/* Line 1806 of yacc.c  */
-#line 1764 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1762 "osm_qos_parser_y.y"
     {
                             /* 'name' of 'qos-level' - one instance */
                             cl_list_iterator_t    list_iterator;
@@ -3601,8 +3569,8 @@ yyreduce:
 
   case 194:
 
-/* Line 1806 of yacc.c  */
-#line 1787 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1785 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -3610,8 +3578,8 @@ yyreduce:
 
   case 195:
 
-/* Line 1806 of yacc.c  */
-#line 1792 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1790 "osm_qos_parser_y.y"
     {
                             /* 'use' of 'qos-level' - one instance */
                             cl_list_iterator_t    list_iterator;
@@ -3637,8 +3605,8 @@ yyreduce:
 
   case 196:
 
-/* Line 1806 of yacc.c  */
-#line 1815 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1813 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -3646,8 +3614,8 @@ yyreduce:
 
   case 197:
 
-/* Line 1806 of yacc.c  */
-#line 1820 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1818 "osm_qos_parser_y.y"
     {
                             /* 'sl' in 'qos-level' - one instance */
                             cl_list_iterator_t   list_iterator;
@@ -3670,8 +3638,8 @@ yyreduce:
 
   case 198:
 
-/* Line 1806 of yacc.c  */
-#line 1840 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1838 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -3679,8 +3647,8 @@ yyreduce:
 
   case 199:
 
-/* Line 1806 of yacc.c  */
-#line 1845 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1843 "osm_qos_parser_y.y"
     {
                             /* 'mtu-limit' in 'qos-level' - one instance */
                             cl_list_iterator_t   list_iterator;
@@ -3703,8 +3671,8 @@ yyreduce:
 
   case 200:
 
-/* Line 1806 of yacc.c  */
-#line 1865 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1863 "osm_qos_parser_y.y"
     {
                             /* 'mtu-limit' in 'qos-level' - one instance */
                             RESET_BUFFER;
@@ -3713,8 +3681,8 @@ yyreduce:
 
   case 201:
 
-/* Line 1806 of yacc.c  */
-#line 1871 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1869 "osm_qos_parser_y.y"
     {
                             /* 'rate-limit' in 'qos-level' - one instance */
                             cl_list_iterator_t   list_iterator;
@@ -3737,8 +3705,8 @@ yyreduce:
 
   case 202:
 
-/* Line 1806 of yacc.c  */
-#line 1891 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1889 "osm_qos_parser_y.y"
     {
                             /* 'rate-limit' in 'qos-level' - one instance */
                             RESET_BUFFER;
@@ -3747,8 +3715,8 @@ yyreduce:
 
   case 203:
 
-/* Line 1806 of yacc.c  */
-#line 1897 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1895 "osm_qos_parser_y.y"
     {
                             /* 'packet-life' in 'qos-level' - one instance */
                             cl_list_iterator_t   list_iterator;
@@ -3771,8 +3739,8 @@ yyreduce:
 
   case 204:
 
-/* Line 1806 of yacc.c  */
-#line 1917 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1915 "osm_qos_parser_y.y"
     {
                             /* 'packet-life' in 'qos-level' - one instance */
                             RESET_BUFFER;
@@ -3781,8 +3749,8 @@ yyreduce:
 
   case 205:
 
-/* Line 1806 of yacc.c  */
-#line 1923 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1921 "osm_qos_parser_y.y"
     {
                             /* 'path-bits' in 'qos-level' - any num of instances */
                             /* list of path bit ranges */
@@ -3820,8 +3788,8 @@ yyreduce:
 
   case 206:
 
-/* Line 1806 of yacc.c  */
-#line 1958 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1956 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -3829,8 +3797,8 @@ yyreduce:
 
   case 207:
 
-/* Line 1806 of yacc.c  */
-#line 1963 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1961 "osm_qos_parser_y.y"
     {
                             /* 'pkey' in 'qos-level' - num of instances of list of ranges */
                             if (cl_list_count(&tmp_parser_struct.num_pair_list))
@@ -3866,8 +3834,8 @@ yyreduce:
 
   case 208:
 
-/* Line 1806 of yacc.c  */
-#line 1996 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 1994 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -3875,8 +3843,8 @@ yyreduce:
 
   case 209:
 
-/* Line 1806 of yacc.c  */
-#line 2013 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2011 "osm_qos_parser_y.y"
     {
                             /* 'use' of 'qos-match-rule' - one instance */
                             cl_list_iterator_t    list_iterator;
@@ -3902,8 +3870,8 @@ yyreduce:
 
   case 210:
 
-/* Line 1806 of yacc.c  */
-#line 2036 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2034 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -3911,8 +3879,8 @@ yyreduce:
 
   case 211:
 
-/* Line 1806 of yacc.c  */
-#line 2041 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2039 "osm_qos_parser_y.y"
     {
                             /* 'qos-class' in 'qos-match-rule' - num of instances of list of ranges */
                             /* list of class ranges (QoS Class is 12-bit value) */
@@ -3949,8 +3917,8 @@ yyreduce:
 
   case 212:
 
-/* Line 1806 of yacc.c  */
-#line 2075 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2073 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -3958,8 +3926,8 @@ yyreduce:
 
   case 213:
 
-/* Line 1806 of yacc.c  */
-#line 2080 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2078 "osm_qos_parser_y.y"
     {
                             /* 'source' in 'qos-match-rule' - text */
                             cl_list_iterator_t    list_iterator;
@@ -3979,8 +3947,8 @@ yyreduce:
 
   case 214:
 
-/* Line 1806 of yacc.c  */
-#line 2097 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2095 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -3988,8 +3956,8 @@ yyreduce:
 
   case 215:
 
-/* Line 1806 of yacc.c  */
-#line 2102 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2100 "osm_qos_parser_y.y"
     {
                             /* 'destination' in 'qos-match-rule' - text */
                             cl_list_iterator_t    list_iterator;
@@ -4009,8 +3977,8 @@ yyreduce:
 
   case 216:
 
-/* Line 1806 of yacc.c  */
-#line 2119 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2117 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -4018,8 +3986,8 @@ yyreduce:
 
   case 217:
 
-/* Line 1806 of yacc.c  */
-#line 2124 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2122 "osm_qos_parser_y.y"
     {
                             /* 'qos-level-name' in 'qos-match-rule' - single string */
                             cl_list_iterator_t   list_iterator;
@@ -4045,8 +4013,8 @@ yyreduce:
 
   case 218:
 
-/* Line 1806 of yacc.c  */
-#line 2147 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2145 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -4054,8 +4022,8 @@ yyreduce:
 
   case 219:
 
-/* Line 1806 of yacc.c  */
-#line 2152 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2150 "osm_qos_parser_y.y"
     {
                             /* 'service-id' in 'qos-match-rule' - num of instances of list of ranges */
                             if (cl_list_count(&tmp_parser_struct.num_pair_list))
@@ -4091,8 +4059,8 @@ yyreduce:
 
   case 220:
 
-/* Line 1806 of yacc.c  */
-#line 2185 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2183 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -4100,8 +4068,8 @@ yyreduce:
 
   case 221:
 
-/* Line 1806 of yacc.c  */
-#line 2190 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2188 "osm_qos_parser_y.y"
     {
                             /* 'pkey' in 'qos-match-rule' - num of instances of list of ranges */
                             if (cl_list_count(&tmp_parser_struct.num_pair_list))
@@ -4137,8 +4105,8 @@ yyreduce:
 
   case 222:
 
-/* Line 1806 of yacc.c  */
-#line 2223 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2221 "osm_qos_parser_y.y"
     {
                             RESET_BUFFER;
                         }
@@ -4146,8 +4114,8 @@ yyreduce:
 
   case 223:
 
-/* Line 1806 of yacc.c  */
-#line 2234 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2232 "osm_qos_parser_y.y"
     {
                         cl_list_insert_tail(&tmp_parser_struct.str_list,
                                             strdup(__parser_strip_white(tmp_parser_struct.str)));
@@ -4157,8 +4125,8 @@ yyreduce:
 
   case 226:
 
-/* Line 1806 of yacc.c  */
-#line 2245 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2243 "osm_qos_parser_y.y"
     {
                         strcat(tmp_parser_struct.str,(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
@@ -4167,8 +4135,8 @@ yyreduce:
 
   case 232:
 
-/* Line 1806 of yacc.c  */
-#line 2265 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2263 "osm_qos_parser_y.y"
     {
                         uint64_t * p_num = (uint64_t*)malloc(sizeof(uint64_t));
                         __parser_str2uint64(p_num,(yyvsp[(1) - (1)]));
@@ -4179,8 +4147,8 @@ yyreduce:
 
   case 233:
 
-/* Line 1806 of yacc.c  */
-#line 2273 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2271 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         num_pair[0] = tmp_parser_struct.num_pair[0];
@@ -4191,8 +4159,8 @@ yyreduce:
 
   case 234:
 
-/* Line 1806 of yacc.c  */
-#line 2279 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2277 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         num_pair[0] = tmp_parser_struct.num_pair[0];
@@ -4203,8 +4171,8 @@ yyreduce:
 
   case 235:
 
-/* Line 1806 of yacc.c  */
-#line 2287 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2285 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[0],(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
@@ -4213,8 +4181,8 @@ yyreduce:
 
   case 236:
 
-/* Line 1806 of yacc.c  */
-#line 2293 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2291 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[1],(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
@@ -4223,8 +4191,8 @@ yyreduce:
 
   case 238:
 
-/* Line 1806 of yacc.c  */
-#line 2302 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2300 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         num_pair[0] = tmp_parser_struct.num_pair[0];
@@ -4235,8 +4203,8 @@ yyreduce:
 
   case 239:
 
-/* Line 1806 of yacc.c  */
-#line 2308 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2306 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         if (tmp_parser_struct.num_pair[0] <= tmp_parser_struct.num_pair[1]) {
@@ -4253,8 +4221,8 @@ yyreduce:
 
   case 240:
 
-/* Line 1806 of yacc.c  */
-#line 2320 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2318 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         if (tmp_parser_struct.num_pair[0] <= tmp_parser_struct.num_pair[1]) {
@@ -4271,8 +4239,8 @@ yyreduce:
 
   case 241:
 
-/* Line 1806 of yacc.c  */
-#line 2332 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2330 "osm_qos_parser_y.y"
     {
                         uint64_t * num_pair = (uint64_t*)malloc(sizeof(uint64_t)*2);
                         num_pair[0] = tmp_parser_struct.num_pair[0];
@@ -4283,8 +4251,8 @@ yyreduce:
 
   case 242:
 
-/* Line 1806 of yacc.c  */
-#line 2340 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2338 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[0],(yyvsp[(1) - (1)]));
                         __parser_str2uint64(&tmp_parser_struct.num_pair[1],(yyvsp[(1) - (1)]));
@@ -4294,8 +4262,8 @@ yyreduce:
 
   case 243:
 
-/* Line 1806 of yacc.c  */
-#line 2347 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2345 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[0],(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
@@ -4304,8 +4272,8 @@ yyreduce:
 
   case 244:
 
-/* Line 1806 of yacc.c  */
-#line 2353 "osm_qos_parser_y.y"
+/* Line 1455 of yacc.c  */
+#line 2351 "osm_qos_parser_y.y"
     {
                         __parser_str2uint64(&tmp_parser_struct.num_pair[1],(yyvsp[(1) - (1)]));
                         free((yyvsp[(1) - (1)]));
@@ -4314,21 +4282,10 @@ yyreduce:
 
 
 
-/* Line 1806 of yacc.c  */
-#line 4319 "osm_qos_parser_y.c"
+/* Line 1455 of yacc.c  */
+#line 4287 "osm_qos_parser_y.c"
       default: break;
     }
-  /* User semantic actions sometimes alter yychar, and that requires
-     that yytoken be updated with the new translation.  We take the
-     approach of translating immediately before every use of yytoken.
-     One alternative is translating here after every semantic action,
-     but that translation would be missed if the semantic action invokes
-     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
-     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
-     incorrect destructor might then be invoked immediately.  In the
-     case of YYERROR or YYBACKUP, subsequent parser actions might lead
-     to an incorrect destructor call or verbose syntax error message
-     before the lookahead is translated.  */
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
 
   YYPOPSTACK (yylen);
@@ -4356,10 +4313,6 @@ yyreduce:
 | yyerrlab -- here on detecting error |
 `------------------------------------*/
 yyerrlab:
-  /* Make sure we have latest lookahead translation.  See comments at
-     user semantic actions for why this is necessary.  */
-  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
   /* If not already recovering from an error, report this error.  */
   if (!yyerrstatus)
     {
@@ -4367,36 +4320,37 @@ yyerrlab:
 #if ! YYERROR_VERBOSE
       yyerror (YY_("syntax error"));
 #else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
-                                        yyssp, yytoken)
       {
-        char const *yymsgp = YY_("syntax error");
-        int yysyntax_error_status;
-        yysyntax_error_status = YYSYNTAX_ERROR;
-        if (yysyntax_error_status == 0)
-          yymsgp = yymsg;
-        else if (yysyntax_error_status == 1)
-          {
-            if (yymsg != yymsgbuf)
-              YYSTACK_FREE (yymsg);
-            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
-            if (!yymsg)
-              {
-                yymsg = yymsgbuf;
-                yymsg_alloc = sizeof yymsgbuf;
-                yysyntax_error_status = 2;
-              }
-            else
-              {
-                yysyntax_error_status = YYSYNTAX_ERROR;
-                yymsgp = yymsg;
-              }
-          }
-        yyerror (yymsgp);
-        if (yysyntax_error_status == 2)
-          goto yyexhaustedlab;
+	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
+	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+	  {
+	    YYSIZE_T yyalloc = 2 * yysize;
+	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
+	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
+	    if (yymsg != yymsgbuf)
+	      YYSTACK_FREE (yymsg);
+	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
+	    if (yymsg)
+	      yymsg_alloc = yyalloc;
+	    else
+	      {
+		yymsg = yymsgbuf;
+		yymsg_alloc = sizeof yymsgbuf;
+	      }
+	  }
+
+	if (0 < yysize && yysize <= yymsg_alloc)
+	  {
+	    (void) yysyntax_error (yymsg, yystate, yychar);
+	    yyerror (yymsg);
+	  }
+	else
+	  {
+	    yyerror (YY_("syntax error"));
+	    if (yysize != 0)
+	      goto yyexhaustedlab;
+	  }
       }
-# undef YYSYNTAX_ERROR
 #endif
     }
 
@@ -4455,7 +4409,7 @@ yyerrlab1:
   for (;;)
     {
       yyn = yypact[yystate];
-      if (!yypact_value_is_default (yyn))
+      if (yyn != YYPACT_NINF)
 	{
 	  yyn += YYTERROR;
 	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -4514,13 +4468,8 @@ yyexhaustedlab:
 
 yyreturn:
   if (yychar != YYEMPTY)
-    {
-      /* Make sure we have latest lookahead translation.  See comments at
-         user semantic actions for why this is necessary.  */
-      yytoken = YYTRANSLATE (yychar);
-      yydestruct ("Cleanup: discarding lookahead",
-                  yytoken, &yylval);
-    }
+     yydestruct ("Cleanup: discarding lookahead",
+		 yytoken, &yylval);
   /* Do not reclaim the symbols of the rule which action triggered
      this YYABORT or YYACCEPT.  */
   YYPOPSTACK (yylen);
@@ -4545,8 +4494,8 @@ yyreturn:
 
 
 
-/* Line 2067 of yacc.c  */
-#line 2359 "osm_qos_parser_y.y"
+/* Line 1675 of yacc.c  */
+#line 2357 "osm_qos_parser_y.y"
 
 
 /***************************************************
diff --git a/opensm/osm_qos_parser_y.h b/opensm/osm_qos_parser_y.h
index ca39639..490f2aa 100644
--- a/opensm/osm_qos_parser_y.h
+++ b/opensm/osm_qos_parser_y.h
@@ -1,8 +1,10 @@
-/* A Bison parser, made by GNU Bison 2.5.  */
 
-/* Bison interface for Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1.  */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
    
-      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   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
diff --git a/opensm/osm_qos_parser_y.y b/opensm/osm_qos_parser_y.y
index 4e01ed4..0b567c8 100644
--- a/opensm/osm_qos_parser_y.y
+++ b/opensm/osm_qos_parser_y.y
@@ -1648,8 +1648,7 @@ sl2vl_scope_from_list_of_ranges: list_of_ranges {
                                 num_pair = (uint64_t*)cl_list_obj(list_iterator);
                                 if (num_pair)
                                 {
-                                    if ( num_pair[0] < 0 ||
-                                         num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )
+                                    if ( num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )
                                     {
                                         yyerror("port number out of range 'from' list");
                                         free(num_pair);
@@ -1680,8 +1679,7 @@ sl2vl_scope_to_list_of_ranges: list_of_ranges {
                                 num_pair = (uint64_t*)cl_list_obj(list_iterator);
                                 if (num_pair)
                                 {
-                                    if ( num_pair[0] < 0 ||
-                                         num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )
+                                    if ( num_pair[1] >= OSM_QOS_POLICY_MAX_PORTS_ON_SWITCH )
                                     {
                                         yyerror("port number out of range 'to' list");
                                         free(num_pair);
diff --git a/opensm/osm_qos_policy.c b/opensm/osm_qos_policy.c
index c8526b9..391e38c 100644
--- a/opensm/osm_qos_policy.c
+++ b/opensm/osm_qos_policy.c
@@ -283,15 +283,16 @@ void osm_qos_policy_qos_level_destroy(osm_qos_level_t * p)
 	if (!p)
 		return;
 
-	if (p->name)
-		free(p->name);
-	if (p->use)
-		free(p->use);
+	free(p->name);
+	free(p->use);
 
 	for (i = 0; i < p->path_bits_range_len; i++)
 		free(p->path_bits_range_arr[i]);
-	if (p->path_bits_range_arr)
-		free(p->path_bits_range_arr);
+	free(p->path_bits_range_arr);
+
+	for(i = 0; i < p->pkey_range_len; i++)
+		free((p->pkey_range_arr[i]));
+	free(p->pkey_range_arr);
 
 	free(p);
 }
@@ -373,20 +374,23 @@ void osm_qos_policy_match_rule_destroy(osm_qos_match_rule_t * p)
 	if (p->use)
 		free(p->use);
 
-	for (i = 0; i < p->service_id_range_len; i++)
-		free(p->service_id_range_arr[i]);
-	if (p->service_id_range_arr)
+	if (p->service_id_range_arr) {
+		for (i = 0; i < p->service_id_range_len; i++)
+			free(p->service_id_range_arr[i]);
 		free(p->service_id_range_arr);
+	}
 
-	for (i = 0; i < p->qos_class_range_len; i++)
-		free(p->qos_class_range_arr[i]);
-	if (p->qos_class_range_arr)
+	if (p->qos_class_range_arr) {
+		for (i = 0; i < p->qos_class_range_len; i++)
+			free(p->qos_class_range_arr[i]);
 		free(p->qos_class_range_arr);
+	}
 
-	for (i = 0; i < p->pkey_range_len; i++)
-		free(p->pkey_range_arr[i]);
-	if (p->pkey_range_arr)
+	if (p->pkey_range_arr) {
+		for (i = 0; i < p->pkey_range_len; i++)
+			free(p->pkey_range_arr[i]);
 		free(p->pkey_range_arr);
+	}
 
 	cl_list_apply_func(&p->source_list, __free_single_element, NULL);
 	cl_list_remove_all(&p->source_list);
@@ -640,19 +644,19 @@ static osm_qos_match_rule_t *__qos_policy_get_match_rule_by_params(
 		 */
 		if (cl_list_count(&p_qos_match_rule->source_group_list)
 		    && cl_list_count(&p_qos_match_rule->destination_group_list)) {
-			if (!__qos_policy_is_port_in_group_list(p_qos_policy,
-								p_src_physp,
-								&p_qos_match_rule->
-								source_group_list)
-			    && !__qos_policy_is_port_in_group_list(p_qos_policy,
-								   p_dest_physp,
-								   &p_qos_match_rule->
-								   destination_group_list))
-			{
+			if (__qos_policy_is_port_in_group_list(p_qos_policy,
+							       p_src_physp,
+							       &p_qos_match_rule->
+							       source_group_list)
+			    && __qos_policy_is_port_in_group_list(p_qos_policy,
+								  p_dest_physp,
+								  &p_qos_match_rule->
+								  destination_group_list))
+				matched_by_sordguid = TRUE;
+			else {
 				list_iterator = cl_list_next(list_iterator);
 				continue;
 			}
-			matched_by_sordguid = TRUE;
 		}
 
 		/* If a match rule has QoS classes, PR request HAS
@@ -744,7 +748,7 @@ static osm_qos_match_rule_t *__qos_policy_get_match_rule_by_params(
 
 static osm_qos_level_t *__qos_policy_get_qos_level_by_name(
 		const osm_qos_policy_t * p_qos_policy,
-		char *name)
+		const char *name)
 {
 	osm_qos_level_t *p_qos_level = NULL;
 	cl_list_iterator_t list_iterator;
diff --git a/opensm/osm_req.c b/opensm/osm_req.c
index 1c3c172..b2cfefd 100644
--- a/opensm/osm_req.c
+++ b/opensm/osm_req.c
@@ -80,15 +80,17 @@ static ib_net64_t req_determine_mkey(IN osm_sm_t * sm,
 
 	/* hop_count == 0: destination port guid is SM */
 	if (p_path->hop_count == 0) {
-		if (p_sm_port != NULL)
-			dest_port_guid = sm->p_subn->sm_port_guid;
-		else
-			dest_port_guid = sm->p_subn->opt.guid;
+		dest_port_guid = sm->p_subn->sm_port_guid;
 		goto Remote_Guid;
 	}
 
-	if (p_sm_port)
-		p_physp = p_sm_port->p_physp;
+	if (p_sm_port) {
+		p_node = p_sm_port->p_node;
+		if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
+			p_physp = osm_node_get_physp_ptr(p_node, p_path->path[1]);
+		else
+			p_physp = p_sm_port->p_physp;
+	}
 
 	/* hop_count == 1: outgoing physp is SM physp */
 	for (hop = 2; p_physp && hop <= p_path->hop_count; hop++) {
@@ -104,8 +106,8 @@ static ib_net64_t req_determine_mkey(IN osm_sm_t * sm,
 	*/
 	if (!p_physp) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
-			"req_determine_mkey: ERR 1107: "
-			"Outgoing physp is null on non-hop_0!\n");
+			"ERR 1107: Outgoing physp is null on non-hop_0!\n");
+		osm_dump_dr_path_v2(sm->p_log, p_path, FILE_ID, OSM_LOG_ERROR);
 		dest_port_guid = 0;
 		goto Remote_Guid;
 	}
@@ -153,13 +155,14 @@ Remote_Guid:
 **********************************************************************/
 ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
 			    IN ib_net16_t attr_id, IN ib_net32_t attr_mod,
+			    IN boolean_t find_mkey, ib_net64_t m_key,
 			    IN cl_disp_msgid_t err_msg,
 			    IN const osm_madw_context_t * p_context)
 {
 	osm_madw_t *p_madw;
 	ib_api_status_t status = IB_SUCCESS;
+	ib_net64_t m_key_calc;
 	ib_net64_t tid;
-	ib_net64_t m_key;
 
 	CL_ASSERT(sm);
 
@@ -189,17 +192,23 @@ ib_api_status_t osm_req_get(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
 		tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)
 							 & (uint64_t)(0xFFFFFFFF));
 
-	m_key = req_determine_mkey(sm, p_path);
+	if (sm->p_subn->opt.m_key_lookup == TRUE) {
+		if (find_mkey == TRUE)
+			m_key_calc = req_determine_mkey(sm, p_path);
+		else
+			m_key_calc = m_key;
+	} else
+		m_key_calc = sm->p_subn->opt.m_key;
 
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 		"Getting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64
 		", MKey 0x%016" PRIx64 "\n",
 		ib_get_sm_attr_str(attr_id), cl_ntoh16(attr_id),
-		cl_ntoh32(attr_mod), cl_ntoh64(tid), cl_ntoh64(m_key));
+		cl_ntoh32(attr_mod), cl_ntoh64(tid), cl_ntoh64(m_key_calc));
 
 	ib_smp_init_new(osm_madw_get_smp_ptr(p_madw), IB_MAD_METHOD_GET,
 			tid, attr_id, attr_mod, p_path->hop_count,
-			m_key, p_path->path,
+			m_key_calc, p_path->path,
 			IB_LID_PERMISSIVE, IB_LID_PERMISSIVE);
 
 	p_madw->mad_addr.dest_lid = IB_LID_PERMISSIVE;
@@ -230,12 +239,13 @@ osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_pat
 				IN const uint8_t * p_payload,
 				IN size_t payload_size,
 				IN ib_net16_t attr_id, IN ib_net32_t attr_mod,
+				IN boolean_t find_mkey, IN ib_net64_t m_key,
 				IN cl_disp_msgid_t err_msg,
 				IN const osm_madw_context_t * p_context)
 {
 	osm_madw_t *p_madw = NULL;
+	ib_net64_t m_key_calc;
 	ib_net64_t tid;
-	ib_net64_t m_key;
 
 	CL_ASSERT(sm);
 
@@ -265,17 +275,23 @@ osm_madw_t *osm_prepare_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_pat
 		tid = cl_hton64((uint64_t) cl_atomic_inc(&sm->sm_trans_id)
 							 & (uint64_t)(0xFFFFFFFF));
 
-	m_key = req_determine_mkey(sm, p_path);
+	if (sm->p_subn->opt.m_key_lookup == TRUE) {
+		if (find_mkey == TRUE)
+			m_key_calc = req_determine_mkey(sm, p_path);
+		else
+			m_key_calc = m_key;
+	} else
+		m_key_calc = sm->p_subn->opt.m_key;
 
 	OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 		"Setting %s (0x%X), modifier 0x%X, TID 0x%" PRIx64
 		", MKey 0x%016" PRIx64 "\n",
 		ib_get_sm_attr_str(attr_id), cl_ntoh16(attr_id),
-		cl_ntoh32(attr_mod), cl_ntoh64(tid), cl_ntoh64(m_key));
+		cl_ntoh32(attr_mod), cl_ntoh64(tid), cl_ntoh64(m_key_calc));
 
 	ib_smp_init_new(osm_madw_get_smp_ptr(p_madw), IB_MAD_METHOD_SET,
 			tid, attr_id, attr_mod, p_path->hop_count,
-			m_key, p_path->path,
+			m_key_calc, p_path->path,
 			IB_LID_PERMISSIVE, IB_LID_PERMISSIVE);
 
 	p_madw->mad_addr.dest_lid = IB_LID_PERMISSIVE;
@@ -314,14 +330,15 @@ ib_api_status_t osm_req_set(IN osm_sm_t * sm, IN const osm_dr_path_t * p_path,
                             IN const uint8_t * p_payload,
                             IN size_t payload_size,
                             IN ib_net16_t attr_id, IN ib_net32_t attr_mod,
+			    IN boolean_t find_mkey, IN ib_net64_t m_key,
                             IN cl_disp_msgid_t err_msg,
                             IN const osm_madw_context_t * p_context)
 {
 	osm_madw_t *p_madw;
 	ib_api_status_t status = IB_SUCCESS;
 
-	p_madw = osm_prepare_req_set(sm, p_path, p_payload, payload_size,attr_id,
-				     attr_mod, err_msg, p_context);
+	p_madw = osm_prepare_req_set(sm, p_path, p_payload, payload_size, attr_id,
+				     attr_mod, find_mkey, m_key, err_msg, p_context);
 	if (p_madw == NULL)
 		status = IB_INSUFFICIENT_RESOURCES;
 	else
diff --git a/opensm/osm_sa.c b/opensm/osm_sa.c
index 674b913..ea4a4d0 100644
--- a/opensm/osm_sa.c
+++ b/opensm/osm_sa.c
@@ -49,6 +49,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <complib/cl_qmap.h>
@@ -382,10 +383,6 @@ Exit:
 void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
 		    cl_qlist_t *list)
 {
-	struct item_data {
-		cl_list_item_t list;
-		char data[0];
-	};
 	cl_list_item_t *item;
 	osm_madw_t *resp_madw;
 	ib_sa_mad_t *sa_mad, *resp_sa_mad;
@@ -478,7 +475,7 @@ void osm_sa_respond(osm_sa_t *sa, osm_madw_t *madw, size_t attr_size,
 
 	for (i = 0; i < num_rec; i++) {
 		item = cl_qlist_remove_head(list);
-		memcpy(p, ((struct item_data *)item)->data, attr_size);
+		memcpy(p, ((osm_sa_item_t *)item)->resp.data, attr_size);
 		p += attr_size;
 		free(item);
 	}
@@ -510,25 +507,54 @@ opensm_dump_to_file(osm_opensm_t * p_osm, const char *file_name,
 		    void (*dump_func) (osm_opensm_t * p_osm, FILE * file))
 {
 	char path[1024];
+	char path_tmp[1032];
 	FILE *file;
+	int fd, status = 0;
 
 	snprintf(path, sizeof(path), "%s/%s",
 		 p_osm->subn.opt.dump_files_dir, file_name);
 
-	file = fopen(path, "w");
+	snprintf(path_tmp, sizeof(path_tmp), "%s.tmp", path);
+
+	file = fopen(path_tmp, "w");
 	if (!file) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 4C01: "
 			"cannot open file \'%s\': %s\n",
-			file_name, strerror(errno));
+			path_tmp, strerror(errno));
 		return -1;
 	}
 
-	chmod(path, S_IRUSR | S_IWUSR);
+	chmod(path_tmp, S_IRUSR | S_IWUSR);
 
 	dump_func(p_osm, file);
 
+	if (p_osm->subn.opt.fsync_high_avail_files) {
+		if (fflush(file) == 0) {
+			fd = fileno(file);
+			if (fd != -1) {
+				if (fsync(fd) == -1)
+					OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
+						"ERR 4C08: fsync() failed (%s) for %s\n",
+						strerror(errno), path_tmp);
+			} else
+				OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 4C09: "
+					"fileno() failed for %s\n", path_tmp);
+		} else
+			OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 4C0A: "
+				"fflush() failed (%s) for %s\n",
+				strerror(errno), path_tmp);
+	}
+
 	fclose(file);
-	return 0;
+
+	status = rename(path_tmp, path);
+	if (status) {
+		OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 4C0B: "
+			"Failed to rename file:%s (err:%s)\n",
+			path_tmp, strerror(errno));
+	}
+
+	return status;
 }
 
 static void mcast_mgr_dump_one_port(cl_map_item_t * p_map_item, void *cxt)
diff --git a/opensm/osm_sa_class_port_info.c b/opensm/osm_sa_class_port_info.c
index 2682505..69abad5 100644
--- a/opensm/osm_sa_class_port_info.c
+++ b/opensm/osm_sa_class_port_info.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -201,7 +202,7 @@ void osm_cpi_rcv_process(IN void *context, IN void *data)
 	/* we only support GET */
 	if (p_sa_mad->method != IB_MAD_METHOD_GET) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1403: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for ClassPortInfo request\n",
 			ib_get_sa_method_str(p_sa_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
diff --git a/opensm/osm_sa_guidinfo_record.c b/opensm/osm_sa_guidinfo_record.c
index 92f3b1a..28f6c0f 100644
--- a/opensm/osm_sa_guidinfo_record.c
+++ b/opensm/osm_sa_guidinfo_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2012 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -60,6 +61,8 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
+#define SA_GIR_RESP_SIZE SA_ITEM_RESP_SIZE(guid_rec)
+
 #define MOD_GIR_COMP_MASK (IB_GIR_COMPMASK_LID | IB_GIR_COMPMASK_BLOCKNUM)
 
 typedef struct osm_gir_item {
@@ -83,12 +86,12 @@ static ib_api_status_t gir_rcv_new_gir(IN osm_sa_t * sa,
 				       IN const osm_physp_t * p_physp,
 				       IN uint8_t const block_num)
 {
-	osm_gir_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_GIR_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5102: "
 			"rec_item alloc failed\n");
@@ -100,16 +103,16 @@ static ib_api_status_t gir_rcv_new_gir(IN osm_sa_t * sa,
 		"New GUIDInfoRecord: lid %u, block num %d\n",
 		cl_ntoh16(match_lid), block_num);
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_GIR_RESP_SIZE);
 
-	p_rec_item->rec.lid = match_lid;
-	p_rec_item->rec.block_num = block_num;
+	p_rec_item->resp.guid_rec.lid = match_lid;
+	p_rec_item->resp.guid_rec.block_num = block_num;
 	if (p_physp->p_guids)
-		memcpy(&p_rec_item->rec.guid_info,
+		memcpy(&p_rec_item->resp.guid_rec.guid_info,
 		       *p_physp->p_guids + block_num * GUID_TABLE_MAX_ENTRIES,
 		       sizeof(ib_guid_info_t));
 	else if (!block_num)
-		p_rec_item->rec.guid_info.guid[0] = osm_physp_get_port_guid(p_physp);
+		p_rec_item->resp.guid_rec.guid_info.guid[0] = osm_physp_get_port_guid(p_physp);
 
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
@@ -322,18 +325,18 @@ static void guidinfo_respond(IN osm_sa_t *sa, IN osm_madw_t *p_madw,
 			     IN ib_guidinfo_record_t * p_guidinfo_rec)
 {
 	cl_qlist_t rec_list;
-	osm_gir_item_t *item;
+	osm_sa_item_t *item;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	item = malloc(sizeof(*item));
+	item = malloc(SA_GIR_RESP_SIZE);
 	if (!item) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5101: "
 			"rec_item alloc failed\n");
 		goto Exit;
 	}
 
-	item->rec = *p_guidinfo_rec;
+	item->resp.guid_rec = *p_guidinfo_rec;
 
 	cl_qlist_init(&rec_list);
 	cl_qlist_insert_tail(&rec_list, &item->list_item);
@@ -650,15 +653,21 @@ add_alias_guid:
 							    p_alias_guid->alias_guid,
 							    &p_alias_guid->map_item);
 		if (p_alias_guid_check != p_alias_guid) {
-			/* alias GUID is a duplicate */
-			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5108: "
-				"Duplicate alias port GUID 0x%" PRIx64
-				" index %d base port GUID 0x%" PRIx64 "\n",
-				cl_ntoh64(p_alias_guid->alias_guid), i,
-				cl_ntoh64(p_alias_guid->p_base_port->guid));
-			osm_alias_guid_delete(&p_alias_guid);
-			/* clear response guid at index to indicate duplicate */
-			p_rcvd_rec->guid_info.guid[i % 8] = 0;
+			/* alias GUID is a duplicate if it exists on another port or on the same port but at another index */
+			if (p_alias_guid_check->p_base_port != p_port ||
+			    (*p_port->p_physp->p_guids)[i] != set_alias_guid) {
+				OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5108: "
+					"Duplicate alias port GUID 0x%" PRIx64
+					" index %d base port GUID 0x%" PRIx64
+					", alias GUID already assigned to "
+					"base port GUID 0x%" PRIx64 "\n",
+					cl_ntoh64(p_alias_guid->alias_guid), i,
+					cl_ntoh64(p_alias_guid->p_base_port->guid),
+					cl_ntoh64(p_alias_guid_check->p_base_port->guid));
+				osm_alias_guid_delete(&p_alias_guid);
+				/* clear response guid at index to indicate duplicate */
+				p_rcvd_rec->guid_info.guid[i % 8] = 0;
+			}
 		} else {
 			del_alias_guid = (*p_port->p_physp->p_guids)[i];
 			if (del_alias_guid) {
@@ -795,7 +804,7 @@ void osm_gir_rcv_process(IN void *ctx, IN void *data)
 		break;
 	default:
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5105: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for GUIDInfoRecord request\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		break;
diff --git a/opensm/osm_sa_informinfo.c b/opensm/osm_sa_informinfo.c
index f20d834..5543c9a 100644
--- a/opensm/osm_sa_informinfo.c
+++ b/opensm/osm_sa_informinfo.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -63,10 +64,8 @@
 #include <opensm/osm_inform.h>
 #include <opensm/osm_pkey.h>
 
-typedef struct osm_iir_item {
-	cl_list_item_t list_item;
-	ib_inform_info_record_t rec;
-} osm_iir_item_t;
+#define SA_IIR_RESP_SIZE SA_ITEM_RESP_SIZE(inform_rec)
+#define SA_II_RESP_SIZE SA_ITEM_RESP_SIZE(inform)
 
 typedef struct osm_iir_search_ctxt {
 	const ib_inform_info_record_t *p_rcvd_rec;
@@ -76,6 +75,7 @@ typedef struct osm_iir_search_ctxt {
 	ib_net16_t subscriber_enum;
 	osm_sa_t *sa;
 	osm_physp_t *p_req_physp;
+	ib_net64_t sm_key;
 } osm_iir_search_ctxt_t;
 
 /**********************************************************************
@@ -208,23 +208,23 @@ Set(InformInfo) request.
 static void infr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 {
 	cl_qlist_t rec_list;
-	osm_iir_item_t *item;
+	osm_sa_item_t *item;
 
 	OSM_LOG_ENTER(sa->p_log);
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"Generating successful InformInfo response\n");
 
-	item = malloc(sizeof(*item));
+	item = malloc(SA_II_RESP_SIZE);
 	if (!item) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4303: "
 			"rec_item alloc failed\n");
 		goto Exit;
 	}
 
-	memcpy(&item->rec,
+	memcpy(&item->resp.inform,
 	       ib_sa_mad_get_payload_ptr(osm_madw_get_sa_mad_ptr(p_madw)),
-	       sizeof(item->rec));
+	       sizeof(ib_inform_info_t));
 
 	cl_qlist_init(&rec_list);
 	cl_qlist_insert_tail(&rec_list, &item->list_item);
@@ -244,7 +244,7 @@ static void sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,
 	osm_port_t *p_subscriber_port;
 	osm_physp_t *p_subscriber_physp;
 	const osm_physp_t *p_req_physp;
-	osm_iir_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -284,15 +284,25 @@ static void sa_inform_info_rec_by_comp_mask(IN osm_sa_t * sa,
 		goto Exit;
 	}
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_IIR_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 430E: "
 			"rec_item alloc failed\n");
 		goto Exit;
 	}
 
-	memcpy(&p_rec_item->rec, &p_infr->inform_record,
+	memcpy(&p_rec_item->resp.inform_rec, &p_infr->inform_record,
 	       sizeof(ib_inform_info_record_t));
+
+	/*
+	 * Per C15-0.2-1.16, InformInfoRecords shall always be
+	 * provided with the QPN set to 0, except for the case
+	 * of a trusted request, in which case the actual
+	 * subscriber QPN shall be returned.
+	 */
+	if (p_ctxt->sm_key == 0)
+		ib_inform_info_set_qpn(&p_rec_item->resp.inform_rec.inform_info, 0);
+
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
 Exit:
@@ -319,7 +329,7 @@ static void infr_rcv_process_get_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 	cl_qlist_t rec_list;
 	osm_iir_search_ctxt_t context;
 	osm_physp_t *p_req_physp;
-	osm_iir_item_t *item;
+	osm_sa_item_t *item;
 
 	OSM_LOG_ENTER(sa->p_log);
 
@@ -355,6 +365,7 @@ static void infr_rcv_process_get_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 	context.subscriber_enum = p_rcvd_rec->subscriber_enum;
 	context.sa = sa;
 	context.p_req_physp = p_req_physp;
+	context.sm_key = p_rcvd_mad->sm_key;
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"Query Subscriber GID:%s(%02X) Enum:0x%X(%02X)\n",
@@ -372,11 +383,11 @@ static void infr_rcv_process_get_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 	cl_plock_release(sa->p_lock);
 
 	/* clear reserved and pad fields in InformInfoRecord */
-	for (item = (osm_iir_item_t *) cl_qlist_head(&rec_list);
-	     item != (osm_iir_item_t *) cl_qlist_end(&rec_list);
-	     item = (osm_iir_item_t *) cl_qlist_next(&item->list_item)) {
-		memset(item->rec.reserved, 0, sizeof(item->rec.reserved));
-		memset(item->rec.pad, 0, sizeof(item->rec.pad));
+	for (item = (osm_sa_item_t *) cl_qlist_head(&rec_list);
+	     item != (osm_sa_item_t *) cl_qlist_end(&rec_list);
+	     item = (osm_sa_item_t *) cl_qlist_next(&item->list_item)) {
+		memset(item->resp.inform_rec.reserved, 0, sizeof(item->resp.inform_rec.reserved));
+		memset(item->resp.inform_rec.pad, 0, sizeof(item->resp.inform_rec.pad));
 	}
 
 	osm_sa_respond(sa, p_madw, sizeof(ib_inform_info_record_t), &rec_list);
@@ -454,6 +465,24 @@ static void infr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 	}
 
 	/*
+	 * Per C15-0.2-1.16, SubnAdmSet(InformInfo) subscriptions for
+	 * SM security traps shall be provided only if they come from a
+	 * trusted source.
+	 */
+	if ((p_sa_mad->sm_key == 0) && p_recvd_inform_info->is_generic &&
+	    ((cl_ntoh16(p_recvd_inform_info->g_or_v.generic.trap_num) >= 256) &&
+	     (cl_ntoh16(p_recvd_inform_info->g_or_v.generic.trap_num) <= 259))) {
+		cl_plock_release(sa->p_lock);
+
+		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 430B "
+			"Request for security trap from non-trusted requester: "
+			"Given SM_Key:0x%016" PRIx64 "\n",
+			cl_ntoh64(p_sa_mad->sm_key));
+		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
+		goto Exit;
+	}
+
+	/*
 	 * MODIFICATIONS DONE ON INCOMING REQUEST:
 	 *
 	 * QPN:
@@ -516,6 +545,10 @@ static void infr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 				goto Exit;
 			}
 
+			OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
+				"Adding event subscription for port 0x%" PRIx64 "\n",
+				cl_ntoh64(inform_info_rec.inform_record.subscriber_gid.unicast.interface_id));
+
 			/* Add this new osm_infr_t object to subnet object */
 			osm_infr_insert_to_db(sa->p_subn, sa->p_log, p_infr);
 		} else
@@ -533,9 +566,13 @@ static void infr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 		p_recvd_inform_info->subscribe = 0;
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
-	} else
+	} else {
 		/* Delete this object from the subnet list of informs */
+		OSM_LOG(sa->p_log, OSM_LOG_VERBOSE,
+			"Removing event subscription for port 0x%" PRIx64 "\n",
+			cl_ntoh64(inform_info_rec.inform_record.subscriber_gid.unicast.interface_id));
 		osm_infr_remove_from_db(sa->p_subn, sa->p_log, p_infr);
+	}
 
 	cl_plock_release(sa->p_lock);
 
@@ -561,7 +598,8 @@ void osm_infr_rcv_process(IN void *context, IN void *data)
 	CL_ASSERT(p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO);
 
 	if (p_sa_mad->method != IB_MAD_METHOD_SET) {
-		OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unsupported Method (%s)\n",
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Unsupported Method (%s) for InformInfo\n",
 			ib_get_sa_method_str(p_sa_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
@@ -589,7 +627,8 @@ void osm_infir_rcv_process(IN void *context, IN void *data)
 
 	if (p_sa_mad->method != IB_MAD_METHOD_GET &&
 	    p_sa_mad->method != IB_MAD_METHOD_GETTABLE) {
-		OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unsupported Method (%s)\n",
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"Unsupported Method (%s) for InformInfoRecord\n",
 			ib_get_sa_method_str(p_sa_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
diff --git a/opensm/osm_sa_lft_record.c b/opensm/osm_sa_lft_record.c
index 248d8f1..cf651ef 100644
--- a/opensm/osm_sa_lft_record.c
+++ b/opensm/osm_sa_lft_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -56,10 +57,7 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-typedef struct osm_lftr_item {
-	cl_list_item_t list_item;
-	ib_lft_record_t rec;
-} osm_lftr_item_t;
+#define SA_LFTR_RESP_SIZE SA_ITEM_RESP_SIZE(lft_rec)
 
 typedef struct osm_lftr_search_ctxt {
 	const ib_lft_record_t *p_rcvd_rec;
@@ -74,12 +72,12 @@ static ib_api_status_t lftr_rcv_new_lftr(IN osm_sa_t * sa,
 					 IN cl_qlist_t * p_list,
 					 IN ib_net16_t lid, IN uint16_t block)
 {
-	osm_lftr_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_LFTR_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4402: "
 			"rec_item alloc failed\n");
@@ -93,13 +91,13 @@ static ib_api_status_t lftr_rcv_new_lftr(IN osm_sa_t * sa,
 		cl_ntoh64(osm_node_get_node_guid(p_sw->p_node)),
 		block, cl_ntoh16(lid));
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_LFTR_RESP_SIZE);
 
-	p_rec_item->rec.lid = lid;
-	p_rec_item->rec.block_num = cl_hton16(block);
+	p_rec_item->resp.lft_rec.lid = lid;
+	p_rec_item->resp.lft_rec.block_num = cl_hton16(block);
 
 	/* copy the lft block */
-	osm_switch_get_lft_block(p_sw, block, p_rec_item->rec.lft);
+	osm_switch_get_lft_block(p_sw, block, p_rec_item->resp.lft_rec.lft);
 
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
@@ -200,7 +198,7 @@ void osm_lftr_rcv_process(IN void *ctx, IN void *data)
 	if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&
 	    p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4408: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for LFTRecord request\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
diff --git a/opensm/osm_sa_link_record.c b/opensm/osm_sa_link_record.c
index f91b654..5073f96 100644
--- a/opensm/osm_sa_link_record.c
+++ b/opensm/osm_sa_link_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -57,18 +58,15 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-typedef struct osm_lr_item {
-	cl_list_item_t list_item;
-	ib_link_record_t link_rec;
-} osm_lr_item_t;
+#define SA_LR_RESP_SIZE SA_ITEM_RESP_SIZE(link_rec)
 
 static void lr_rcv_build_physp_link(IN osm_sa_t * sa, IN ib_net16_t from_lid,
 				    IN ib_net16_t to_lid, IN uint8_t from_port,
 				    IN uint8_t to_port, IN cl_qlist_t * p_list)
 {
-	osm_lr_item_t *p_lr_item;
+	osm_sa_item_t *p_lr_item;
 
-	p_lr_item = malloc(sizeof(*p_lr_item));
+	p_lr_item = malloc(SA_LR_RESP_SIZE);
 	if (p_lr_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1801: "
 			"Unable to acquire link record\n"
@@ -78,12 +76,12 @@ static void lr_rcv_build_physp_link(IN osm_sa_t * sa, IN ib_net16_t from_lid,
 			cl_ntoh16(from_lid), cl_ntoh16(to_lid));
 		return;
 	}
-	memset(p_lr_item, 0, sizeof(*p_lr_item));
+	memset(p_lr_item, 0, SA_LR_RESP_SIZE);
 
-	p_lr_item->link_rec.from_port_num = from_port;
-	p_lr_item->link_rec.to_port_num = to_port;
-	p_lr_item->link_rec.to_lid = to_lid;
-	p_lr_item->link_rec.from_lid = from_lid;
+	p_lr_item->resp.link_rec.from_port_num = from_port;
+	p_lr_item->resp.link_rec.to_port_num = to_port;
+	p_lr_item->resp.link_rec.to_lid = to_lid;
+	p_lr_item->resp.link_rec.from_lid = from_lid;
 
 	cl_qlist_insert_tail(p_list, &p_lr_item->list_item);
 }
@@ -439,7 +437,7 @@ void osm_lr_rcv_process(IN void *context, IN void *data)
 	if (p_sa_mad->method != IB_MAD_METHOD_GET &&
 	    p_sa_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1804: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for LinkRecord request\n",
 			ib_get_sa_method_str(p_sa_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
diff --git a/opensm/osm_sa_mad_ctrl.c b/opensm/osm_sa_mad_ctrl.c
index 86c8fda..902803e 100644
--- a/opensm/osm_sa_mad_ctrl.c
+++ b/opensm/osm_sa_mad_ctrl.c
@@ -54,6 +54,7 @@
 #include <opensm/osm_msgdef.h>
 #include <opensm/osm_helper.h>
 #include <opensm/osm_sa.h>
+#include <opensm/osm_opensm.h>
 
 /****f* opensm: SA/sa_mad_ctrl_disp_done_callback
  * NAME
@@ -357,7 +358,11 @@ static void sa_mad_ctrl_rcv_callback(IN osm_madw_t * p_madw, IN void *context,
 #endif
 	case IB_MAD_METHOD_SET:
 	case IB_MAD_METHOD_DELETE:
-		sa_mad_ctrl_process(p_ctrl, p_madw);
+		/* if we are closing down simply do nothing */
+		if (osm_exit_flag)
+			osm_mad_pool_put(p_ctrl->p_mad_pool, p_madw);
+		else
+			sa_mad_ctrl_process(p_ctrl, p_madw);
 		break;
 
 	default:
diff --git a/opensm/osm_sa_mcmember_record.c b/opensm/osm_sa_mcmember_record.c
index c6069d6..ad6d5cd 100644
--- a/opensm/osm_sa_mcmember_record.c
+++ b/opensm/osm_sa_mcmember_record.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -66,6 +67,8 @@
 #include <opensm/osm_inform.h>
 #include <opensm/osm_sa.h>
 
+#define SA_MCM_RESP_SIZE SA_ITEM_RESP_SIZE(mc_rec)
+
 #define JOIN_MC_COMP_MASK (IB_MCR_COMPMASK_MGID | \
 				IB_MCR_COMPMASK_PORT_GID | \
 				IB_MCR_COMPMASK_JOIN_STATE)
@@ -79,11 +82,6 @@
 					IB_MCR_COMPMASK_FLOW | \
 					IB_MCR_COMPMASK_SL)
 
-typedef struct osm_mcmr_item {
-	cl_list_item_t list_item;
-	ib_member_rec_t rec;
-} osm_mcmr_item_t;
-
 /*********************************************************************
  Copy certain fields between two mcmember records
  used during the process of join request to copy data from the mgrp
@@ -97,6 +95,8 @@ static void copy_from_create_mc_rec(IN ib_member_rec_t * dest,
 	dest->tclass = src->tclass;
 	dest->pkey = src->pkey;
 	dest->sl_flow_hop = src->sl_flow_hop;
+	dest->scope_state = ib_member_set_scope_state(src->scope_state >> 4,
+						      dest->scope_state & 0x0F);
 	dest->mtu = src->mtu;
 	dest->rate = src->rate;
 	dest->pkt_life = src->pkt_life;
@@ -127,7 +127,7 @@ static void free_mlid(IN osm_sa_t * sa, IN uint16_t mlid)
 
 static int compare_ipv6_snm_mgids(const void *m1, const void *m2)
 {
-	return memcmp(m1, m2, sizeof(ib_gid_t) - 6);
+	return memcmp(m1, m2, sizeof(ib_gid_t) - 3);
 }
 
 static ib_net16_t find_ipv6_snm_mlid(osm_subn_t *subn, ib_gid_t *mgid)
@@ -193,26 +193,26 @@ static void mcmr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw,
 			     IN ib_member_rec_t * p_mcmember_rec)
 {
 	cl_qlist_t rec_list;
-	osm_mcmr_item_t *item;
+	osm_sa_item_t *item;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	item = malloc(sizeof(*item));
+	item = malloc(SA_MCM_RESP_SIZE);
 	if (!item) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B16: "
 			"rec_item alloc failed\n");
 		goto Exit;
 	}
 
-	item->rec = *p_mcmember_rec;
+	item->resp.mc_rec = *p_mcmember_rec;
 
 	/* Fill in the mtu, rate, and packet lifetime selectors */
-	item->rec.mtu &= 0x3f;
-	item->rec.mtu |= 2 << 6;	/* exactly */
-	item->rec.rate &= 0x3f;
-	item->rec.rate |= 2 << 6;	/* exactly */
-	item->rec.pkt_life &= 0x3f;
-	item->rec.pkt_life |= 2 << 6;	/* exactly */
+	item->resp.mc_rec.mtu &= 0x3f;
+	item->resp.mc_rec.mtu |= IB_PATH_SELECTOR_EXACTLY << 6;
+	item->resp.mc_rec.rate &= 0x3f;
+	item->resp.mc_rec.rate |= IB_PATH_SELECTOR_EXACTLY << 6;
+	item->resp.mc_rec.pkt_life &= 0x3f;
+	item->resp.mc_rec.pkt_life |= IB_PATH_SELECTOR_EXACTLY << 6;
 
 	cl_qlist_init(&rec_list);
 	cl_qlist_insert_tail(&rec_list, &item->list_item);
@@ -407,11 +407,19 @@ static boolean_t validate_modify(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp,
 		    request_gid.unicast.interface_id ||
 		    (*pp_mcm_alias_guid)->port_gid.unicast.prefix !=
 		    request_gid.unicast.prefix) {
+			ib_gid_t base_port_gid;
+			char gid_str[INET6_ADDRSTRLEN];
+			char gid_str2[INET6_ADDRSTRLEN];
+
+			base_port_gid.unicast.prefix = (*pp_mcm_alias_guid)->port_gid.unicast.prefix;
+			base_port_gid.unicast.interface_id = (*pp_mcm_alias_guid)->p_base_mcm_port->port->guid;
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 				"No ProxyJoin but different ports: stored:"
-				"0x%016" PRIx64 " request:0x%016" PRIx64 "\n",
-				cl_ntoh64((*pp_mcm_alias_guid)->p_base_mcm_port->port->guid),
-				cl_ntoh64(request_gid.unicast.interface_id));
+				"%s request:%s\n",
+				inet_ntop(AF_INET6, base_port_gid.raw, gid_str,
+					  sizeof gid_str),
+				inet_ntop(AF_INET6, request_gid.raw, gid_str2,
+					  sizeof gid_str2));
 			return FALSE;
 		}
 	} else {
@@ -546,9 +554,8 @@ static boolean_t validate_delete(IN osm_sa_t * sa, IN osm_mgrp_t * p_mgrp,
  *    scope bits set. (EZ: the idea here is that SA created MGIDs are the
  *    only source for this signature with link-local scope)
  */
-static ib_api_status_t validate_requested_mgid(IN osm_sa_t * sa,
-					       IN const ib_member_rec_t *
-					       p_mcm_rec)
+static boolean_t validate_requested_mgid(IN osm_sa_t * sa,
+					 IN const ib_member_rec_t * p_mcm_rec)
 {
 	uint16_t signature;
 	boolean_t valid = TRUE;
@@ -558,7 +565,8 @@ static ib_api_status_t validate_requested_mgid(IN osm_sa_t * sa,
 	/* 14-a: mcast GID must start with 0xFF */
 	if (p_mcm_rec->mgid.multicast.header[0] != 0xFF) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B01: "
-			"Wrong MGID Prefix 0x%02X must be 0xFF\n",
+			"Invalid prefix 0x%02X in requested MGID, "
+			"must be 0xFF\n",
 			cl_ntoh16(p_mcm_rec->mgid.multicast.header[0]));
 		valid = FALSE;
 		goto Exit;
@@ -599,7 +607,7 @@ static ib_api_status_t validate_requested_mgid(IN osm_sa_t * sa,
 	/* 14-b: the 3 upper bits in the "flags" should be zero: */
 	if (p_mcm_rec->mgid.multicast.header[1] & 0xE0) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B28: "
-			"MGID uses Reserved Flags: flags=0x%X\n",
+			"Requested MGID invalid, uses Reserved Flags: flags=0x%X\n",
 			(p_mcm_rec->mgid.multicast.header[1] & 0xE0) >> 4);
 		valid = FALSE;
 		goto Exit;
@@ -611,7 +619,8 @@ static ib_api_status_t validate_requested_mgid(IN osm_sa_t * sa,
 	    (p_mcm_rec->mgid.multicast.header[1] & 0x0F) ==
 	    IB_MC_SCOPE_LINK_LOCAL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B24: "
-			"MGID uses 0xA01B signature but with link-local scope\n");
+			"Requested MGID invalid, "
+			"uses 0xA01B signature but with link-local scope\n");
 		valid = FALSE;
 		goto Exit;
 	}
@@ -823,8 +832,6 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 				  sizeof gid_str));
 	} else if (!validate_requested_mgid(sa, &mcm_rec)) {
 		/* a specific MGID was requested so validate the resulting MGID */
-		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B22: "
-			"Invalid requested MGID\n");
 		status = IB_SA_MAD_STATUS_REQ_INVALID;
 		goto Exit;
 	}
@@ -863,11 +870,11 @@ static ib_api_status_t mcmr_rcv_create_new_mgrp(IN osm_sa_t * sa,
 
 	/* the mcmember_record should have mtu_sel, rate_sel, and pkt_lifetime_sel = 2 */
 	(*pp_mgrp)->mcmember_rec.mtu &= 0x3f;
-	(*pp_mgrp)->mcmember_rec.mtu |= 2 << 6;	/* exactly */
+	(*pp_mgrp)->mcmember_rec.mtu |= IB_PATH_SELECTOR_EXACTLY << 6;
 	(*pp_mgrp)->mcmember_rec.rate &= 0x3f;
-	(*pp_mgrp)->mcmember_rec.rate |= 2 << 6;	/* exactly */
+	(*pp_mgrp)->mcmember_rec.rate |= IB_PATH_SELECTOR_EXACTLY << 6;
 	(*pp_mgrp)->mcmember_rec.pkt_life &= 0x3f;
-	(*pp_mgrp)->mcmember_rec.pkt_life |= 2 << 6;	/* exactly */
+	(*pp_mgrp)->mcmember_rec.pkt_life |= IB_PATH_SELECTOR_EXACTLY << 6;
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
@@ -912,6 +919,18 @@ static void mcmr_rcv_leave_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 
 	mcmember_rec = *p_recvd_mcmember_rec;
 
+	/* Validate the subnet prefix in the PortGID */
+	if (p_recvd_mcmember_rec->port_gid.unicast.prefix !=
+	    sa->p_subn->opt.subnet_prefix) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"PortGID subnet prefix 0x%" PRIx64
+			" does not match configured prefix 0x%" PRIx64 "\n",
+			cl_ntoh64(p_recvd_mcmember_rec->port_gid.unicast.prefix),
+			cl_ntoh64(sa->p_subn->opt.subnet_prefix));
+		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_INVALID_GID);
+		goto Exit;
+	}
+
 	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
 		osm_physp_t *p_req_physp;
 
@@ -999,6 +1018,18 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 
 	mcmember_rec = *p_recvd_mcmember_rec;
 
+        /* Validate the subnet prefix in the PortGID */
+	if (p_recvd_mcmember_rec->port_gid.unicast.prefix !=
+	    sa->p_subn->opt.subnet_prefix) {
+		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
+			"PortGID subnet prefix 0x%" PRIx64
+			" does not match configured prefix 0x%" PRIx64 "\n",
+			cl_ntoh64(p_recvd_mcmember_rec->port_gid.unicast.prefix),
+			cl_ntoh64(sa->p_subn->opt.subnet_prefix));
+		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_INVALID_GID);
+		goto Exit;
+	}
+
 	if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) {
 		osm_physp_t *p_req_physp;
 
@@ -1071,8 +1102,8 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 			char gid_str[INET6_ADDRSTRLEN];
 			CL_PLOCK_RELEASE(sa->p_lock);
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B10: "
-				"Provided Join State != FullMember - "
-				"required for create, "
+				"Failed to create multicast group "
+				"because Join State != FullMember, "
 				"MGID: %s from port 0x%016" PRIx64 " (%s)\n",
 				inet_ntop(AF_INET6,
 					  p_recvd_mcmember_rec->mgid.raw,
@@ -1090,19 +1121,15 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 			char gid_str[INET6_ADDRSTRLEN];
 			CL_PLOCK_RELEASE(sa->p_lock);
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B11: "
-				"method = %s, scope_state = 0x%x, "
-				"component mask = 0x%016" PRIx64 ", "
-				"expected comp mask = 0x%016" PRIx64 ", "
-				"MGID: %s from port 0x%016" PRIx64 " (%s)\n",
-				ib_get_sa_method_str(p_sa_mad->method),
-				p_recvd_mcmember_rec->scope_state,
-				cl_ntoh64(p_sa_mad->comp_mask),
-				CL_NTOH64(REQUIRED_MC_CREATE_COMP_MASK),
+				"Port 0x%016" PRIx64 " (%s) failed to join "
+				"non-existing multicast group with MGID %s, "
+				"insufficient components specified for "
+				"implicit create (comp_mask 0x%" PRIx64 ")\n",
+				cl_ntoh64(portguid), p_port->p_node->print_desc,
 				inet_ntop(AF_INET6,
 					  p_recvd_mcmember_rec->mgid.raw,
 					  gid_str, sizeof gid_str),
-				cl_ntoh64(portguid),
-				p_port->p_node->print_desc);
+				cl_ntoh64(p_sa_mad->comp_mask));
 			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_INSUF_COMPS);
 			goto Exit;
@@ -1155,7 +1182,7 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B12: "
 			"validate_more_comp_fields, validate_port_caps, "
 			"or JoinState = 0 failed for MGID: %s port 0x%016" PRIx64
-			" (%s), " "sending IB_SA_MAD_STATUS_REQ_INVALID\n",
+			" (%s), sending IB_SA_MAD_STATUS_REQ_INVALID\n",
 			   inet_ntop(AF_INET6, p_mgrp->mcmember_rec.mgid.raw,
 				     gid_str, sizeof gid_str),
 			cl_ntoh64(portguid), p_port->p_node->print_desc);
@@ -1214,12 +1241,12 @@ static ib_api_status_t mcmr_rcv_new_mcmr(IN osm_sa_t * sa,
 					 IN const ib_member_rec_t * p_rcvd_rec,
 					 IN cl_qlist_t * p_list)
 {
-	osm_mcmr_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_MCM_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B15: "
 			"rec_item alloc failed\n");
@@ -1227,11 +1254,11 @@ static ib_api_status_t mcmr_rcv_new_mcmr(IN osm_sa_t * sa,
 		goto Exit;
 	}
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_MCM_RESP_SIZE);
 
 	/* HACK: Untrusted requesters should result with 0 Join
 	   State, Port Guid, and Proxy */
-	p_rec_item->rec = *p_rcvd_rec;
+	p_rec_item->resp.mc_rec = *p_rcvd_rec;
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
 Exit:
@@ -1462,14 +1489,14 @@ static void mcmr_query_mgrp(IN osm_sa_t * sa, IN osm_madw_t * p_madw)
 	 */
 
 	if (!p_rcvd_mad->sm_key) {
-		osm_mcmr_item_t *item;
-		for (item = (osm_mcmr_item_t *) cl_qlist_head(&rec_list);
-		     item != (osm_mcmr_item_t *) cl_qlist_end(&rec_list);
+		osm_sa_item_t *item;
+		for (item = (osm_sa_item_t *) cl_qlist_head(&rec_list);
+		     item != (osm_sa_item_t *) cl_qlist_end(&rec_list);
 		     item =
-		     (osm_mcmr_item_t *) cl_qlist_next(&item->list_item)) {
-			memset(&item->rec.port_gid, 0, sizeof(ib_gid_t));
-			ib_member_set_join_state(&item->rec, 0);
-			item->rec.proxy_join = 0;
+		     (osm_sa_item_t *) cl_qlist_next(&item->list_item)) {
+			memset(&item->resp.mc_rec.port_gid, 0, sizeof(ib_gid_t));
+			ib_member_set_join_state(&item->resp.mc_rec, 0);
+			item->resp.mc_rec.proxy_join = 0;
 		}
 	}
 
@@ -1598,7 +1625,7 @@ void osm_mcmr_rcv_process(IN void *context, IN void *data)
 		break;
 	default:
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1B21: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for MCMemberRecord request\n",
 			ib_get_sa_method_str(p_sa_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		break;
diff --git a/opensm/osm_sa_mft_record.c b/opensm/osm_sa_mft_record.c
index c67c923..6f9763f 100644
--- a/opensm/osm_sa_mft_record.c
+++ b/opensm/osm_sa_mft_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -56,10 +57,7 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-typedef struct osm_mftr_item {
-	cl_list_item_t list_item;
-	ib_mft_record_t rec;
-} osm_mftr_item_t;
+#define SA_MFTR_RESP_SIZE SA_ITEM_RESP_SIZE(mft_rec)
 
 typedef struct osm_mftr_search_ctxt {
 	const ib_mft_record_t *p_rcvd_rec;
@@ -75,13 +73,13 @@ static ib_api_status_t mftr_rcv_new_mftr(IN osm_sa_t * sa,
 					 IN ib_net16_t lid, IN uint16_t block,
 					 IN uint8_t position)
 {
-	osm_mftr_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 	uint16_t position_block_num;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_MFTR_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4A02: "
 			"rec_item alloc failed\n");
@@ -98,13 +96,13 @@ static ib_api_status_t mftr_rcv_new_mftr(IN osm_sa_t * sa,
 	position_block_num = ((uint16_t) position << 12) |
 	    (block & IB_MCAST_BLOCK_ID_MASK_HO);
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_MFTR_RESP_SIZE);
 
-	p_rec_item->rec.lid = lid;
-	p_rec_item->rec.position_block_num = cl_hton16(position_block_num);
+	p_rec_item->resp.mft_rec.lid = lid;
+	p_rec_item->resp.mft_rec.position_block_num = cl_hton16(position_block_num);
 
 	/* copy the mft block */
-	osm_switch_get_mft_block(p_sw, block, position, p_rec_item->rec.mft);
+	osm_switch_get_mft_block(p_sw, block, position, p_rec_item->resp.mft_rec.mft);
 
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
@@ -233,7 +231,7 @@ void osm_mftr_rcv_process(IN void *ctx, IN void *data)
 	if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&
 	    p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4A08: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for MFTRecord request\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
diff --git a/opensm/osm_sa_multipath_record.c b/opensm/osm_sa_multipath_record.c
index 99628af..9030278 100644
--- a/opensm/osm_sa_multipath_record.c
+++ b/opensm/osm_sa_multipath_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2006-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -66,23 +67,7 @@
 #define OSM_SA_MPR_MAX_NUM_PATH        127
 #define MAX_HOPS 64
 
-typedef struct osm_mpr_item {
-	cl_list_item_t list_item;
-	ib_path_rec_t path_rec;
-	const osm_port_t *p_src_port;
-	const osm_port_t *p_dest_port;
-	int hops;
-} osm_mpr_item_t;
-
-typedef struct osm_path_parms {
-	ib_net16_t pkey;
-	uint8_t mtu;
-	uint8_t rate;
-	uint8_t sl;
-	uint8_t pkt_life;
-	boolean_t reversible;
-	int hops;
-} osm_path_parms_t;
+#define SA_MPR_RESP_SIZE SA_ITEM_RESP_SIZE(mpr_rec)
 
 static boolean_t sa_multipath_rec_is_tavor_port(IN const osm_port_t * p_port)
 {
@@ -857,10 +842,10 @@ static void mpr_rcv_build_pr(IN osm_sa_t * sa,
 	p_dest_physp = p_dest_alias_guid->p_base_port->p_physp;
 
 	p_pr->dgid.unicast.prefix = osm_physp_get_subnet_prefix(p_dest_physp);
-	p_pr->dgid.unicast.interface_id = osm_physp_get_port_guid(p_dest_physp);
+	p_pr->dgid.unicast.interface_id = p_dest_alias_guid->alias_guid;
 
 	p_pr->sgid.unicast.prefix = osm_physp_get_subnet_prefix(p_src_physp);
-	p_pr->sgid.unicast.interface_id = osm_physp_get_port_guid(p_src_physp);
+	p_pr->sgid.unicast.interface_id = p_src_alias_guid->alias_guid;
 
 	p_pr->dlid = cl_hton16(dest_lid_ho);
 	p_pr->slid = cl_hton16(src_lid_ho);
@@ -889,21 +874,21 @@ static void mpr_rcv_build_pr(IN osm_sa_t * sa,
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-static osm_mpr_item_t *mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
-						 IN const ib_multipath_rec_t *
-						 p_mpr,
-						 IN const osm_alias_guid_t *
-						 p_src_alias_guid,
-						 IN const osm_alias_guid_t *
-						 p_dest_alias_guid,
-						 IN const uint16_t src_lid_ho,
-						 IN const uint16_t dest_lid_ho,
-						 IN const ib_net64_t comp_mask,
-						 IN const uint8_t preference)
+static osm_sa_item_t *mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
+						IN const ib_multipath_rec_t *
+						p_mpr,
+						IN const osm_alias_guid_t *
+						p_src_alias_guid,
+						IN const osm_alias_guid_t *
+						p_dest_alias_guid,
+						IN const uint16_t src_lid_ho,
+						IN const uint16_t dest_lid_ho,
+						IN const ib_net64_t comp_mask,
+						IN const uint8_t preference)
 {
 	osm_path_parms_t path_parms;
 	osm_path_parms_t rev_path_parms;
-	osm_mpr_item_t *p_pr_item;
+	osm_sa_item_t *p_pr_item;
 	ib_api_status_t status, rev_path_status;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -911,13 +896,13 @@ static osm_mpr_item_t *mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Src LID %u, Dest LID %u\n",
 		src_lid_ho, dest_lid_ho);
 
-	p_pr_item = malloc(sizeof(*p_pr_item));
+	p_pr_item = malloc(SA_MPR_RESP_SIZE);
 	if (p_pr_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4501: "
 			"Unable to allocate path record\n");
 		goto Exit;
 	}
-	memset(p_pr_item, 0, sizeof(*p_pr_item));
+	memset(p_pr_item, 0, SA_MPR_RESP_SIZE);
 
 	status = mpr_rcv_get_path_parms(sa, p_mpr, p_src_alias_guid,
 					p_dest_alias_guid, dest_lid_ho,
@@ -952,13 +937,13 @@ static osm_mpr_item_t *mpr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 		}
 	}
 
-	p_pr_item->p_src_port = p_src_alias_guid->p_base_port;
-	p_pr_item->p_dest_port = p_dest_alias_guid->p_base_port;
-	p_pr_item->hops = path_parms.hops;
+	p_pr_item->resp.mpr_rec.p_src_port = p_src_alias_guid->p_base_port;
+	p_pr_item->resp.mpr_rec.p_dest_port = p_dest_alias_guid->p_base_port;
+	p_pr_item->resp.mpr_rec.hops = path_parms.hops;
 
 	mpr_rcv_build_pr(sa, p_src_alias_guid, p_dest_alias_guid, src_lid_ho,
 			 dest_lid_ho, preference, &path_parms,
-			 &p_pr_item->path_rec);
+			 &p_pr_item->resp.mpr_rec.path_rec);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
@@ -974,7 +959,7 @@ static uint32_t mpr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 					    IN const ib_net64_t comp_mask,
 					    IN cl_qlist_t * p_list)
 {
-	osm_mpr_item_t *p_pr_item;
+	osm_sa_item_t *p_pr_item;
 	uint16_t src_lid_min_ho;
 	uint16_t src_lid_max_ho;
 	uint16_t dest_lid_min_ho;
@@ -1156,20 +1141,20 @@ Exit:
 #undef min
 #define min(x,y)	(((x) < (y)) ? (x) : (y))
 
-static osm_mpr_item_t *mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
-						       IN const
-						       ib_multipath_rec_t *
-						       p_mpr,
-						       IN const osm_alias_guid_t *
-						       p_src_alias_guid,
-						       IN const osm_alias_guid_t *
-						       p_dest_alias_guid,
-						       IN int base_offs,
-						       IN const ib_net64_t
-						       comp_mask,
-						       IN cl_qlist_t * p_list)
+static osm_sa_item_t *mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
+						      IN const
+						      ib_multipath_rec_t *
+						      p_mpr,
+						      IN const osm_alias_guid_t *
+						      p_src_alias_guid,
+						      IN const osm_alias_guid_t *
+						      p_dest_alias_guid,
+						      IN int base_offs,
+						      IN const ib_net64_t
+						      comp_mask,
+						      IN cl_qlist_t * p_list)
 {
-	osm_mpr_item_t *p_pr_item = 0;
+	osm_sa_item_t *p_pr_item = 0;
 	uint16_t src_lid_min_ho;
 	uint16_t src_lid_max_ho;
 	uint16_t dest_lid_min_ho;
@@ -1222,7 +1207,7 @@ static osm_mpr_item_t *mpr_rcv_get_apm_port_pair_paths(IN osm_sa_t * sa,
 		if (p_pr_item) {
 			OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 				"Found matching path from Src LID %u to Dest LID %u with %d hops\n",
-				src_lid_ho, dest_lid_ho, p_pr_item->hops);
+				src_lid_ho, dest_lid_ho, p_pr_item->resp.mpr_rec.hops);
 			break;
 		}
 
@@ -1357,7 +1342,7 @@ static void mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
 				  IN cl_qlist_t * p_list)
 {
 	osm_alias_guid_t *pp_alias_guids[4];
-	osm_mpr_item_t *matrix[2][2];
+	osm_sa_item_t *matrix[2][2];
 	int base_offs, src_lid_ho, dest_lid_ho;
 	int sumA, sumB, minA, minB;
 
@@ -1421,20 +1406,46 @@ static void mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "APM matrix:\n"
 		"\t{0,0} 0x%X->0x%X (%d)\t| {0,1} 0x%X->0x%X (%d)\n"
 		"\t{1,0} 0x%X->0x%X (%d)\t| {1,1} 0x%X->0x%X (%d)\n",
-		matrix[0][0]->path_rec.slid, matrix[0][0]->path_rec.dlid,
-		matrix[0][0]->hops, matrix[0][1]->path_rec.slid,
-		matrix[0][1]->path_rec.dlid, matrix[0][1]->hops,
-		matrix[1][0]->path_rec.slid, matrix[1][0]->path_rec.dlid,
-		matrix[1][0]->hops, matrix[1][1]->path_rec.slid,
-		matrix[1][1]->path_rec.dlid, matrix[1][1]->hops);
+		matrix[0][0] ? matrix[0][0]->resp.mpr_rec.path_rec.slid : 0,
+		matrix[0][0] ? matrix[0][0]->resp.mpr_rec.path_rec.dlid : 0,
+		matrix[0][0] ? matrix[0][0]->resp.mpr_rec.hops : 0,
+		matrix[0][1] ? matrix[0][1]->resp.mpr_rec.path_rec.slid : 0,
+		matrix[0][1] ? matrix[0][1]->resp.mpr_rec.path_rec.dlid : 0,
+		matrix[0][1] ? matrix[0][1]->resp.mpr_rec.hops : 0,
+		matrix[1][0] ? matrix[1][0]->resp.mpr_rec.path_rec.slid : 0,
+		matrix[1][0] ? matrix[1][0]->resp.mpr_rec.path_rec.dlid : 0,
+		matrix[1][0] ? matrix[1][0]->resp.mpr_rec.hops : 0,
+		matrix[1][1] ? matrix[1][1]->resp.mpr_rec.path_rec.slid : 0,
+		matrix[1][1] ? matrix[1][1]->resp.mpr_rec.path_rec.dlid : 0,
+		matrix[1][1] ? matrix[1][1]->resp.mpr_rec.hops : 0);
+
+	sumA = minA = sumB = minB = 0;
 
 	/* check diagonal A {(0,0), (1,1)} */
-	sumA = matrix[0][0]->hops + matrix[1][1]->hops;
-	minA = min(matrix[0][0]->hops, matrix[1][1]->hops);
+	if (matrix[0][0]) {
+		sumA += matrix[0][0]->resp.mpr_rec.hops;
+		minA = matrix[0][0]->resp.mpr_rec.hops;
+	}
+	if (matrix[1][1]) {
+		sumA += matrix[1][1]->resp.mpr_rec.hops;
+		if (minA)
+			minA = min(minA, matrix[1][1]->resp.mpr_rec.hops);
+		else
+			minA = matrix[1][1]->resp.mpr_rec.hops;
+	}
 
 	/* check diagonal B {(0,1), (1,0)} */
-	sumB = matrix[0][1]->hops + matrix[1][0]->hops;
-	minB = min(matrix[0][1]->hops, matrix[1][0]->hops);
+	if (matrix[0][1]) {
+		sumB += matrix[0][1]->resp.mpr_rec.hops;
+		minB = matrix[0][1]->resp.mpr_rec.hops;
+	}
+	if (matrix[1][0]) {
+		sumB += matrix[1][0]->resp.mpr_rec.hops;
+		if (minB)
+			minB = min(minB, matrix[1][0]->resp.mpr_rec.hops);
+		else
+			minB = matrix[1][0]->resp.mpr_rec.hops;
+	}
 
 	/* and the winner is... */
 	if (minA <= minB || (minA == minB && sumA < sumB)) {
@@ -1442,12 +1453,16 @@ static void mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Diag {0,0} & {1,1} is the best:\n"
 			"\t{0,0} 0x%X->0x%X (%d)\t & {1,1} 0x%X->0x%X (%d)\n",
-			matrix[0][0]->path_rec.slid,
-			matrix[0][0]->path_rec.dlid, matrix[0][0]->hops,
-			matrix[1][1]->path_rec.slid,
-			matrix[1][1]->path_rec.dlid, matrix[1][1]->hops);
-		cl_qlist_insert_tail(p_list, &matrix[0][0]->list_item);
-		cl_qlist_insert_tail(p_list, &matrix[1][1]->list_item);
+			matrix[0][0] ? matrix[0][0]->resp.mpr_rec.path_rec.slid : 0,
+			matrix[0][0] ? matrix[0][0]->resp.mpr_rec.path_rec.dlid : 0,
+			matrix[0][0] ? matrix[0][0]->resp.mpr_rec.hops : 0,
+			matrix[1][1] ? matrix[1][1]->resp.mpr_rec.path_rec.slid : 0,
+			matrix[1][1] ? matrix[1][1]->resp.mpr_rec.path_rec.dlid : 0,
+			matrix[1][1] ? matrix[1][1]->resp.mpr_rec.hops : 0);
+		if (matrix[0][0])
+			cl_qlist_insert_tail(p_list, &matrix[0][0]->list_item);
+		if (matrix[1][1])
+			cl_qlist_insert_tail(p_list, &matrix[1][1]->list_item);
 		free(matrix[0][1]);
 		free(matrix[1][0]);
 	} else {
@@ -1455,12 +1470,16 @@ static void mpr_rcv_get_apm_paths(IN osm_sa_t * sa,
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 			"Diag {0,1} & {1,0} is the best:\n"
 			"\t{0,1} 0x%X->0x%X (%d)\t & {1,0} 0x%X->0x%X (%d)\n",
-			matrix[0][1]->path_rec.slid,
-			matrix[0][1]->path_rec.dlid, matrix[0][1]->hops,
-			matrix[1][0]->path_rec.slid,
-			matrix[1][0]->path_rec.dlid, matrix[1][0]->hops);
-		cl_qlist_insert_tail(p_list, &matrix[0][1]->list_item);
-		cl_qlist_insert_tail(p_list, &matrix[1][0]->list_item);
+			matrix[0][1] ? matrix[0][1]->resp.mpr_rec.path_rec.slid : 0,
+			matrix[0][1] ? matrix[0][1]->resp.mpr_rec.path_rec.dlid : 0,
+			matrix[0][1] ? matrix[0][1]->resp.mpr_rec.hops : 0,
+			matrix[1][0] ? matrix[1][0]->resp.mpr_rec.path_rec.slid : 0,
+			matrix[1][0] ? matrix[1][0]->resp.mpr_rec.path_rec.dlid: 0,
+			matrix[1][0] ? matrix[1][0]->resp.mpr_rec.hops : 0);
+		if (matrix[0][1])
+			cl_qlist_insert_tail(p_list, &matrix[0][1]->list_item);
+		if (matrix[1][0])
+			cl_qlist_insert_tail(p_list, &matrix[1][0]->list_item);
 		free(matrix[0][0]);
 		free(matrix[1][1]);
 	}
@@ -1543,7 +1562,7 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 	/* we only support SubnAdmGetMulti method */
 	if (p_sa_mad->method != IB_MAD_METHOD_GETMULTI) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4513: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for MultiPathRecord request\n",
 			ib_get_sa_method_str(p_sa_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
@@ -1566,7 +1585,14 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 		osm_dump_multipath_record_v2(sa->p_log, p_mpr, FILE_ID, OSM_LOG_DEBUG);
 	}
 
-	/* Validatg rate if supplied */
+	/* Make sure required components (S/DGIDCount) are supplied */
+	if (!(p_sa_mad->comp_mask & IB_MPR_COMPMASK_SGIDCOUNT) ||
+	    !(p_sa_mad->comp_mask & IB_MPR_COMPMASK_DGIDCOUNT)) {
+		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_INSUF_COMPS);
+		goto Exit;
+	}
+
+	/* Validate rate if supplied */
 	if ((p_sa_mad->comp_mask & IB_MPR_COMPMASK_RATESELEC) &&
 	    (p_sa_mad->comp_mask & IB_MPR_COMPMASK_RATE)) {
 		rate = ib_multipath_rec_rate(p_mpr);
@@ -1587,6 +1613,14 @@ void osm_mpr_rcv_process(IN void *context, IN void *data)
 		}
 	}
 
+	/* Make sure either none or both ServiceID parameters are supplied */
+	if ((p_sa_mad->comp_mask & IB_MPR_COMPMASK_SERVICEID) != 0 &&
+	    (p_sa_mad->comp_mask & IB_MPR_COMPMASK_SERVICEID) !=
+	     IB_MPR_COMPMASK_SERVICEID) {
+		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_INSUF_COMPS);
+		goto Exit;
+	}
+
 	cl_qlist_init(&pr_list);
 
 	/*
diff --git a/opensm/osm_sa_node_record.c b/opensm/osm_sa_node_record.c
index c7a079e..19c7cc3 100644
--- a/opensm/osm_sa_node_record.c
+++ b/opensm/osm_sa_node_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2010 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -56,10 +57,7 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-typedef struct osm_nr_item {
-	cl_list_item_t list_item;
-	ib_node_record_t rec;
-} osm_nr_item_t;
+#define SA_NR_RESP_SIZE SA_ITEM_RESP_SIZE(node_rec)
 
 typedef struct osm_nr_search_ctxt {
 	const ib_node_record_t *p_rcvd_rec;
@@ -75,12 +73,12 @@ static ib_api_status_t nr_rcv_new_nr(osm_sa_t * sa,
 				     IN ib_net64_t port_guid, IN ib_net16_t lid,
 	                             IN unsigned int port_num)
 {
-	osm_nr_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_NR_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1D02: "
 			"rec_item alloc failed\n");
@@ -90,20 +88,20 @@ static ib_api_status_t nr_rcv_new_nr(osm_sa_t * sa,
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"New NodeRecord: node 0x%016" PRIx64
-		"\n\t\t\t\tport 0x%016" PRIx64 ", lid %u\n",
+		", port 0x%016" PRIx64 ", lid %u\n",
 		cl_ntoh64(osm_node_get_node_guid(p_node)),
 		cl_ntoh64(port_guid), cl_ntoh16(lid));
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_NR_RESP_SIZE);
 
-	p_rec_item->rec.lid = lid;
+	p_rec_item->resp.node_rec.lid = lid;
 
-	p_rec_item->rec.node_info = p_node->node_info;
-	p_rec_item->rec.node_info.port_guid = port_guid;
-	p_rec_item->rec.node_info.port_num_vendor_id =
-		(p_rec_item->rec.node_info.port_num_vendor_id & IB_NODE_INFO_VEND_ID_MASK) |
+	p_rec_item->resp.node_rec.node_info = p_node->node_info;
+	p_rec_item->resp.node_rec.node_info.port_guid = port_guid;
+	p_rec_item->resp.node_rec.node_info.port_num_vendor_id =
+		(p_rec_item->resp.node_rec.node_info.port_num_vendor_id & IB_NODE_INFO_VEND_ID_MASK) |
 		((port_num << IB_NODE_INFO_PORT_NUM_SHIFT) & IB_NODE_INFO_PORT_NUM_MASK);
-	memcpy(&(p_rec_item->rec.node_desc), &(p_node->node_desc),
+	memcpy(&(p_rec_item->resp.node_rec.node_desc), &(p_node->node_desc),
 	       IB_NODE_DESCRIPTION_SIZE);
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
@@ -308,7 +306,7 @@ void osm_nr_rcv_process(IN void *ctx, IN void *data)
 	if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&
 	    p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1D05: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for NodeRecord request\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
diff --git a/opensm/osm_sa_path_record.c b/opensm/osm_sa_path_record.c
index 3ab37e3..d9c59b8 100644
--- a/opensm/osm_sa_path_record.c
+++ b/opensm/osm_sa_path_record.c
@@ -6,6 +6,7 @@
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
  * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.
  * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -73,21 +74,9 @@
 #include <opensm/osm_prefix_route.h>
 #include <opensm/osm_ucast_lash.h>
 
-#define MAX_HOPS 64
-
-typedef struct osm_pr_item {
-	cl_list_item_t list_item;
-	ib_path_rec_t path_rec;
-} osm_pr_item_t;
+#define SA_PR_RESP_SIZE SA_ITEM_RESP_SIZE(path_rec)
 
-typedef struct osm_path_parms {
-	ib_net16_t pkey;
-	uint8_t mtu;
-	uint8_t rate;
-	uint8_t sl;
-	uint8_t pkt_life;
-	boolean_t reversible;
-} osm_path_parms_t;
+#define MAX_HOPS 64
 
 static inline boolean_t sa_path_rec_is_tavor_port(IN const osm_port_t * p_port)
 {
@@ -390,7 +379,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,
 					  ib_port_info_compute_rate(p_pi,
 								    p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS)) > 0)
 			rate = ib_port_info_compute_rate(p_pi,
-							 p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
+							 p_pi0->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS);
 
 		if (sa->p_subn->opt.qos) {
 			/*
@@ -650,7 +639,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1A: "
 				"Ports 0x%016" PRIx64 " (%s port %d) and "
 				"0x%016" PRIx64 " (%s port %d) "
-				" do not share specified PKey 0x%04x\n",
+				"do not share specified PKey 0x%04x\n",
 				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
 				p_src_physp->p_node->print_desc,
 				p_src_physp->port_num,
@@ -665,18 +654,18 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,
 		if (p_qos_level && p_qos_level->pkey_range_len &&
 		    !osm_qos_level_has_pkey(p_qos_level, pkey)) {
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F1D: "
-				"Ports 0x%016" PRIx64 " (%s port %d) and "
-				"0x%016"PRIx64" (%s port %d) "
-				"do not share PKeys defined by QoS level "
-				"\"%s\"\n",
+				"QoS level \"%s\" doesn't define specified PKey 0x%04x "
+				"for ports 0x%016" PRIx64 " (%s port %d) and "
+				"0x%016"PRIx64" (%s port %d)\n",
+				p_qos_level->name,
+				cl_ntoh16(pkey),
 				cl_ntoh64(osm_physp_get_port_guid(p_src_physp)),
 				p_src_physp->p_node->print_desc,
 				p_src_alias_guid->p_base_port->p_physp->port_num,
 				cl_ntoh64(osm_physp_get_port_guid
 					  (p_dest_physp)),
 				p_dest_physp->p_node->print_desc,
-				p_dest_alias_guid->p_base_port->p_physp->port_num,
-				p_qos_level->name);
+				p_dest_alias_guid->p_base_port->p_physp->port_num);
 			status = IB_NOT_FOUND;
 			goto Exit;
 		}
@@ -824,10 +813,28 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa,
 	 * send the currently computed SL value as a hint and let the routing
 	 * engine override it.
 	 */
-	if (p_re && p_re->path_sl)
+	if (p_re && p_re->path_sl) {
+		uint8_t pr_sl;
+		pr_sl = sl;
+
 		sl = p_re->path_sl(p_re->context, sl,
 				   cl_hton16(src_lid_ho), cl_hton16(dest_lid_ho));
 
+		if ((comp_mask & IB_PR_COMPMASK_SL) && (sl != pr_sl)) {
+			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F2A: "
+				"Requested SL (%u) doesn't match SL calculated"
+				"by routing engine (%u) "
+				"[%s port %d <-> %s port %d]\n",
+				pr_sl,
+				sl,
+				p_src_alias_guid->p_base_port->p_node->print_desc,
+				p_src_alias_guid->p_base_port->p_physp->port_num,
+				p_dest_alias_guid->p_base_port->p_node->print_desc,
+				p_dest_alias_guid->p_base_port->p_physp->port_num);
+			status = IB_NOT_FOUND;
+			goto Exit;
+		}
+	}
 	/* reset pkey when raw traffic */
 	if (comp_mask & IB_PR_COMPMASK_RAWTRAFFIC &&
 	    cl_ntoh32(p_pr->hop_flow_raw) & (1 << 31))
@@ -931,7 +938,7 @@ static void pr_rcv_build_pr(IN osm_sa_t * sa,
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
+static osm_sa_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 					       IN const ib_path_rec_t * p_pr,
 					       IN const osm_alias_guid_t * p_src_alias_guid,
 					       IN const osm_alias_guid_t * p_dest_alias_guid,
@@ -944,7 +951,7 @@ static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 {
 	osm_path_parms_t path_parms;
 	osm_path_parms_t rev_path_parms;
-	osm_pr_item_t *p_pr_item;
+	osm_sa_item_t *p_pr_item;
 	ib_api_status_t status, rev_path_status;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -952,13 +959,13 @@ static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Src LID %u, Dest LID %u\n",
 		src_lid_ho, dest_lid_ho);
 
-	p_pr_item = malloc(sizeof(*p_pr_item));
+	p_pr_item = malloc(SA_PR_RESP_SIZE);
 	if (p_pr_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F01: "
 			"Unable to allocate path record\n");
 		goto Exit;
 	}
-	memset(p_pr_item, 0, sizeof(*p_pr_item));
+	memset(p_pr_item, 0, SA_PR_RESP_SIZE);
 
 	status = pr_rcv_get_path_parms(sa, p_pr, p_src_alias_guid, src_lid_ho,
 				       p_dest_alias_guid, dest_lid_ho,
@@ -995,7 +1002,7 @@ static osm_pr_item_t *pr_rcv_get_lid_pair_path(IN osm_sa_t * sa,
 
 	pr_rcv_build_pr(sa, p_src_alias_guid, p_dest_alias_guid, p_sgid, p_dgid,
 			src_lid_ho, dest_lid_ho, preference, &path_parms,
-			&p_pr_item->path_rec);
+			&p_pr_item->resp.path_rec);
 
 Exit:
 	OSM_LOG_EXIT(sa->p_log);
@@ -1013,7 +1020,7 @@ static void pr_rcv_get_port_pair_paths(IN osm_sa_t * sa,
 {
 	const ib_path_rec_t *p_pr = ib_sa_mad_get_payload_ptr(sa_mad);
 	ib_net64_t comp_mask = sa_mad->comp_mask;
-	osm_pr_item_t *p_pr_item;
+	osm_sa_item_t *p_pr_item;
 	uint16_t src_lid_min_ho;
 	uint16_t src_lid_max_ho;
 	uint16_t dest_lid_min_ho;
@@ -1263,7 +1270,7 @@ static ib_net64_t find_router(const osm_sa_t *sa, ib_net64_t prefix)
 	return osm_port_get_guid(osm_router_get_port_ptr(rtr));
 }
 
-static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,
+ib_net16_t osm_pr_get_end_points(IN osm_sa_t * sa,
 					IN const ib_sa_mad_t *sa_mad,
 					OUT const osm_alias_guid_t ** pp_src_alias_guid,
 					OUT const osm_alias_guid_t ** pp_dest_alias_guid,
@@ -1442,7 +1449,7 @@ Exit:
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-static void pr_rcv_process_half(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
+void osm_pr_process_half(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
 				IN const osm_port_t * requester_port,
 				IN const osm_alias_guid_t * p_src_alias_guid,
 				IN const osm_alias_guid_t * p_dest_alias_guid,
@@ -1497,7 +1504,7 @@ static void pr_rcv_process_half(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
 	OSM_LOG_EXIT(sa->p_log);
 }
 
-static void pr_rcv_process_pair(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
+void osm_pr_process_pair(IN osm_sa_t * sa, IN const ib_sa_mad_t * sa_mad,
 				IN const osm_port_t * requester_port,
 				IN const osm_alias_guid_t * p_src_alias_guid,
 				IN const osm_alias_guid_t * p_dest_alias_guid,
@@ -1626,7 +1633,7 @@ static void pr_process_multicast(osm_sa_t * sa, const ib_sa_mad_t *sa_mad,
 	ib_path_rec_t *pr = ib_sa_mad_get_payload_ptr(sa_mad);
 	osm_mgrp_t *mgrp;
 	ib_api_status_t status;
-	osm_pr_item_t *pr_item;
+	osm_sa_item_t *pr_item;
 	uint32_t flow_label;
 	uint8_t sl, hop_limit;
 
@@ -1650,34 +1657,34 @@ static void pr_process_multicast(osm_sa_t * sa, const ib_sa_mad_t *sa_mad,
 		return;
 	}
 
-	pr_item = malloc(sizeof(*pr_item));
+	pr_item = malloc(SA_PR_RESP_SIZE);
 	if (pr_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F18: "
 			"Unable to allocate path record for MC group\n");
 		return;
 	}
-	memset(pr_item, 0, sizeof(*pr_item));
+	memset(pr_item, 0, SA_PR_RESP_SIZE);
 
 	/* Copy PathRecord request into response */
-	pr_item->path_rec = *pr;
+	pr_item->resp.path_rec = *pr;
 
 	/* Now, use the MC info to cruft up the PathRecord response */
-	pr_item->path_rec.dgid = mgrp->mcmember_rec.mgid;
-	pr_item->path_rec.dlid = mgrp->mcmember_rec.mlid;
-	pr_item->path_rec.tclass = mgrp->mcmember_rec.tclass;
-	pr_item->path_rec.num_path = 1;
-	pr_item->path_rec.pkey = mgrp->mcmember_rec.pkey;
+	pr_item->resp.path_rec.dgid = mgrp->mcmember_rec.mgid;
+	pr_item->resp.path_rec.dlid = mgrp->mcmember_rec.mlid;
+	pr_item->resp.path_rec.tclass = mgrp->mcmember_rec.tclass;
+	pr_item->resp.path_rec.num_path = 1;
+	pr_item->resp.path_rec.pkey = mgrp->mcmember_rec.pkey;
 
 	/* MTU, rate, and packet lifetime should be exactly */
-	pr_item->path_rec.mtu = (2 << 6) | mgrp->mcmember_rec.mtu;
-	pr_item->path_rec.rate = (2 << 6) | mgrp->mcmember_rec.rate;
-	pr_item->path_rec.pkt_life = (2 << 6) | mgrp->mcmember_rec.pkt_life;
+	pr_item->resp.path_rec.mtu = (IB_PATH_SELECTOR_EXACTLY << 6) | mgrp->mcmember_rec.mtu;
+	pr_item->resp.path_rec.rate = (IB_PATH_SELECTOR_EXACTLY << 6) | mgrp->mcmember_rec.rate;
+	pr_item->resp.path_rec.pkt_life = (IB_PATH_SELECTOR_EXACTLY << 6) | mgrp->mcmember_rec.pkt_life;
 
 	/* SL, Hop Limit, and Flow Label */
 	ib_member_get_sl_flow_hop(mgrp->mcmember_rec.sl_flow_hop,
 				  &sl, &flow_label, &hop_limit);
-	ib_path_rec_set_sl(&pr_item->path_rec, sl);
-	ib_path_rec_set_qos_class(&pr_item->path_rec, 0);
+	ib_path_rec_set_sl(&pr_item->resp.path_rec, sl);
+	ib_path_rec_set_qos_class(&pr_item->resp.path_rec, 0);
 
 	/* HopLimit is not yet set in non link local MC groups */
 	/* If it were, this would not be needed */
@@ -1685,7 +1692,7 @@ static void pr_process_multicast(osm_sa_t * sa, const ib_sa_mad_t *sa_mad,
 	    IB_MC_SCOPE_LINK_LOCAL)
 		hop_limit = IB_HOPLIMIT_MAX;
 
-	pr_item->path_rec.hop_flow_raw =
+	pr_item->resp.path_rec.hop_flow_raw =
 	    cl_hton32(hop_limit) | (flow_label << 8);
 
 	cl_qlist_insert_tail(list, &pr_item->list_item);
@@ -1714,7 +1721,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 	if (p_sa_mad->method != IB_MAD_METHOD_GET &&
 	    p_sa_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F17: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for PathRecord request\n",
 			ib_get_sa_method_str(p_sa_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
@@ -1758,6 +1765,14 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 		}
 	}
 
+	/* Make sure either none or both ServiceID parameters are supplied */
+	if ((p_sa_mad->comp_mask & IB_PR_COMPMASK_SERVICEID) != 0 &&
+	    (p_sa_mad->comp_mask & IB_PR_COMPMASK_SERVICEID) !=
+	     IB_PR_COMPMASK_SERVICEID) {
+		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_INSUF_COMPS);
+		goto Exit;
+	}
+
 	cl_qlist_init(&pr_list);
 
 	/*
@@ -1775,7 +1790,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG, "Unicast destination requested\n");
 
-	if (pr_rcv_get_end_points(sa, p_sa_mad,
+	if (osm_pr_get_end_points(sa, p_sa_mad,
 				  &p_src_alias_guid, &p_dest_alias_guid,
 				  &p_src_port, &p_dest_port,
 				  &p_sgid, &p_dgid) != IB_SA_MAD_STATUS_SUCCESS)
@@ -1786,11 +1801,11 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 	 */
 	if (p_src_alias_guid) {
 		if (p_dest_alias_guid)
-			pr_rcv_process_pair(sa, p_sa_mad, requester_port,
+			osm_pr_process_pair(sa, p_sa_mad, requester_port,
 					    p_src_alias_guid, p_dest_alias_guid,
 					    p_sgid, p_dgid, &pr_list);
 		else if (!p_dest_port)
-			pr_rcv_process_half(sa, p_sa_mad, requester_port,
+			osm_pr_process_half(sa, p_sa_mad, requester_port,
 					    p_src_alias_guid, NULL, p_sgid,
 					    p_dgid, &pr_list);
 		else {
@@ -1800,7 +1815,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 			       (osm_alias_guid_t *) cl_qmap_end(&sa->p_subn->alias_port_guid_tbl)) {
 				if (osm_get_port_by_alias_guid(sa->p_subn, p_dest_alias_guid->alias_guid) ==
 				    p_dest_port)
-					pr_rcv_process_pair(sa, p_sa_mad,
+					osm_pr_process_pair(sa, p_sa_mad,
 							    requester_port,
 							    p_src_alias_guid,
 							    p_dest_alias_guid,
@@ -1815,7 +1830,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 		}
 	} else {
 		if (p_dest_alias_guid)
-			pr_rcv_process_half(sa, p_sa_mad, requester_port,
+			osm_pr_process_half(sa, p_sa_mad, requester_port,
 					    NULL, p_dest_alias_guid, p_sgid,
 					    p_dgid, &pr_list);
 		else if (!p_src_port && !p_dest_port)
@@ -1832,7 +1847,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 				if (osm_get_port_by_alias_guid(sa->p_subn,
 							       p_src_alias_guid->alias_guid) ==
 				    p_src_port)
-					pr_rcv_process_half(sa, p_sa_mad,
+					osm_pr_process_half(sa, p_sa_mad,
 							    requester_port,
 							    p_src_alias_guid,
 							    NULL, p_sgid,
@@ -1847,7 +1862,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 				if (osm_get_port_by_alias_guid(sa->p_subn,
 							       p_dest_alias_guid->alias_guid) ==
 				    p_dest_port)
-					pr_rcv_process_half(sa, p_sa_mad,
+					osm_pr_process_half(sa, p_sa_mad,
 							    requester_port,
 							    NULL,
 							    p_dest_alias_guid,
@@ -1870,7 +1885,7 @@ void osm_pr_rcv_process(IN void *context, IN void *data)
 						if (osm_get_port_by_alias_guid(sa->p_subn,
 									       p_dest_alias_guid->alias_guid) ==
 						    p_dest_port)
-						pr_rcv_process_pair(sa,
+						osm_pr_process_pair(sa,
 								    p_sa_mad,
 								    requester_port,
 								    p_src_alias_guid,
diff --git a/opensm/osm_sa_pkey_record.c b/opensm/osm_sa_pkey_record.c
index 691a716..586c3eb 100644
--- a/opensm/osm_sa_pkey_record.c
+++ b/opensm/osm_sa_pkey_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -52,10 +53,7 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-typedef struct osm_pkey_item {
-	cl_list_item_t list_item;
-	ib_pkey_table_record_t rec;
-} osm_pkey_item_t;
+#define SA_PKEY_RESP_SIZE SA_ITEM_RESP_SIZE(pkey_rec)
 
 typedef struct osm_pkey_search_ctxt {
 	const ib_pkey_table_record_t *p_rcvd_rec;
@@ -70,13 +68,13 @@ static void sa_pkey_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
 			   IN osm_pkey_search_ctxt_t * p_ctxt,
 			   IN uint16_t block)
 {
-	osm_pkey_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	uint16_t lid;
 	ib_pkey_table_t *tbl;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_PKEY_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4602: "
 			"rec_item alloc failed\n");
@@ -94,20 +92,20 @@ static void sa_pkey_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
 		cl_ntoh64(osm_physp_get_port_guid(p_physp)),
 		cl_ntoh16(lid), osm_physp_get_port_num(p_physp), block);
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_PKEY_RESP_SIZE);
 
-	p_rec_item->rec.lid = lid;
-	p_rec_item->rec.block_num = block;
-	p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);
+	p_rec_item->resp.pkey_rec.lid = lid;
+	p_rec_item->resp.pkey_rec.block_num = block;
+	p_rec_item->resp.pkey_rec.port_num = osm_physp_get_port_num(p_physp);
 	/* FIXME: There are ninf.PartitionCap or swinf.PartitionEnforcementCap
 	   pkey entries so everything in that range is a valid block number
 	   even if opensm is not using it. Return 0. However things outside
-	   that range should return no entries.. Not sure how to figure that
+	   that range should return no entries. Not sure how to figure that
 	   here? The range of pkey_tbl can be less than the cap, so
 	   this falsely triggers. */
 	tbl = osm_pkey_tbl_block_get(osm_physp_get_pkey_tbl(p_physp), block);
 	if (tbl)
-		p_rec_item->rec.pkey_tbl = *tbl;
+		p_rec_item->resp.pkey_rec.pkey_tbl = *tbl;
 
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
@@ -240,7 +238,7 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&
 	    p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4605: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for PKeyRecord request\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
@@ -254,8 +252,8 @@ void osm_pkey_rec_rcv_process(IN void *ctx, IN void *data)
 	if (p_rcvd_mad->sm_key != sa->p_subn->opt.sa_key) {
 		/* This is not a trusted requester! */
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 4608: "
-			"Request from non-trusted requester: "
-			"Given SM_Key:0x%016" PRIx64 "\n",
+			"Ignoring PKeyRecord request from non-trusted requester"
+			" with SM_Key 0x%016" PRIx64 "\n",
 			cl_ntoh64(p_rcvd_mad->sm_key));
 		osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
 		goto Exit;
diff --git a/opensm/osm_sa_portinfo_record.c b/opensm/osm_sa_portinfo_record.c
index b9627c9..78d8d16 100644
--- a/opensm/osm_sa_portinfo_record.c
+++ b/opensm/osm_sa_portinfo_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -60,10 +61,7 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-typedef struct osm_pir_item {
-	cl_list_item_t list_item;
-	ib_portinfo_record_t rec;
-} osm_pir_item_t;
+#define SA_PIR_RESP_SIZE SA_ITEM_RESP_SIZE(port_rec)
 
 typedef struct osm_pir_search_ctxt {
 	const ib_portinfo_record_t *p_rcvd_rec;
@@ -79,14 +77,14 @@ static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa,
 				       IN osm_pir_search_ctxt_t * p_ctxt,
 				       IN ib_net16_t const lid)
 {
-	osm_pir_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	ib_port_info_t *p_pi;
 	osm_physp_t *p_physp0;
 	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_PIR_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2102: "
 			"rec_item alloc failed\n");
@@ -100,12 +98,12 @@ static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa,
 		cl_ntoh64(osm_physp_get_port_guid(p_physp)),
 		cl_ntoh16(lid), osm_physp_get_port_num(p_physp));
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_PIR_RESP_SIZE);
 
-	p_rec_item->rec.lid = lid;
-	p_rec_item->rec.port_info = p_physp->port_info;
+	p_rec_item->resp.port_rec.lid = lid;
+	p_rec_item->resp.port_rec.port_info = p_physp->port_info;
 	if (p_ctxt->comp_mask & IB_PIR_COMPMASK_OPTIONS)
-		p_rec_item->rec.options = p_ctxt->p_rcvd_rec->options;
+		p_rec_item->resp.port_rec.options = p_ctxt->p_rcvd_rec->options;
 	if ((p_ctxt->comp_mask & IB_PIR_COMPMASK_OPTIONS) == 0 ||
 	    (p_ctxt->p_rcvd_rec->options & 0x80) == 0) {
 		/* Does requested port have an extended link speed active ? */
@@ -118,7 +116,7 @@ static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa,
 		if ((p_pi->capability_mask & IB_PORT_CAP_HAS_EXT_SPEEDS) > 0) {
 			if (ib_port_info_get_link_speed_ext_active(&p_physp->port_info)) {
 				/* Add QDR bits to original link speed components */
-				p_pi = &p_rec_item->rec.port_info;
+				p_pi = &p_rec_item->resp.port_rec.port_info;
 				ib_port_info_set_link_speed_enabled(p_pi,
 								    ib_port_info_get_link_speed_enabled(p_pi) | IB_LINK_SPEED_ACTIVE_10);
 				p_pi->state_info1 =
@@ -130,7 +128,7 @@ static ib_api_status_t pir_rcv_new_pir(IN osm_sa_t * sa,
 			}
 		}
 	}
-	p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);
+	p_rec_item->resp.port_rec.port_num = osm_physp_get_port_num(p_physp);
 
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
@@ -534,7 +532,7 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&
 	    p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2105: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for PortInfoRecord request\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
@@ -579,7 +577,7 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 			sa_pir_by_comp_mask(sa, p_port->p_node, &context);
 		else
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2109: "
-				"No port found with LID %u\n",
+				"No port found with requested LID %u\n",
 				cl_ntoh16(p_rcvd_rec->lid));
 	} else
 		cl_qmap_apply_func(&sa->p_subn->node_guid_tbl,
@@ -595,11 +593,11 @@ void osm_pir_rcv_process(IN void *ctx, IN void *data)
 	   sm_key.
 	 */
 	if (!p_rcvd_mad->sm_key) {
-		osm_pir_item_t *item;
-		for (item = (osm_pir_item_t *) cl_qlist_head(&rec_list);
-		     item != (osm_pir_item_t *) cl_qlist_end(&rec_list);
-		     item = (osm_pir_item_t *) cl_qlist_next(&item->list_item))
-			item->rec.port_info.m_key = 0;
+		osm_sa_item_t *item;
+		for (item = (osm_sa_item_t *) cl_qlist_head(&rec_list);
+		     item != (osm_sa_item_t *) cl_qlist_end(&rec_list);
+		     item = (osm_sa_item_t *) cl_qlist_next(&item->list_item))
+			item->resp.port_rec.port_info.m_key = 0;
 	}
 
 	osm_sa_respond(sa, p_madw, sizeof(ib_portinfo_record_t), &rec_list);
diff --git a/opensm/osm_sa_service_record.c b/opensm/osm_sa_service_record.c
index fe21712..c2c6ea9 100644
--- a/opensm/osm_sa_service_record.c
+++ b/opensm/osm_sa_service_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -61,10 +62,7 @@
 #include <opensm/osm_service.h>
 #include <opensm/osm_pkey.h>
 
-typedef struct osm_sr_item {
-	cl_list_item_t list_item;
-	ib_service_record_t service_rec;
-} osm_sr_item_t;
+#define SA_SR_RESP_SIZE SA_ITEM_RESP_SIZE(service_rec)
 
 typedef struct osm_sr_match_item {
 	cl_qlist_t sr_list;
@@ -206,12 +204,12 @@ static void sr_rcv_respond(IN osm_sa_t * sa, IN osm_madw_t * p_madw,
 	   sm_key.
 	 */
 	if (!osm_madw_get_sa_mad_ptr(p_madw)->sm_key) {
-		osm_sr_item_t *item;
-		for (item = (osm_sr_item_t *) cl_qlist_head(p_list);
-		     item != (osm_sr_item_t *) cl_qlist_end(p_list);
-		     item = (osm_sr_item_t *) cl_qlist_next(&item->list_item))
-			memset(item->service_rec.service_key, 0,
-			       sizeof(item->service_rec.service_key));
+		osm_sa_item_t *item;
+		for (item = (osm_sa_item_t *) cl_qlist_head(p_list);
+		     item != (osm_sa_item_t *) cl_qlist_end(p_list);
+		     item = (osm_sa_item_t *) cl_qlist_next(&item->list_item))
+			memset(item->resp.service_rec.service_key, 0,
+			       sizeof(item->resp.service_rec.service_key));
 	}
 
 	osm_sa_respond(sa, p_madw, sizeof(ib_service_record_t), p_list);
@@ -221,7 +219,7 @@ static void get_matching_sr(IN cl_list_item_t * p_list_item, IN void *context)
 {
 	osm_sr_search_ctxt_t *p_ctxt = context;
 	osm_svcr_t *p_svcr = (osm_svcr_t *) p_list_item;
-	osm_sr_item_t *p_sr_pool_item;
+	osm_sa_item_t *p_sr_pool_item;
 	osm_sr_match_item_t *p_sr_item = p_ctxt->p_sr_item;
 	ib_net64_t comp_mask = p_sr_item->comp_mask;
 	const osm_physp_t *p_req_physp = p_ctxt->p_req_physp;
@@ -428,14 +426,14 @@ static void get_matching_sr(IN cl_list_item_t * p_list_item, IN void *context)
 		}
 	}
 
-	p_sr_pool_item = malloc(sizeof(*p_sr_pool_item));
+	p_sr_pool_item = malloc(SA_SR_RESP_SIZE);
 	if (p_sr_pool_item == NULL) {
 		OSM_LOG(p_sr_item->sa->p_log, OSM_LOG_ERROR, "ERR 2408: "
 			"Unable to acquire Service Record from pool\n");
 		goto Exit;
 	}
 
-	p_sr_pool_item->service_rec = p_svcr->service_record;
+	p_sr_pool_item->resp.service_rec = p_svcr->service_record;
 
 	cl_qlist_insert_tail(&p_sr_item->sr_list, &p_sr_pool_item->list_item);
 
@@ -513,7 +511,7 @@ static void sr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 	ib_service_record_t *p_recvd_service_rec;
 	ib_net64_t comp_mask;
 	osm_svcr_t *p_svcr;
-	osm_sr_item_t *p_sr_item;
+	osm_sa_item_t *p_sr_item;
 	cl_qlist_t sr_list;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -559,7 +557,7 @@ static void sr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 			cl_plock_release(sa->p_lock);
 
 			OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2411: "
-				"osm_svcr_get_by_rid failed\n");
+				"Failed to create new service record\n");
 
 			osm_sa_send_error(sa, p_madw,
 					  IB_SA_MAD_STATUS_NO_RESOURCES);
@@ -585,7 +583,7 @@ static void sr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 		p_svcr->modified_time = cl_get_time_stamp_sec();
 	}
 
-	p_sr_item = malloc(sizeof(*p_sr_item));
+	p_sr_item = malloc(SA_SR_RESP_SIZE);
 	if (p_sr_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2412: "
 			"Unable to acquire Service record\n");
@@ -597,7 +595,7 @@ static void sr_rcv_process_set_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 		/* Set the Default Service P_Key in the response */
 		p_recvd_service_rec->service_pkey = IB_DEFAULT_PKEY;
 
-	p_sr_item->service_rec = *p_recvd_service_rec;
+	p_sr_item->resp.service_rec = *p_recvd_service_rec;
 	cl_qlist_init(&sr_list);
 
 	cl_qlist_insert_tail(&sr_list, &p_sr_item->list_item);
@@ -613,7 +611,7 @@ static void sr_rcv_process_delete_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 	ib_sa_mad_t *p_sa_mad;
 	ib_service_record_t *p_recvd_service_rec;
 	osm_svcr_t *p_svcr;
-	osm_sr_item_t *p_sr_item;
+	osm_sa_item_t *p_sr_item;
 	cl_qlist_t sr_list;
 
 	OSM_LOG_ENTER(sa->p_log);
@@ -646,7 +644,7 @@ static void sr_rcv_process_delete_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 	osm_svcr_remove_from_db(sa->p_subn, sa->p_log, p_svcr);
 	cl_plock_release(sa->p_lock);
 
-	p_sr_item = malloc(sizeof(*p_sr_item));
+	p_sr_item = malloc(SA_SR_RESP_SIZE);
 	if (p_sr_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2413: "
 			"Unable to acquire Service record\n");
@@ -656,7 +654,7 @@ static void sr_rcv_process_delete_method(osm_sa_t * sa, IN osm_madw_t * p_madw)
 	}
 
 	/* provide back the copy of the record */
-	p_sr_item->service_rec = p_svcr->service_record;
+	p_sr_item->resp.service_rec = p_svcr->service_record;
 	cl_qlist_init(&sr_list);
 
 	cl_qlist_insert_tail(&sr_list, &p_sr_item->list_item);
@@ -714,7 +712,7 @@ void osm_sr_rcv_process(IN void *context, IN void *data)
 		break;
 	default:
 		OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for ServiceRecord request\n",
 			ib_get_sa_method_str(p_sa_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		break;
diff --git a/opensm/osm_sa_slvl_record.c b/opensm/osm_sa_slvl_record.c
index 6ff8bae..467ac0b 100644
--- a/opensm/osm_sa_slvl_record.c
+++ b/opensm/osm_sa_slvl_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -59,10 +60,7 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-typedef struct osm_slvl_item {
-	cl_list_item_t list_item;
-	ib_slvl_table_record_t rec;
-} osm_slvl_item_t;
+#define SA_SLVL_RESP_SIZE SA_ITEM_RESP_SIZE(slvl_rec)
 
 typedef struct osm_slvl_search_ctxt {
 	const ib_slvl_table_record_t *p_rcvd_rec;
@@ -77,12 +75,12 @@ static void sa_slvl_create(IN osm_sa_t * sa, IN const osm_physp_t * p_physp,
 			   IN osm_slvl_search_ctxt_t * p_ctxt,
 			   IN uint8_t in_port_idx)
 {
-	osm_slvl_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	uint16_t lid;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_SLVL_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2602: "
 			"rec_item alloc failed\n");
@@ -100,12 +98,14 @@ static void sa_slvl_create(IN osm_sa_t * sa, IN const osm_physp_t * p_physp,
 		cl_ntoh64(osm_physp_get_port_guid(p_physp)),
 		cl_ntoh16(lid), osm_physp_get_port_num(p_physp), in_port_idx);
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_SLVL_RESP_SIZE);
 
-	p_rec_item->rec.lid = lid;
-	p_rec_item->rec.out_port_num = osm_physp_get_port_num(p_physp);
-	p_rec_item->rec.in_port_num = in_port_idx;
-	p_rec_item->rec.slvl_tbl =
+	p_rec_item->resp.slvl_rec.lid = lid;
+	if (p_physp->p_node->node_info.node_type == IB_NODE_TYPE_SWITCH) {
+		p_rec_item->resp.slvl_rec.out_port_num = osm_physp_get_port_num(p_physp);
+		p_rec_item->resp.slvl_rec.in_port_num = in_port_idx;
+	}
+	p_rec_item->resp.slvl_rec.slvl_tbl =
 	    *(osm_physp_get_slvl_tbl(p_physp, in_port_idx));
 
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
@@ -226,7 +226,7 @@ void osm_slvl_rec_rcv_process(IN void *ctx, IN void *data)
 	if (p_rcvd_mad->method != IB_MAD_METHOD_GET &&
 	    p_rcvd_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2604: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for SL2VLRecord request\n",
 			ib_get_sa_method_str(p_rcvd_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
diff --git a/opensm/osm_sa_sminfo_record.c b/opensm/osm_sa_sminfo_record.c
index c60316d..83991f4 100644
--- a/opensm/osm_sa_sminfo_record.c
+++ b/opensm/osm_sa_sminfo_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -65,10 +66,7 @@
 #include <opensm/osm_sa.h>
 #include <opensm/osm_opensm.h>
 
-typedef struct osm_smir_item {
-	cl_list_item_t list_item;
-	ib_sminfo_record_t rec;
-} osm_smir_item_t;
+#define SA_SMIR_RESP_SIZE SA_ITEM_RESP_SIZE(sminfo_rec)
 
 typedef struct osm_smir_search_ctxt {
 	const ib_sminfo_record_t *p_rcvd_rec;
@@ -86,12 +84,12 @@ static ib_api_status_t smir_rcv_new_smir(IN osm_sa_t * sa,
 					 IN uint8_t const pri_state,
 					 IN const osm_physp_t * p_req_physp)
 {
-	osm_smir_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_SMIR_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2801: "
 			"rec_item alloc failed\n");
@@ -102,12 +100,12 @@ static ib_api_status_t smir_rcv_new_smir(IN osm_sa_t * sa,
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"New SMInfo: GUID 0x%016" PRIx64 "\n", cl_ntoh64(guid));
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_SMIR_RESP_SIZE);
 
-	p_rec_item->rec.lid = osm_port_get_base_lid(p_port);
-	p_rec_item->rec.sm_info.guid = guid;
-	p_rec_item->rec.sm_info.act_count = act_count;
-	p_rec_item->rec.sm_info.pri_state = pri_state;
+	p_rec_item->resp.sminfo_rec.lid = osm_port_get_base_lid(p_port);
+	p_rec_item->resp.sminfo_rec.sm_info.guid = guid;
+	p_rec_item->resp.sminfo_rec.sm_info.act_count = act_count;
+	p_rec_item->resp.sminfo_rec.sm_info.pri_state = pri_state;
 
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
@@ -204,7 +202,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 	if (sad_mad->method != IB_MAD_METHOD_GET &&
 	    sad_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2804: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for SMInfoRecord request\n",
 			ib_get_sa_method_str(sad_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
@@ -313,7 +311,7 @@ void osm_smir_rcv_process(IN void *ctx, IN void *data)
 				OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 280A: "
 					"No remote SM for GUID 0x%016" PRIx64
 					"\n", cl_ntoh64(port_guid));
-		} else {
+		} else if (!p_port) {
 			/* Go over all other known (remote) SMs */
 			cl_qmap_apply_func(&sa->p_subn->sm_guid_tbl,
 					   sa_smir_by_comp_mask_cb, &context);
diff --git a/opensm/osm_sa_sw_info_record.c b/opensm/osm_sa_sw_info_record.c
index d83e621..0776c8b 100644
--- a/opensm/osm_sa_sw_info_record.c
+++ b/opensm/osm_sa_sw_info_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -56,10 +57,7 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-typedef struct osm_sir_item {
-	cl_list_item_t list_item;
-	ib_switch_info_record_t rec;
-} osm_sir_item_t;
+#define SA_SIR_RESP_SIZE SA_ITEM_RESP_SIZE(swinfo_rec)
 
 typedef struct osm_sir_search_ctxt {
 	const ib_switch_info_record_t *p_rcvd_rec;
@@ -74,12 +72,12 @@ static ib_api_status_t sir_rcv_new_sir(IN osm_sa_t * sa,
 				       IN cl_qlist_t * p_list,
 				       IN ib_net16_t lid)
 {
-	osm_sir_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	ib_api_status_t status = IB_SUCCESS;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_SIR_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5308: "
 			"rec_item alloc failed\n");
@@ -90,10 +88,10 @@ static ib_api_status_t sir_rcv_new_sir(IN osm_sa_t * sa,
 	OSM_LOG(sa->p_log, OSM_LOG_DEBUG,
 		"New SwitchInfoRecord: lid %u\n", cl_ntoh16(lid));
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_SIR_RESP_SIZE);
 
-	p_rec_item->rec.lid = lid;
-	p_rec_item->rec.switch_info = p_sw->switch_info;
+	p_rec_item->resp.swinfo_rec.lid = lid;
+	p_rec_item->resp.swinfo_rec.switch_info = p_sw->switch_info;
 
 	cl_qlist_insert_tail(p_list, &p_rec_item->list_item);
 
@@ -218,7 +216,7 @@ void osm_sir_rcv_process(IN void *ctx, IN void *data)
 	if (sad_mad->method != IB_MAD_METHOD_GET &&
 	    sad_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 5305: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for SwitchInfoRecord request\n",
 			ib_get_sa_method_str(sad_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
diff --git a/opensm/osm_sa_vlarb_record.c b/opensm/osm_sa_vlarb_record.c
index 2ada36b..17b21a5 100644
--- a/opensm/osm_sa_vlarb_record.c
+++ b/opensm/osm_sa_vlarb_record.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -59,10 +60,7 @@
 #include <opensm/osm_pkey.h>
 #include <opensm/osm_sa.h>
 
-typedef struct osm_vl_arb_item {
-	cl_list_item_t list_item;
-	ib_vl_arb_table_record_t rec;
-} osm_vl_arb_item_t;
+#define SA_VLA_RESP_SIZE SA_ITEM_RESP_SIZE(vlarb_rec)
 
 typedef struct osm_vl_arb_search_ctxt {
 	const ib_vl_arb_table_record_t *p_rcvd_rec;
@@ -77,12 +75,12 @@ static void sa_vl_arb_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
 			     IN osm_vl_arb_search_ctxt_t * p_ctxt,
 			     IN uint8_t block)
 {
-	osm_vl_arb_item_t *p_rec_item;
+	osm_sa_item_t *p_rec_item;
 	uint16_t lid;
 
 	OSM_LOG_ENTER(sa->p_log);
 
-	p_rec_item = malloc(sizeof(*p_rec_item));
+	p_rec_item = malloc(SA_VLA_RESP_SIZE);
 	if (p_rec_item == NULL) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A02: "
 			"rec_item alloc failed\n");
@@ -100,12 +98,12 @@ static void sa_vl_arb_create(IN osm_sa_t * sa, IN osm_physp_t * p_physp,
 		cl_ntoh64(osm_physp_get_port_guid(p_physp)),
 		cl_ntoh16(lid), osm_physp_get_port_num(p_physp), block);
 
-	memset(p_rec_item, 0, sizeof(*p_rec_item));
+	memset(p_rec_item, 0, SA_VLA_RESP_SIZE);
 
-	p_rec_item->rec.lid = lid;
-	p_rec_item->rec.port_num = osm_physp_get_port_num(p_physp);
-	p_rec_item->rec.block_num = block;
-	p_rec_item->rec.vl_arb_tbl = *(osm_physp_get_vla_tbl(p_physp, block));
+	p_rec_item->resp.vlarb_rec.lid = lid;
+	p_rec_item->resp.vlarb_rec.port_num = osm_physp_get_port_num(p_physp);
+	p_rec_item->resp.vlarb_rec.block_num = block;
+	p_rec_item->resp.vlarb_rec.vl_arb_tbl = *(osm_physp_get_vla_tbl(p_physp, block));
 
 	cl_qlist_insert_tail(p_ctxt->p_list, &p_rec_item->list_item);
 
@@ -235,7 +233,7 @@ void osm_vlarb_rec_rcv_process(IN void *ctx, IN void *data)
 	if (sad_mad->method != IB_MAD_METHOD_GET &&
 	    sad_mad->method != IB_MAD_METHOD_GETTABLE) {
 		OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 2A05: "
-			"Unsupported Method (%s)\n",
+			"Unsupported Method (%s) for a VLArbRecord request\n",
 			ib_get_sa_method_str(sad_mad->method));
 		osm_sa_send_error(sa, p_madw, IB_MAD_STATUS_UNSUP_METHOD_ATTR);
 		goto Exit;
diff --git a/opensm/osm_sm_mad_ctrl.c b/opensm/osm_sm_mad_ctrl.c
index c384eca..11195e8 100644
--- a/opensm/osm_sm_mad_ctrl.c
+++ b/opensm/osm_sm_mad_ctrl.c
@@ -534,6 +534,7 @@ static void sm_mad_ctrl_process_trap_repress(IN osm_sm_mad_ctrl_t * p_ctrl,
 	 */
 	switch (p_smp->attr_id) {
 	case IB_MAD_ATTR_NOTICE:
+		sm_mad_ctrl_update_wire_stats(p_ctrl);
 		sm_mad_ctrl_retire_trans_mad(p_ctrl, p_madw);
 		break;
 	default:
diff --git a/opensm/osm_sm_state_mgr.c b/opensm/osm_sm_state_mgr.c
index 7da8258..0660fb9 100644
--- a/opensm/osm_sm_state_mgr.c
+++ b/opensm/osm_sm_state_mgr.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -73,19 +74,19 @@ void osm_report_sm_state(osm_sm_t * sm)
 	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE, buf);
 }
 
-static void sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm)
+static boolean_t sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm, uint8_t sm_state)
 {
 	osm_madw_context_t context;
 	const osm_port_t *p_port;
 	ib_api_status_t status;
 	osm_dr_path_t dr_path;
 	ib_net64_t guid;
+	boolean_t sent_req = FALSE;
 
 	OSM_LOG_ENTER(sm->p_log);
 
 	memset(&context, 0, sizeof(context));
-	CL_PLOCK_ACQUIRE(sm->p_lock);
-	if (sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY) {
+	if (sm_state == IB_SMINFO_STATE_STANDBY) {
 		/*
 		 * We are in STANDBY state - this means we need to poll the
 		 * master SM (according to master_guid).
@@ -103,13 +104,19 @@ static void sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm)
 		guid = sm->p_polling_sm->smi.guid;
 	}
 
+	/* Verify that SM is not polling itself */
+	if (guid == sm->p_subn->sm_port_guid) {
+		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
+			"OpenSM doesn't poll itself\n");
+		goto Exit;
+	}
+
 	p_port = osm_get_port_by_guid(sm->p_subn, guid);
 
 	if (p_port == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3203: "
 			"No port object for GUID 0x%016" PRIx64 "\n",
 			cl_ntoh64(guid));
-		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
 	}
 
@@ -118,22 +125,26 @@ static void sm_state_mgr_send_master_sm_info_req(osm_sm_t * sm)
 	memcpy(&dr_path, osm_physp_get_dr_path_ptr(p_port->p_physp), sizeof(osm_dr_path_t));
 
 	status = osm_req_get(sm, &dr_path,
-			     IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE,
-			     &context);
-	CL_PLOCK_RELEASE(sm->p_lock);
+			     IB_MAD_ATTR_SM_INFO, 0, FALSE,
+			     ib_port_info_get_m_key(&p_port->p_physp->port_info),
+			     CL_DISP_MSGID_NONE, &context);
 
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3204: "
 			"Failure requesting SMInfo (%s)\n",
 			ib_get_err_str(status));
+	else
+		sent_req = TRUE;
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
+
+	return (sent_req);
 }
 
 static void sm_state_mgr_start_polling(osm_sm_t * sm)
 {
-	uint32_t timeout = sm->p_subn->opt.sminfo_polling_timeout;
+	uint32_t timeout;
 	cl_status_t cl_status;
 
 	OSM_LOG_ENTER(sm->p_log);
@@ -146,7 +157,10 @@ static void sm_state_mgr_start_polling(osm_sm_t * sm)
 	/*
 	 * Send a SubnGet(SMInfo) query to the current (or new) master found.
 	 */
-	sm_state_mgr_send_master_sm_info_req(sm);
+	CL_PLOCK_ACQUIRE(sm->p_lock);
+	timeout = sm->p_subn->opt.sminfo_polling_timeout;
+	sm_state_mgr_send_master_sm_info_req(sm, sm->p_subn->sm_state);
+	CL_PLOCK_RELEASE(sm->p_lock);
 
 	/*
 	 * Start a timer that will wake up every sminfo_polling_timeout milliseconds.
@@ -156,7 +170,7 @@ static void sm_state_mgr_start_polling(osm_sm_t * sm)
 	cl_status = cl_timer_start(&sm->polling_timer, timeout);
 	if (cl_status != CL_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3210: "
-			"Failed to start timer\n");
+			"Failed to start polling timer\n");
 
 	OSM_LOG_EXIT(sm->p_log);
 }
@@ -164,21 +178,31 @@ static void sm_state_mgr_start_polling(osm_sm_t * sm)
 void osm_sm_state_mgr_polling_callback(IN void *context)
 {
 	osm_sm_t *sm = context;
-	uint32_t timeout = sm->p_subn->opt.sminfo_polling_timeout;
+	uint32_t timeout;
 	cl_status_t cl_status;
+	uint8_t sm_state;
 
 	OSM_LOG_ENTER(sm->p_log);
 
+	cl_spinlock_acquire(&sm->state_lock);
+	sm_state = sm->p_subn->sm_state;
+	cl_spinlock_release(&sm->state_lock);
+
+	CL_PLOCK_ACQUIRE(sm->p_lock);
+	timeout = sm->p_subn->opt.sminfo_polling_timeout;
+
 	/*
 	 * We can be here in one of two cases:
 	 * 1. We are a STANDBY sm polling on the master SM.
 	 * 2. We are a MASTER sm, waiting for a handover from a remote master sm.
 	 * If we are not in one of these cases - don't need to restart the poller.
 	 */
-	if (!((sm->p_subn->sm_state == IB_SMINFO_STATE_MASTER &&
+	if (!((sm_state == IB_SMINFO_STATE_MASTER &&
 	       sm->p_polling_sm != NULL) ||
-	      sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY))
+	      sm_state == IB_SMINFO_STATE_STANDBY)) {
+		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
+	}
 
 	/*
 	 * If we are a STANDBY sm and the osm_exit_flag is set, then let's
@@ -187,7 +211,8 @@ void osm_sm_state_mgr_polling_callback(IN void *context)
 	 * received. In other cases - it is not relevant whether or not the
 	 * signal is on - since we are currently in exit flow
 	 */
-	if (sm->p_subn->sm_state == IB_SMINFO_STATE_STANDBY && osm_exit_flag) {
+	if (sm_state == IB_SMINFO_STATE_STANDBY && osm_exit_flag) {
+		CL_PLOCK_RELEASE(sm->p_lock);
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 			"Signalling subnet_up_event\n");
 		cl_event_signal(&sm->subnet_up_event);
@@ -195,15 +220,15 @@ void osm_sm_state_mgr_polling_callback(IN void *context)
 	}
 
 	/*
-	 * Incr the retry number.
-	 * If it reached the max_retry_number in the subnet opt - call
+	 * If retry number reached the max_retry_number in the subnet opt - call
 	 * osm_sm_state_mgr_process with signal OSM_SM_SIGNAL_POLLING_TIMEOUT
 	 */
-	sm->retry_number++;
-	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "Retry number:%d\n",
+	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE, "SM State %d (%s), Retry number:%d\n",
+		sm->p_subn->sm_state,  osm_get_sm_mgr_state_str(sm->p_subn->sm_state),
 		sm->retry_number);
 
-	if (sm->retry_number >= sm->p_subn->opt.polling_retry_number) {
+	if (sm->retry_number > sm->p_subn->opt.polling_retry_number) {
+		CL_PLOCK_RELEASE(sm->p_lock);
 		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
 			"Reached polling_retry_number value in retry_number. "
 			"Go to DISCOVERY state\n");
@@ -212,13 +237,18 @@ void osm_sm_state_mgr_polling_callback(IN void *context)
 	}
 
 	/* Send a SubnGet(SMInfo) request to the remote sm (depends on our state) */
-	sm_state_mgr_send_master_sm_info_req(sm);
+	if (sm_state_mgr_send_master_sm_info_req(sm, sm_state)) {
+		/* Request sent, increment the retry number */
+		sm->retry_number++;
+	}
+
+	CL_PLOCK_RELEASE(sm->p_lock);
 
 	/* restart the timer */
 	cl_status = cl_timer_start(&sm->polling_timer, timeout);
 	if (cl_status != CL_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3211: "
-			"Failed to restart timer\n");
+			"Failed to restart polling timer\n");
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
@@ -294,11 +324,13 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 			break;
 		case OSM_SM_SIGNAL_HANDOVER:
 			/*
-			 * Do nothing. We will discover it later on. If we already discovered
-			 * this SM, and got the HANDOVER - this means the remote SM is of
-			 * lower priority. In this case we will stop polling it (since it is
-			 * a lower priority SM in STANDBY state).
+			 * Signal for a new sweep. We need to discover the other SM.
+			 * If we already discovered this SM, and got the
+			 * HANDOVER - this means the remote SM is of lower priority.
+			 * In this case we will stop polling it (since it is a lower
+			 * priority SM in STANDBY state).
 			 */
+			osm_sm_signal(sm, OSM_SIGNAL_SWEEP);
 			break;
 		default:
 			sm_state_mgr_signal_error(sm, signal);
@@ -328,7 +360,6 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 			 */
 			sm->p_subn->sm_state = IB_SMINFO_STATE_NOTACTIVE;
 			osm_report_sm_state(sm);
-			osm_vendor_set_sm(sm->mad_ctrl.h_bind, FALSE);
 			break;
 		case OSM_SM_SIGNAL_HANDOVER:
 			/*
@@ -412,8 +443,8 @@ ib_api_status_t osm_sm_state_mgr_process(osm_sm_t * sm,
 			 * handover from it.
 			 */
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-				"Forcing heavy sweep. "
-				"Received OSM_SM_SIGNAL_HANDOVER or OSM_SM_SIGNAL_POLLING_TIMEOUT\n");
+				"Forcing heavy sweep. Received signal %s\n",
+				osm_get_sm_mgr_signal_str(signal));
 			/* Force set_client_rereg_on_sweep, we don't know what the other
 			 * SM may have configure/done on the fabric.
 			 */
diff --git a/opensm/osm_sminfo_rcv.c b/opensm/osm_sminfo_rcv.c
index a0092a5..2e30ea0 100644
--- a/opensm/osm_sminfo_rcv.c
+++ b/opensm/osm_sminfo_rcv.c
@@ -2,6 +2,7 @@
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -116,7 +117,7 @@ static void smi_rcv_process_get_request(IN osm_sm_t * sm,
 	status = osm_resp_send(sm, p_madw, 0, payload);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F02: "
-			"Error sending response (%s)\n",
+			"Error sending SMInfo response (%s)\n",
 			ib_get_err_str(status));
 		goto Exit;
 	}
@@ -177,7 +178,7 @@ static void smi_rcv_process_set_request(IN osm_sm_t * sm,
 
 	if (p_smp->method != IB_MAD_METHOD_SET) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F03: "
-			"Unsupported method 0x%X\n", p_smp->method);
+			"Unsupported set method 0x%X\n", p_smp->method);
 		goto Exit;
 	}
 
@@ -213,7 +214,7 @@ static void smi_rcv_process_set_request(IN osm_sm_t * sm,
 		status = osm_resp_send(sm, p_madw, 7, payload);
 		if (status != IB_SUCCESS)
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F05: "
-				"Error sending response (%s)\n",
+				"Error sending SMInfo response (%s)\n",
 				ib_get_err_str(status));
 		CL_PLOCK_RELEASE(sm->p_lock);
 		goto Exit;
@@ -260,7 +261,7 @@ static void smi_rcv_process_set_request(IN osm_sm_t * sm,
 		status = osm_resp_send(sm, p_madw, 7, payload);
 		if (status != IB_SUCCESS)
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F08: "
-				"Error sending response (%s)\n",
+				"Error sending SMInfo response (%s)\n",
 				ib_get_err_str(status));
 		goto Exit;
 	}
@@ -269,7 +270,7 @@ static void smi_rcv_process_set_request(IN osm_sm_t * sm,
 	status = osm_resp_send(sm, p_madw, 0, payload);
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F09: "
-			"Error sending response (%s)\n",
+			"Error sending SMInfo response (%s)\n",
 			ib_get_err_str(status));
 
 	/* it is a legal packet - act according to it */
@@ -308,8 +309,9 @@ static void smi_rcv_process_get_sm(IN osm_sm_t * sm,
 	p_smi = &p_sm->smi;
 
 	OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
-		"Detected SM 0x%016" PRIx64 " in state %u\n",
-		cl_ntoh64(p_smi->guid), ib_sminfo_get_state(p_smi));
+		"Detected SM 0x%016" PRIx64 " in state %u (%s)\n",
+		cl_ntoh64(p_smi->guid), ib_sminfo_get_state(p_smi),
+		osm_get_sm_mgr_state_str(ib_sminfo_get_state(p_smi)));
 
 	/* Check the state of this SM vs. our own. */
 	switch (sm->p_subn->sm_state) {
@@ -383,11 +385,20 @@ static void smi_rcv_process_get_sm(IN osm_sm_t * sm,
 		switch (ib_sminfo_get_state(p_smi)) {
 		case IB_SMINFO_STATE_MASTER:
 			/* If this is a response due to our polling, this means that we are
-			   waiting for a handover from this SM, and it is still alive -
-			   signal that. */
-			if (sm->p_polling_sm)
+			 * waiting for a handover from this SM, and it is still alive -
+			 * signal that. If we detected the remote SM with higher priority
+			 * we should init a heavy sweep in order to go STANDBY. If we
+			 * detected a remote SM with lower priority, we should resend trap144
+			 * as it might not get it and we don't want to wait for a HANDOVER
+			 * forever.
+			 */
+			if (sm->p_polling_sm) {
+				if (smi_rcv_remote_sm_is_higher(sm, p_smi))
+					sm->p_subn->force_heavy_sweep = TRUE;
+				else
+					osm_send_trap144(sm, TRAP_144_MASK_SM_PRIORITY_CHANGE);
 				osm_sm_state_mgr_signal_master_is_alive(sm);
-			else {
+			} else {
 				/* This is a response we got while sweeping the subnet.
 				 *
 				 * If this is during a heavy sweep, we will handle a case of
@@ -443,7 +454,7 @@ static void smi_rcv_process_get_response(IN osm_sm_t * sm,
 
 	if (p_smp->method != IB_MAD_METHOD_GET_RESP) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F11: "
-			"Unsupported method 0x%X\n", p_smp->method);
+			"Unsupported response method 0x%X\n", p_smp->method);
 		goto Exit;
 	}
 
@@ -477,7 +488,7 @@ static void smi_rcv_process_get_response(IN osm_sm_t * sm,
 
 	if (osm_port_get_guid(p_port) != p_smi->guid) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F13: "
-			"Bogus SM port GUID\n\t\t\t\tExpected 0x%016" PRIx64
+			"Bogus SM port GUID, Expected 0x%016" PRIx64
 			", Received 0x%016" PRIx64 "\n",
 			cl_ntoh64(osm_port_get_guid(p_port)),
 			cl_ntoh64(p_smi->guid));
@@ -532,7 +543,7 @@ static void smi_rcv_process_set_response(IN osm_sm_t * sm,
 
 	if (p_smp->method != IB_MAD_METHOD_GET_RESP) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F16: "
-			"Unsupported method 0x%X\n", p_smp->method);
+			"Unsupported response method 0x%X\n", p_smp->method);
 		goto Exit;
 	}
 
@@ -542,7 +553,8 @@ static void smi_rcv_process_set_response(IN osm_sm_t * sm,
 	/* Check the AttributeModifier */
 	if (p_smp->attr_mod != IB_SMINFO_ATTR_MOD_HANDOVER) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F17: "
-			"Unsupported attribute modifier 0x%X\n",
+			"Unsupported attribute modifier 0x%X, "
+			"expected ATTR_MOD_HANDOVER\n",
 			p_smp->attr_mod);
 		goto Exit;
 	}
@@ -585,7 +597,7 @@ void osm_sminfo_rcv_process(IN void *context, IN void *data)
 		if (p_smi_context->port_guid != p_smi->guid) {
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 2F19: "
 				"Unexpected SM port GUID in response"
-				"\n\t\t\t\tExpected 0x%016" PRIx64
+				", Expected 0x%016" PRIx64
 				", Received 0x%016" PRIx64 "\n",
 				cl_ntoh64(p_smi_context->port_guid),
 				cl_ntoh64(p_smi->guid));
diff --git a/opensm/osm_state_mgr.c b/opensm/osm_state_mgr.c
index 31f994a..c86627d 100644
--- a/opensm/osm_state_mgr.c
+++ b/opensm/osm_state_mgr.c
@@ -4,6 +4,7 @@
  * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -97,6 +98,8 @@ static void state_mgr_reset_node_count(IN cl_map_item_t * p_map_item,
 	osm_node_t *p_node = (osm_node_t *) p_map_item;
 
 	p_node->discovery_count = 0;
+
+	memset(p_node->physp_discovered, 0, sizeof(uint8_t) * p_node->physp_tbl_size);
 }
 
 static void state_mgr_reset_port_count(IN cl_map_item_t * p_map_item,
@@ -119,6 +122,7 @@ static void state_mgr_reset_switch_count(IN cl_map_item_t * p_map_item,
 static void state_mgr_get_sw_info(IN cl_map_item_t * p_object, IN void *context)
 {
 	osm_node_t *p_node;
+	osm_physp_t *p_physp;
 	osm_dr_path_t *p_dr_path;
 	osm_madw_context_t mad_context;
 	osm_switch_t *const p_sw = (osm_switch_t *) p_object;
@@ -128,20 +132,23 @@ static void state_mgr_get_sw_info(IN cl_map_item_t * p_object, IN void *context)
 	OSM_LOG_ENTER(sm->p_log);
 
 	p_node = p_sw->p_node;
-	p_dr_path =
-	    osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
+	p_physp = osm_node_get_physp_ptr(p_node, 0);
+	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);
 
 	memset(&mad_context, 0, sizeof(mad_context));
 
 	mad_context.si_context.node_guid = osm_node_get_node_guid(p_node);
 	mad_context.si_context.set_method = FALSE;
 	mad_context.si_context.light_sweep = TRUE;
+	mad_context.si_context.lft_top_change = FALSE;
 
 	status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_SWITCH_INFO, 0,
+			     FALSE, ib_port_info_get_m_key(&p_physp->port_info),
 			     OSM_MSG_LIGHT_SWEEP_FAIL, &mad_context);
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3304: "
-			"Request for SwitchInfo failed (%s)\n",
+			"Request for SwitchInfo from 0x%" PRIx64 " failed (%s)\n",
+			cl_ntoh64(osm_node_get_node_guid(p_node)),
 			ib_get_err_str(status));
 
 	OSM_LOG_EXIT(sm->p_log);
@@ -179,15 +186,16 @@ static void state_mgr_get_remote_port_info(IN osm_sm_t * sm,
 	mad_context.pi_context.set_method = FALSE;
 	mad_context.pi_context.light_sweep = TRUE;
 	mad_context.pi_context.active_transition = FALSE;
+	mad_context.pi_context.client_rereg = FALSE;
 
 	/* note that with some negative logic - if the query failed it means
 	 * that there is no point in going to heavy sweep */
 	status = osm_req_get(sm, &rem_node_dr_path, IB_MAD_ATTR_PORT_INFO, 0,
-			     CL_DISP_MSGID_NONE, &mad_context);
+			     TRUE, 0, CL_DISP_MSGID_NONE, &mad_context);
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 332E: "
-			"Request for PortInfo failed (%s)\n",
-			ib_get_err_str(status));
+			"Request for remote PortInfo from 0x%" PRIx64 " failed (%s)\n",
+			cl_ntoh64(p_physp->port_guid), ib_get_err_str(status));
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
@@ -243,7 +251,7 @@ static ib_api_status_t state_mgr_sweep_hop_0(IN osm_sm_t * sm)
 		osm_dr_path_init(&dr_path, 0, path_array);
 		CL_PLOCK_ACQUIRE(sm->p_lock);
 		status = osm_req_get(sm, &dr_path, IB_MAD_ATTR_NODE_INFO, 0,
-				     CL_DISP_MSGID_NONE, NULL);
+				     TRUE, 0, CL_DISP_MSGID_NONE, NULL);
 		CL_PLOCK_RELEASE(sm->p_lock);
 		if (status != IB_SUCCESS)
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3305: "
@@ -438,7 +446,7 @@ static ib_api_status_t state_mgr_sweep_hop_1(IN osm_sm_t * sm)
 		osm_dr_path_init(&hop_1_path, 1, path_array);
 		CL_PLOCK_ACQUIRE(sm->p_lock);
 		status = osm_req_get(sm, &hop_1_path, IB_MAD_ATTR_NODE_INFO, 0,
-				     CL_DISP_MSGID_NONE, &context);
+				     TRUE, 0, CL_DISP_MSGID_NONE, &context);
 		CL_PLOCK_RELEASE(sm->p_lock);
 		if (status != IB_SUCCESS)
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3311: "
@@ -470,6 +478,7 @@ static ib_api_status_t state_mgr_sweep_hop_1(IN osm_sm_t * sm)
 				CL_PLOCK_ACQUIRE(sm->p_lock);
 				status = osm_req_get(sm, &hop_1_path,
 						     IB_MAD_ATTR_NODE_INFO, 0,
+						     TRUE, 0,
 						     CL_DISP_MSGID_NONE,
 						     &context);
 				CL_PLOCK_RELEASE(sm->p_lock);
@@ -513,7 +522,9 @@ static void query_sm_info(cl_map_item_t * item, void *cxt)
 	context.smi_context.light_sweep = TRUE;
 
 	ret = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_port->p_physp),
-			  IB_MAD_ATTR_SM_INFO, 0, CL_DISP_MSGID_NONE, &context);
+			  IB_MAD_ATTR_SM_INFO, 0, FALSE,
+			  ib_port_info_get_m_key(&p_port->p_physp->port_info),
+			  CL_DISP_MSGID_NONE, &context);
 	if (ret != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3314: "
 			"Failure requesting SMInfo (%s)\n",
@@ -552,12 +563,14 @@ static void state_mgr_update_node_desc(IN cl_map_item_t * obj, IN void *context)
 	mad_context.nd_context.node_guid = osm_node_get_node_guid(p_node);
 
 	status = osm_req_get(sm, osm_physp_get_dr_path_ptr(p_physp),
-			     IB_MAD_ATTR_NODE_DESC, 0, CL_DISP_MSGID_NONE,
-			     &mad_context);
+			     IB_MAD_ATTR_NODE_DESC, 0, FALSE,
+			     ib_port_info_get_m_key(&p_physp->port_info),
+			     CL_DISP_MSGID_NONE, &mad_context);
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR,
 			"ERR 331B: Failure initiating NodeDescription request "
-			"(%s)\n", ib_get_err_str(status));
+			"(%s) to 0x%016" PRIx64 "\n", ib_get_err_str(status),
+			cl_ntoh64(osm_node_get_node_guid(p_node)));
 
 exit:
 	OSM_LOG_EXIT(sm->p_log);
@@ -765,7 +778,7 @@ static osm_remote_sm_t *state_mgr_get_highest_sm(IN osm_sm_t * sm)
 	if (p_highest_sm != NULL) {
 		p_node = osm_get_node_by_guid(sm->p_subn, p_highest_sm->smi.guid);
 		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
-			"Found higher SM with guid: %016" PRIx64 " (node %s)\n",
+			"Found higher priority SM with guid: %016" PRIx64 " (node %s)\n",
 			cl_ntoh64(p_highest_sm->smi.guid),
 			p_node ? p_node->print_desc : "UNKNOWN");
 	}
@@ -832,14 +845,17 @@ static void state_mgr_send_handover(IN osm_sm_t * sm, IN osm_remote_sm_t * p_sm)
 	CL_PLOCK_ACQUIRE(sm->p_lock);
 	status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_port->p_physp),
 			     payload, sizeof(payload), IB_MAD_ATTR_SM_INFO,
-			     IB_SMINFO_ATTR_MOD_HANDOVER, CL_DISP_MSGID_NONE,
-			     &context);
+			     IB_SMINFO_ATTR_MOD_HANDOVER, FALSE,
+			     ib_port_info_get_m_key(&p_port->p_physp->port_info),
+			     CL_DISP_MSGID_NONE, &context);
 	CL_PLOCK_RELEASE(sm->p_lock);
 
 	if (status != IB_SUCCESS)
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3317: "
-			"Failure requesting SMInfo (%s)\n",
-			ib_get_err_str(status));
+			"Failure requesting SMInfo (%s), remote SM at 0x%"
+			PRIx64 " (node %s)\n",
+			ib_get_err_str(status), cl_ntoh64(p_port->guid),
+			p_port->p_node ? p_port->p_node->print_desc : "UNKNOWN");
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
@@ -1022,8 +1038,8 @@ static void state_mgr_check_tbl_consistency(IN osm_sm_t * sm)
 				p_port_ref->p_node->print_desc,
 				p_port_ref->p_physp->port_num,
 				cl_ntoh64(osm_port_get_guid(p_port_stored)),
-				p_port_ref->p_node->print_desc,
-				p_port_ref->p_physp->port_num);
+				p_port_stored->p_node->print_desc,
+				p_port_stored->p_physp->port_num);
 
 		/* In any of these cases we want to set NULL in the
 		 * port_lid_tbl, since this entry is invalid. Also, make sure
@@ -1187,7 +1203,7 @@ static void do_sweep(osm_sm_t * sm)
 					"REROUTE COMPLETE");
 			osm_opensm_report_event(sm->p_subn->p_osm,
 						OSM_EVENT_ID_UCAST_ROUTING_DONE,
-						NULL);
+						(void *) UCAST_ROUTING_REROUTE);
 			return;
 		}
 	}
@@ -1208,6 +1224,7 @@ repeat_discovery:
 	sm->p_subn->min_ca_mtu = IB_MAX_MTU;
 	sm->p_subn->min_ca_rate = IB_MAX_RATE;
 	sm->p_subn->min_data_vls = IB_MAX_NUM_VLS - 1;
+	sm->p_subn->min_sw_data_vls = IB_MAX_NUM_VLS - 1;
 
 	/* rescan configuration updates */
 	if (!config_parsed && osm_subn_rescan_conf_files(sm->p_subn) < 0)
@@ -1383,7 +1400,8 @@ repeat_discovery:
 	OSM_LOG_MSG_BOX(sm->p_log, OSM_LOG_VERBOSE,
 			"SWITCHES CONFIGURED FOR UNICAST");
 	osm_opensm_report_event(sm->p_subn->p_osm,
-				OSM_EVENT_ID_UCAST_ROUTING_DONE, NULL);
+				OSM_EVENT_ID_UCAST_ROUTING_DONE,
+				(void *) UCAST_ROUTING_HEAVY_SWEEP);
 
 	if (!sm->p_subn->opt.disable_multicast) {
 		osm_mcast_mgr_process(sm, TRUE);
@@ -1476,8 +1494,9 @@ repeat_discovery:
 		osm_sm_signal(sm, OSM_SIGNAL_SWEEP);
 
 	/* Write a new copy of our persistent guid2mkey database */
-	osm_db_store(sm->p_subn->p_g2m);
-	osm_db_store(sm->p_subn->p_neighbor);
+	osm_db_store(sm->p_subn->p_g2m, sm->p_subn->opt.fsync_high_avail_files);
+	osm_db_store(sm->p_subn->p_neighbor,
+		     sm->p_subn->opt.fsync_high_avail_files);
 }
 
 static void do_process_mgrp_queue(osm_sm_t * sm)
diff --git a/opensm/osm_subnet.c b/opensm/osm_subnet.c
index 195adb8..7bc9676 100644
--- a/opensm/osm_subnet.c
+++ b/opensm/osm_subnet.c
@@ -6,6 +6,7 @@
  * Copyright (c) 2009 System Fabric Works, Inc. All rights reserved.
  * Copyright (c) 2009 HNR Consulting. All rights reserved.
  * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -184,9 +185,10 @@ static const char *module_name_str[] = {
 	"osm_vl_arb_rcv.c",
 	"st.c",
 	"osm_ucast_dfsssp.c",
+	"osm_congestion_control.c",
 	/* Add new module names here ... */
 	/* FILE_ID define in those modules must be identical to index here */
-	/* last FILE_ID is currently 88 */
+	/* last FILE_ID is currently 89 */
 };
 
 #define MOD_NAME_STR_UNKNOWN_VAL (ARR_SIZE(module_name_str))
@@ -700,6 +702,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "subnet_prefix", OPT_OFFSET(subnet_prefix), opts_parse_net64, NULL, 1 },
 	{ "m_key_lease_period", OPT_OFFSET(m_key_lease_period), opts_parse_net16, NULL, 1 },
 	{ "m_key_protection_level", OPT_OFFSET(m_key_protect_bits), opts_parse_uint8, NULL, 1 },
+	{ "m_key_lookup", OPT_OFFSET(m_key_lookup), opts_parse_boolean, NULL, 1 },
 	{ "sweep_interval", OPT_OFFSET(sweep_interval), opts_parse_uint32, NULL, 1 },
 	{ "max_wire_smps", OPT_OFFSET(max_wire_smps), opts_parse_uint32, NULL, 1 },
 	{ "max_wire_smps2", OPT_OFFSET(max_wire_smps2), opts_parse_uint32, NULL, 1 },
@@ -764,6 +767,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "max_reverse_hops", OPT_OFFSET(max_reverse_hops), opts_parse_uint16, NULL, 0 },
 	{ "ids_guid_file", OPT_OFFSET(ids_guid_file), opts_parse_charp, NULL, 0 },
 	{ "guid_routing_order_file", OPT_OFFSET(guid_routing_order_file), opts_parse_charp, NULL, 0 },
+	{ "guid_routing_order_no_scatter", OPT_OFFSET(guid_routing_order_no_scatter), opts_parse_boolean, NULL, 0 },
 	{ "sa_db_file", OPT_OFFSET(sa_db_file), opts_parse_charp, NULL, 0 },
 	{ "sa_db_dump", OPT_OFFSET(sa_db_dump), opts_parse_boolean, NULL, 1 },
 	{ "torus_config", OPT_OFFSET(torus_conf_file), opts_parse_charp, NULL, 1 },
@@ -773,7 +777,9 @@ static const opt_rec_t opt_tbl[] = {
 	{ "daemon", OPT_OFFSET(daemon), opts_parse_boolean, NULL, 0 },
 	{ "sm_inactive", OPT_OFFSET(sm_inactive), opts_parse_boolean, NULL, 1 },
 	{ "babbling_port_policy", OPT_OFFSET(babbling_port_policy), opts_parse_boolean, NULL, 1 },
+	{ "drop_event_subscriptions", OPT_OFFSET(drop_event_subscriptions), opts_parse_boolean, NULL, 1 },
 	{ "use_optimized_slvl", OPT_OFFSET(use_optimized_slvl), opts_parse_boolean, NULL, 1 },
+	{ "fsync_high_avail_files", OPT_OFFSET(fsync_high_avail_files), opts_parse_boolean, NULL, 1 },
 #ifdef ENABLE_OSM_PERF_MGR
 	{ "perfmgr", OPT_OFFSET(perfmgr), opts_parse_boolean, NULL, 0 },
 	{ "perfmgr_redir", OPT_OFFSET(perfmgr_redir), opts_parse_boolean, NULL, 0 },
@@ -783,6 +789,7 @@ static const opt_rec_t opt_tbl[] = {
 	{ "event_db_dump_file", OPT_OFFSET(event_db_dump_file), opts_parse_charp, NULL, 0 },
 	{ "perfmgr_rm_nodes", OPT_OFFSET(perfmgr_rm_nodes), opts_parse_boolean, NULL, 0 },
 	{ "perfmgr_log_errors", OPT_OFFSET(perfmgr_log_errors), opts_parse_boolean, NULL, 0 },
+	{ "perfmgr_query_cpi", OPT_OFFSET(perfmgr_query_cpi), opts_parse_boolean, NULL, 0 },
 #endif				/* ENABLE_OSM_PERF_MGR */
 	{ "event_plugin_name", OPT_OFFSET(event_plugin_name), opts_parse_charp, NULL, 0 },
 	{ "event_plugin_options", OPT_OFFSET(event_plugin_options), opts_parse_charp, NULL, 0 },
@@ -915,7 +922,8 @@ static void subn_validate_neighbor(osm_subn_t *p_subn)
 		valid_entry = TRUE;
 
 		OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_DEBUG,
-			"Validating neighbor for 0x%016" PRIx64 ", port %d\n",
+			"Validating neighbor for guid:0x%016" PRIx64
+			", port %d\n",
 			p_item->guid, p_item->portnum);
 		if (p_item->guid == 0) {
 			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
@@ -923,31 +931,40 @@ static void subn_validate_neighbor(osm_subn_t *p_subn)
 			valid_entry = FALSE;
 		} else if (p_item->portnum == 0) {
 			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
-				"ERR 7514: found invalid zero port\n");
+				"ERR 7514: found invalid zero port for "
+				"guid: 0x%016" PRIx64 "\n",
+				p_item->guid);
 			valid_entry = FALSE;
 		} else if (osm_db_neighbor_get(p_subn->p_neighbor,
 					       p_item->guid, p_item->portnum,
 					       &guid, &port)) {
 			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
 				"ERR 7515: could not find neighbor for "
-				"guid: 0x%016" PRIx64 "\n", p_item->guid);
+				"guid: 0x%016" PRIx64 ", port %d\n",
+				p_item->guid, p_item->portnum);
 			valid_entry = FALSE;
 		} else if (guid == 0) {
 			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
 				"ERR 7516: found invalid neighbor "
-				"zero guid");
+				"zero guid for guid: 0x%016" PRIx64
+				", port %d\n",
+				p_item->guid, p_item->portnum);
 			valid_entry = FALSE;
 		} else if (port == 0) {
 			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
 				"ERR 7517: found invalid neighbor "
-				"zero port\n");
+				"zero port for guid: 0x%016" PRIx64
+				", port %d\n",
+				p_item->guid, p_item->portnum);
 			valid_entry = FALSE;
 		} else if (osm_db_neighbor_get(p_subn->p_neighbor,
 					       guid, port, &guid, &port) ||
 			guid != p_item->guid || port != p_item->portnum) {
 			OSM_LOG(&(p_subn->p_osm->log), OSM_LOG_ERROR,
 				"ERR 7518: neighbor does not point "
-				"back at us\n");
+				"back at us (guid: 0x%016" PRIx64
+				", port %d)\n",
+				p_item->guid, p_item->portnum);
 			valid_entry = FALSE;
 		}
 
@@ -1167,6 +1184,7 @@ ib_api_status_t osm_subn_init(IN osm_subn_t * p_subn, IN osm_opensm_t * p_osm,
 	p_subn->min_ca_mtu = IB_MAX_MTU;
 	p_subn->min_ca_rate = IB_MAX_RATE;
 	p_subn->min_data_vls = IB_MAX_NUM_VLS - 1;
+	p_subn->min_sw_data_vls = IB_MAX_NUM_VLS - 1;
 	p_subn->ignore_existing_lfts = TRUE;
 
 	/* we assume master by default - so we only need to set it true if STANDBY */
@@ -1422,6 +1440,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
 	p_opt->subnet_prefix = IB_DEFAULT_SUBNET_PREFIX;
 	p_opt->m_key_lease_period = 0;
 	p_opt->m_key_protect_bits = 0;
+	p_opt->m_key_lookup = TRUE;
 	p_opt->sweep_interval = OSM_DEFAULT_SWEEP_INTERVAL_SECS;
 	p_opt->max_wire_smps = OSM_DEFAULT_SMP_MAX_ON_WIRE;
 	p_opt->max_wire_smps2 = p_opt->max_wire_smps;
@@ -1464,7 +1483,9 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
 	p_opt->daemon = FALSE;
 	p_opt->sm_inactive = FALSE;
 	p_opt->babbling_port_policy = FALSE;
+	p_opt->drop_event_subscriptions = FALSE;
 	p_opt->use_optimized_slvl = FALSE;
+	p_opt->fsync_high_avail_files = TRUE;
 #ifdef ENABLE_OSM_PERF_MGR
 	p_opt->perfmgr = FALSE;
 	p_opt->perfmgr_redir = TRUE;
@@ -1475,6 +1496,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
 	p_opt->event_db_dump_file = NULL; /* use default */
 	p_opt->perfmgr_rm_nodes = TRUE;
 	p_opt->perfmgr_log_errors = TRUE;
+	p_opt->perfmgr_query_cpi = FALSE;
 #endif				/* ENABLE_OSM_PERF_MGR */
 
 	p_opt->event_plugin_name = NULL;
@@ -1483,8 +1505,9 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
 
 	p_opt->dump_files_dir = getenv("OSM_TMP_DIR");
 	if (!p_opt->dump_files_dir || !(*p_opt->dump_files_dir))
-		p_opt->dump_files_dir = OSM_DEFAULT_TMP_DIR;
-	p_opt->dump_files_dir = strdup(p_opt->dump_files_dir);
+		p_opt->dump_files_dir = strdup(OSM_DEFAULT_TMP_DIR);
+	else
+		p_opt->dump_files_dir = strdup(p_opt->dump_files_dir);
 	p_opt->log_file = strdup(OSM_DEFAULT_LOG_FILE);
 	p_opt->log_max_size = 0;
 	p_opt->partition_config_file = strdup(OSM_DEFAULT_PARTITION_CONFIG_FILE);
@@ -1513,6 +1536,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
 	p_opt->max_reverse_hops = 0;
 	p_opt->ids_guid_file = NULL;
 	p_opt->guid_routing_order_file = NULL;
+	p_opt->guid_routing_order_no_scatter = FALSE;
 	p_opt->sa_db_file = NULL;
 	p_opt->sa_db_dump = FALSE;
 	p_opt->torus_conf_file = strdup(OSM_DEFAULT_TORUS_CONF_FILE);
@@ -1520,7 +1544,7 @@ void osm_subn_set_default_opt(IN osm_subn_opt_t * p_opt)
 	p_opt->exit_on_fatal = TRUE;
 	p_opt->congestion_control = FALSE;
 	p_opt->cc_key = OSM_DEFAULT_CC_KEY;
-	p_opt->cc_max_outstanding_mads = OSM_PERFMGR_DEFAULT_MAX_OUTSTANDING_QUERIES;
+	p_opt->cc_max_outstanding_mads = OSM_CC_DEFAULT_MAX_OUTSTANDING_QUERIES;
 	p_opt->enable_quirks = FALSE;
 	p_opt->no_clients_rereg = FALSE;
 	p_opt->prefix_routes_file = strdup(OSM_DEFAULT_PREFIX_ROUTES_FILE);
@@ -1973,8 +1997,8 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)
 		else {
 			log_report(" Invalid Cached Option Value:part_enforce = %s"
 	                           ", Using Default:%s\n",
-	                           p_opts->part_enforce = OSM_PARTITION_ENFORCE_BOTH);
-			p_opts->part_enforce = OSM_PARTITION_ENFORCE_BOTH;
+	                           p_opts->part_enforce, OSM_PARTITION_ENFORCE_BOTH);
+			strcpy(p_opts->part_enforce, OSM_PARTITION_ENFORCE_BOTH);
 			p_opts->part_enforce_enum = OSM_PARTITION_ENFORCE_TYPE_BOTH;
 		}
 	}
@@ -2033,21 +2057,10 @@ int osm_subn_verify_config(IN osm_subn_opt_t * p_opts)
 		}
 	}
 
-	if (p_opts->root_guid_file != NULL) {
-		FILE *root_file = fopen(p_opts->root_guid_file, "r");
-		if (!root_file) {
-			log_report("Root guid file provided: %s doesn't exist.\n"
-				    "Using default roots discovery algorithm\n",
-				    p_opts->root_guid_file);
-			p_opts->root_guid_file = NULL;
-		} else
-			fclose(root_file);
-	}
-
 	return 0;
 }
 
-int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * p_opts)
+int osm_subn_parse_conf_file(const char *file_name, osm_subn_opt_t * p_opts)
 {
 	char line[1024];
 	FILE *opts_file;
@@ -2066,7 +2079,6 @@ int osm_subn_parse_conf_file(char *file_name, osm_subn_opt_t * p_opts)
 	}
 
 	printf(" Reading Cached Option File: %s\n", file_name);
-	cl_log_event("OpenSM", CL_LOG_INFO, line, NULL, 0);
 
 	p_opts->config_file = file_name;
 	if (!p_opts->file_opts && !(p_opts->file_opts = malloc(sizeof(*p_opts)))) {
@@ -2168,7 +2180,7 @@ int osm_subn_rescan_conf_files(IN osm_subn_t * p_subn)
 
 			token_matched = 1;
 
-			if (strcmp(r->name, p_key))
+			if (!r->can_update || strcmp(r->name, p_key))
 				continue;
 
 			p_field1 = (void *)p_opts->file_opts + r->opt_offset;
@@ -2206,6 +2218,8 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
 		"m_key_lease_period %u\n\n"
 		"# The protection level used for the M_Key on this subnet\n"
 		"m_key_protection_level %u\n\n"
+		"# If FALSE, SM won't try to determine the m_key of unknown ports\n"
+		"m_key_lookup %s\n\n"
 		"# SM_Key value of the SM used for SM authentication\n"
 		"sm_key 0x%016" PRIx64 "\n\n"
 		"# SM_Key value to qualify rcv SA queries as 'trusted'\n"
@@ -2288,6 +2302,7 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
 		cl_ntoh64(p_opts->m_key),
 		cl_ntoh16(p_opts->m_key_lease_period),
 		p_opts->m_key_protect_bits,
+		p_opts->m_key_lookup ? "TRUE" : "FALSE",
 		cl_ntoh64(p_opts->sm_key),
 		cl_ntoh64(p_opts->sa_key),
 		cl_ntoh64(p_opts->subnet_prefix),
@@ -2411,11 +2426,14 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
 
 	fprintf(out,
 		"# The file holding the fat-tree I/O node guids\n"
-		"# One guid in each line\nio_guid_file %s\n\n",
+		"# One guid in each line.\n"
+		"# If only io_guid file is provided, the rest of nodes\n"
+		"# are considered as compute nodes.\n"
+		"io_guid_file %s\n\n",
 		p_opts->io_guid_file ? p_opts->io_guid_file : null_str);
 
 	fprintf(out,
-		"# Number of reverse hops allowed for I/O nodes \n"
+		"# Number of reverse hops allowed for I/O nodes\n"
 		"# Used for connectivity between I/O nodes connected to Top Switches\nmax_reverse_hops %d\n\n",
 		p_opts->max_reverse_hops);
 
@@ -2492,7 +2510,8 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
 		"# Maximum number of timeout based SMPs allowed to be outstanding\n"
 		"# A value less than or equal to max_wire_smps disables this mechanism\n"
 		"max_wire_smps2 %u\n\n"
-		"# The timeout in [usec] used for sending SMPs above max_wire_smps limit and below max_wire_smps2 limit\n"
+		"# The timeout in [usec] used for sending SMPs above max_wire_smps limit\n"
+		"# and below max_wire_smps2 limit\n"
 		"max_smps_timeout %u\n\n"
 		"# The maximum time in [msec] allowed for a transaction to complete\n"
 		"transaction_timeout %u\n\n"
@@ -2521,12 +2540,18 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
 		"sm_inactive %s\n\n"
 		"# Babbling Port Policy\n"
 		"babbling_port_policy %s\n\n"
+		"# Drop event subscriptions (InformInfo) if the port goes away\n"
+		"drop_event_subscriptions %s\n\n"
 		"# Use Optimized SLtoVLMapping programming if supported by device\n"
-		"use_optimized_slvl %s\n\n",
+		"use_optimized_slvl %s\n\n"
+		"# Sync in memory files used for high availability with storage\n"
+		"fsync_high_avail_files %s\n\n",
 		p_opts->daemon ? "TRUE" : "FALSE",
 		p_opts->sm_inactive ? "TRUE" : "FALSE",
 		p_opts->babbling_port_policy ? "TRUE" : "FALSE",
-		p_opts->use_optimized_slvl ? "TRUE" : "FALSE");
+		p_opts->drop_event_subscriptions ? "TRUE" : "FALSE",
+		p_opts->use_optimized_slvl ? "TRUE" : "FALSE",
+		p_opts->fsync_high_avail_files ? "TRUE" : "FALSE");
 
 #ifdef ENABLE_OSM_PERF_MGR
 	fprintf(out,
@@ -2543,14 +2568,17 @@ int osm_subn_output_conf(FILE *out, IN osm_subn_opt_t * p_opts)
 		"# Remove missing nodes from DB\n"
 		"perfmgr_rm_nodes %s\n\n"
 		"# Log error counters to opensm.log\n"
-		"perfmgr_log_errors %s\n\n",
+		"perfmgr_log_errors %s\n\n"
+		"# Query PerfMgrGet(ClassPortInfo) for extended capabilities\n"
+		"perfmgr_query_cpi %s\n\n",
 		p_opts->perfmgr ? "TRUE" : "FALSE",
 		p_opts->perfmgr_redir ? "TRUE" : "FALSE",
 		p_opts->perfmgr_sweep_time_s,
 		p_opts->perfmgr_max_outstanding_queries,
 		p_opts->perfmgr_ignore_cas ? "TRUE" : "FALSE",
 		p_opts->perfmgr_rm_nodes ? "TRUE" : "FALSE",
-		p_opts->perfmgr_log_errors ? "TRUE" : "FALSE");
+		p_opts->perfmgr_log_errors ? "TRUE" : "FALSE",
+		p_opts->perfmgr_query_cpi ? "TRUE" : "FALSE");
 
 	fprintf(out,
 		"#\n# Event DB Options\n#\n"
diff --git a/opensm/osm_sw_info_rcv.c b/opensm/osm_sw_info_rcv.c
index 84e7fe0..02f6ab2 100644
--- a/opensm/osm_sw_info_rcv.c
+++ b/opensm/osm_sw_info_rcv.c
@@ -93,7 +93,7 @@ static void si_rcv_get_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * p_sw)
 			"Retrieving FT block %u\n", block_id_ho);
 
 		status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_LIN_FWD_TBL,
-				     cl_hton32(block_id_ho),
+				     cl_hton32(block_id_ho), TRUE, 0,
 				     CL_DISP_MSGID_NONE, &context);
 		if (status != IB_SUCCESS)
 			/* continue the loop despite the error */
@@ -175,7 +175,7 @@ static void si_rcv_get_mcast_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * p_sw)
 			status =
 			    osm_req_get(sm, p_dr_path,
 					IB_MAD_ATTR_MCAST_FWD_TBL,
-					cl_hton32(attr_mod_ho),
+					cl_hton32(attr_mod_ho), TRUE, 0,
 					CL_DISP_MSGID_NONE, &context);
 			if (status != IB_SUCCESS)
 				/* continue the loop despite the error */
@@ -288,6 +288,7 @@ static boolean_t si_rcv_process_existing(IN osm_sm_t * sm,
 	ib_switch_info_t *p_si;
 	osm_si_context_t *p_si_context;
 	ib_smp_t *p_smp;
+	osm_epi_lft_change_event_t lft_change;
 	boolean_t is_change_detected = FALSE;
 
 	OSM_LOG_ENTER(sm->p_log);
@@ -317,6 +318,17 @@ static boolean_t si_rcv_process_existing(IN osm_sm_t * sm,
 		}
 	}
 
+	if (sm->p_subn->first_time_master_sweep == FALSE &&
+	    p_si_context->set_method && p_si_context->lft_top_change) {
+		lft_change.p_sw = p_sw;
+		lft_change.flags = LFT_CHANGED_LFT_TOP;
+		lft_change.lft_top = cl_ntoh16(p_si->lin_top);
+		lft_change.block_num = 0;
+		osm_opensm_report_event(sm->p_subn->p_osm,
+					OSM_EVENT_ID_LFT_CHANGE,
+					&lft_change);
+	}
+
 	OSM_LOG_EXIT(sm->p_log);
 	return is_change_detected;
 }
diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c
index addda89..71753cf 100644
--- a/opensm/osm_torus.c
+++ b/opensm/osm_torus.c
@@ -3,7 +3,7 @@
  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
  * certain rights in this software.
  * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
- *
+ * Copyright (c) 2010-2012 Mellanox Technologies LTD. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -61,6 +61,7 @@
 #define TORUS_MAX_DIM        3
 #define PORTGRP_MAX_PORTS    16
 #define SWITCH_MAX_PORTGRPS  (1 + 2 * TORUS_MAX_DIM)
+#define DEFAULT_MAX_CHANGES  32
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
@@ -307,6 +308,7 @@ struct torus {
 	struct t_switch *master_stree_root;
 
 	unsigned flags;
+	unsigned max_changes;
 	int debug;
 };
 
@@ -850,14 +852,14 @@ out:
 }
 
 static
-bool parse_port(unsigned *pnum, const char *parse_sep)
+bool parse_unsigned(unsigned *result, const char *parse_sep)
 {
 	char *val, *nextchar;
 
 	val = strtok(NULL, parse_sep);
 	if (!val)
 		return false;
-	*pnum = strtoul(val, &nextchar, 0);
+	*result = strtoul(val, &nextchar, 0);
 	return true;
 }
 
@@ -867,7 +869,7 @@ bool parse_port_order(struct torus *t, const char *parse_sep)
 	unsigned i, j, k, n;
 
 	for (i = 0; i < ARRAY_SIZE(t->port_order); i++) {
-		if (!parse_port(&(t->port_order[i]), parse_sep))
+		if (!parse_unsigned(&(t->port_order[i]), parse_sep))
 			break;
 
 		for (j = 0; j < i; j++) {
@@ -895,18 +897,6 @@ bool parse_port_order(struct torus *t, const char *parse_sep)
 }
 
 static
-bool parse_pg_max_ports(struct torus *t, const char *parse_sep)
-{
-	char *val, *nextchar;
-
-	val = strtok(NULL, parse_sep);
-	if (!val)
-		return false;
-	t->portgrp_sz = strtoul(val, &nextchar, 0);
-	return true;
-}
-
-static
 bool parse_guid(struct torus *t, guid_t *guid, const char *parse_sep)
 {
 	char *val;
@@ -1056,6 +1046,7 @@ bool parse_config(const char *fn, struct fabric *f, struct torus *t)
 	}
 	t->flags |= NOTIFY_CHANGES;
 	t->portgrp_sz = PORTGRP_MAX_PORTS;
+	t->max_changes = DEFAULT_MAX_CHANGES;
 
 next_line:
 	llen = getline(&line_buf, &line_buf_sz, fp);
@@ -1079,7 +1070,7 @@ next_line:
 		kw_success = grow_seed_array(t, 1);
 		t->seed_cnt++;
 	} else if (strcmp("portgroup_max_ports", keyword) == 0) {
-		kw_success = parse_pg_max_ports(t, parse_sep);
+		kw_success = parse_unsigned(&t->portgrp_sz, parse_sep);
 	} else if (strcmp("xp_link", keyword) == 0) {
 		if (!t->seed_cnt)
 			t->seed_cnt++;
@@ -1116,6 +1107,8 @@ next_line:
 		if (!t->seed_cnt)
 			t->seed_cnt++;
 		kw_success = parse_dir_dateline(3, t, parse_sep);
+	} else if (strcmp("max_changes", keyword) == 0) {
+		kw_success = parse_unsigned(&t->max_changes, parse_sep);
 	} else if (keyword[0] == '#')
 		goto next_line;
 	else {
@@ -1180,6 +1173,7 @@ bool capture_fabric(struct fabric *fabric)
 
 		osm_sw = (osm_switch_t *)item;
 		item = cl_qmap_next(item);
+		osm_sw->priv = NULL;  /* avoid stale pointer dereferencing */
 		osm_node = osm_sw->p_node;
 
 		if (osm_node_get_type(osm_node) != IB_NODE_TYPE_SWITCH)
@@ -1200,6 +1194,7 @@ bool capture_fabric(struct fabric *fabric)
 
 		lport = (osm_port_t *)item;
 		item = cl_qmap_next(item);
+		lport->priv = NULL;  /* avoid stale pointer dereferencing */
 
 		lphysp = lport->p_physp;
 		if (!(lphysp && osm_physp_is_valid(lphysp)))
@@ -1552,7 +1547,7 @@ bool link_tswitches(struct torus *t, int cdir,
 	int p;
 	struct port_grp *pg0, *pg1;
 	struct f_switch *f_sw0, *f_sw1;
-	char *cdir_name = "unknown";
+	const char *cdir_name = "unknown";
 	unsigned port_cnt;
 	int success = false;
 
@@ -7010,8 +7005,9 @@ out:
 	return;
 }
 
-#define LINK_ERR_STR " direction link required!\n"
-#define SEED_ERR_STR " direction links with different seed switches!\n"
+#define LINK_ERR_STR " direction link required for topology seed configuration since radix == 4! See torus-2QoS.conf(5).\n"
+#define LINK_ERR2_STR " direction link required for topology seed configuration! See torus-2QoS.conf(5).\n"
+#define SEED_ERR_STR " direction links for topology seed do not share a common switch! See torus-2QoS.conf(5).\n"
 
 static
 bool verify_setup(struct torus *t, struct fabric *f)
@@ -7027,21 +7023,28 @@ bool verify_setup(struct torus *t, struct fabric *f)
 			"ERR 4E20: missing required torus size specification!\n");
 		goto out;
 	}
-	if (t->osm->subn.min_data_vls < 2)
+	if (t->osm->subn.min_sw_data_vls < 2) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E48: Too few data VLs to support torus routing "
+			"without credit loops (have switchport %d need 2)\n",
+			(int)t->osm->subn.min_sw_data_vls);
+		goto out;
+	}
+	if (t->osm->subn.min_sw_data_vls < 4)
 		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
 			"Warning: Too few data VLs to support torus routing "
-			"without credit loops (have %d need 2)\n",
-			(int)t->osm->subn.min_data_vls);
-	if (t->osm->subn.min_data_vls < 4)
+			"with a failed switch without credit loops "
+			"(have switchport %d need 4)\n",
+			(int)t->osm->subn.min_sw_data_vls);
+	if (t->osm->subn.min_sw_data_vls < 8)
 		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
 			"Warning: Too few data VLs to support torus routing "
-			"with a failed switch without credit loops"
-			"(have %d need 4)\n",
-			(int)t->osm->subn.min_data_vls);
-	if (t->osm->subn.min_data_vls < 8)
+			"with two QoS levels (have switchport %d need 8)\n",
+			(int)t->osm->subn.min_sw_data_vls);
+	if (t->osm->subn.min_data_vls < 2)
 		OSM_LOG(&t->osm->log, OSM_LOG_INFO,
 			"Warning: Too few data VLs to support torus routing "
-			"with two QoS levels (have %d need 8)\n",
+			"with two QoS levels (have endport %d need 2)\n",
 			(int)t->osm->subn.min_data_vls);
 	/*
 	 * Be sure all the switches in the torus support the port
@@ -7134,7 +7137,7 @@ again:
 		if (o->xp_link.end[0].port >= 0 &&
 		    o->xm_link.end[0].port >= 0) {
 			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
-				"ERR 4E2B: Positive or negative x" LINK_ERR_STR);
+				"ERR 4E2B: Positive or negative x" LINK_ERR2_STR);
 			goto out;
 		}
 		if (o->xp_link.end[0].port < 0 &&
@@ -7157,7 +7160,7 @@ again:
 		if (o->zp_link.end[0].port >= 0 &&
 		    o->zm_link.end[0].port >= 0) {
 			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
-				"ERR 4E2C: Positive or negative z" LINK_ERR_STR);
+				"ERR 4E2C: Positive or negative z" LINK_ERR2_STR);
 			goto out;
 		}
 		if ((o->xp_link.end[0].port < 0 &&
@@ -7200,7 +7203,7 @@ again:
 		if (o->yp_link.end[0].port >= 0 &&
 		    o->ym_link.end[0].port >= 0) {
 			OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
-				"ERR 4E2E: Positive or negative y" LINK_ERR_STR);
+				"ERR 4E2E: Positive or negative y" LINK_ERR2_STR);
 			goto out;
 		}
 		if ((o->xp_link.end[0].port < 0 &&
@@ -7249,7 +7252,9 @@ again:
 	if (need_seed)
 		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
 			"ERR 4E30: Every configured torus seed has at "
-			"least one switch missing in fabric!\n");
+			"least one switch missing in fabric! See "
+			"torus-2QoS.conf(5) and TORUS TOPOLOGY DISCOVERY "
+			"in torus-2QoS(8)\n");
 	else
 		success = true;
 out:
@@ -7495,6 +7500,37 @@ out:
 }
 
 static
+void dump_torus(struct torus *t)
+{
+	unsigned i, j, k;
+	unsigned x_sz = t->x_sz;
+	unsigned y_sz = t->y_sz;
+	unsigned z_sz = t->z_sz;
+	char path[1024];
+	FILE *file;
+
+	snprintf(path, sizeof(path), "%s/%s", t->osm->subn.opt.dump_files_dir,
+		 "opensm-torus.dump");
+	file = fopen(path, "w");
+	if (!file) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"ERR 4E47: cannot create file \'%s\'\n", path);
+		return;
+	}
+
+	for (k = 0; k < z_sz; k++)
+		for (j = 0; j < y_sz; j++)
+			for (i = 0; i < x_sz; i++)
+				if (t->sw[i][j][k])
+					fprintf(file, "switch %u,%u,%u GUID 0x%04"
+						PRIx64 " (%s)\n",
+						i, j, k,
+						cl_ntoh64(t->sw[i][j][k]->n_id),
+						t->sw[i][j][k]->osm_switch->p_node->print_desc);
+	fclose(file);
+}
+
+static
 void report_torus_changes(struct torus *nt, struct torus *ot)
 {
 	unsigned cnt = 0;
@@ -7502,8 +7538,12 @@ void report_torus_changes(struct torus *nt, struct torus *ot)
 	unsigned x_sz = nt->x_sz;
 	unsigned y_sz = nt->y_sz;
 	unsigned z_sz = nt->z_sz;
+	unsigned max_changes = nt->max_changes;
 
-	if (!(nt && ot))
+	if (OSM_LOG_IS_ACTIVE_V2(&nt->osm->log, OSM_LOG_ROUTING))
+		dump_torus(nt);
+
+	if (!ot)
 		return;
 
 	if (x_sz != ot->x_sz) {
@@ -7542,7 +7582,7 @@ void report_torus_changes(struct torus *nt, struct torus *ot)
 				 * We want to log changes to learn more about
 				 * bouncing links, etc, so they can be fixed.
 				 */
-				if (cnt > 32) {
+				if (cnt > max_changes) {
 					OSM_LOG(&nt->osm->log, OSM_LOG_INFO,
 						"Too many torus changes; "
 						"stopping reporting early\n");
@@ -7924,6 +7964,7 @@ unsigned sl_get_qos(unsigned sl)
  * Functions to encode routing/QoS info into VL bits.  Combine the resuts of
  * these functions with bitwise or to get final VL.
  *
+ * For interswitch links:
  * VL bit 0 encodes whether we need to leave on the "loop" VL.
  *
  * VL bit 1 encodes whether turn is XYZ DOR or ZYX DOR. A 3d mesh/torus
@@ -7938,6 +7979,9 @@ unsigned sl_get_qos(unsigned sl)
  *
  * VL bit 2 encodes QoS level.
  *
+ * For end port links:
+ * VL bit 0 encodes QoS level.
+ *
  * Note that if VL bit encodings are changed here, the available fabric VL
  * verification in verify_setup() needs to be updated as well.
  */
@@ -7954,6 +7998,12 @@ unsigned vl_set_qos_vl(unsigned qos)
 }
 
 static inline
+unsigned vl_set_ca_qos_vl(unsigned qos)
+{
+	return qos & 0x1;
+}
+
+static inline
 unsigned vl_set_turn_vl(unsigned in_coord_dir, unsigned out_coord_dir)
 {
 	unsigned vl = 0;
@@ -7982,16 +8032,23 @@ unsigned sl2vl_entry(struct torus *t, struct t_switch *sw,
 	else
 		od = TORUS_MAX_DIM;
 
-	data_vls = t->osm->subn.min_data_vls;
-	vl = 0;
-
-	if (data_vls >= 2)
-		vl |= vl_set_loop_vl(sl_get_use_loop_vl(sl, od));
-	if (data_vls >= 4)
-		vl |= vl_set_turn_vl(id, od);
-	if (data_vls >= 8)
-		vl |= vl_set_qos_vl(sl_get_qos(sl));
+	if (sw)
+		data_vls = t->osm->subn.min_sw_data_vls;
+	else
+		data_vls = t->osm->subn.min_data_vls;
 
+	vl = 0;
+	if (sw && od != TORUS_MAX_DIM) {
+		if (data_vls >= 2)
+			vl |= vl_set_loop_vl(sl_get_use_loop_vl(sl, od));
+		if (data_vls >= 4)
+			vl |= vl_set_turn_vl(id, od);
+		if (data_vls >= 8)
+			vl |= vl_set_qos_vl(sl_get_qos(sl));
+	} else {
+		if (data_vls >= 2)
+			vl |= vl_set_ca_qos_vl(sl_get_qos(sl));
+	}
 	return vl;
 }
 
@@ -8013,10 +8070,10 @@ void torus_update_osm_sl2vl(void *context, osm_physp_t *osm_phys_port,
 
 			guid = osm_node_get_node_guid(node);
 			OSM_LOG(log, OSM_LOG_INFO,
-				"Error: osm_switch (GUID 0x%04"PRIx64") "
-				"not in our fabric description\n",
+				"Note: osm_switch (GUID 0x%04"PRIx64") "
+				"not in torus fabric description\n",
 				cl_ntoh64(guid));
-		return;
+			return;
 		}
 	}
 	for (sl = 0; sl < 16; sl++) {
@@ -8025,6 +8082,73 @@ void torus_update_osm_sl2vl(void *context, osm_physp_t *osm_phys_port,
 	}
 }
 
+static
+void torus_update_osm_vlarb(void *context, osm_physp_t *osm_phys_port,
+			    uint8_t port_num, ib_vl_arb_table_t *block,
+			    unsigned block_length, unsigned block_num)
+{
+	osm_node_t *node = osm_physp_get_node_ptr(osm_phys_port);
+	struct torus_context *ctx = context;
+	struct t_switch *sw = NULL;
+	unsigned i, next;
+
+	if (node->sw) {
+		sw = node->sw->priv;
+		if (sw && sw->osm_switch != node->sw) {
+			osm_log_t *log = &ctx->osm->log;
+			guid_t guid;
+
+			guid = osm_node_get_node_guid(node);
+			OSM_LOG(log, OSM_LOG_INFO,
+				"Note: osm_switch (GUID 0x%04"PRIx64") "
+				"not in torus fabric description\n",
+				cl_ntoh64(guid));
+			return;
+		}
+	}
+
+	/*
+	 * If osm_phys_port is a switch port that connects to a CA, then
+	 * we're using at most VL 0 (for QoS level 0) and VL 1 (for QoS
+	 * level 1).  We've been passed the  VLarb values for a switch
+	 * external port, so we need to fix them up to avoid unexpected
+	 * results depending on how the switch handles VLarb values for
+	 * unprogrammed VLs.
+	 *
+	 * For inter-switch links torus-2QoS uses VLs 0-3 to implement
+	 * QoS level 0, and VLs 4-7 to implement QoS level 1.
+	 *
+	 * So, leave VL 0 alone, remap VL 4 to VL 1, zero out the rest,
+	 * and compress out the zero entries to the end.
+	 */
+	if (!sw || !port_num || !sw->port[port_num] ||
+	    sw->port[port_num]->pgrp->port_grp != 2 * TORUS_MAX_DIM)
+		return;
+
+	next = 0;
+	for (i = 0; i < block_length; i++) {
+		switch (block->vl_entry[i].vl) {
+		case 4:
+			block->vl_entry[i].vl = 1;
+			/* fall through */
+		case 0:
+			block->vl_entry[next].vl = block->vl_entry[i].vl;
+			block->vl_entry[next].weight = block->vl_entry[i].weight;
+			next++;
+			/*
+			 * If we didn't update vl_entry[i] in place,
+			 * fall through to zero it out.
+			 */
+			if (next > i)
+				break;
+		default:
+			block->vl_entry[i].vl = 0;
+			block->vl_entry[i].weight = 0;
+			break;
+		}
+	}
+}
+
 /*
  * Computes the path lengths *vl0_len and *vl1_len to get from src
  * to dst on a ring with count switches.
@@ -8569,7 +8693,7 @@ osm_mtree_node_t *mcast_stree_branch(struct t_switch *sw, osm_switch_t *osm_sw,
 	if (osm_sw->priv != sw) {
 		OSM_LOG(&sw->torus->osm->log, OSM_LOG_ERROR,
 			"ERR 4E3E: osm_sw (GUID 0x%04"PRIx64") "
-			"not in our fabric description\n",
+			"not in torus fabric description\n",
 			cl_ntoh64(osm_node_get_node_guid(osm_sw->p_node)));
 		goto out;
 	}
@@ -8583,7 +8707,7 @@ osm_mtree_node_t *mcast_stree_branch(struct t_switch *sw, osm_switch_t *osm_sw,
 	mtn = osm_mtree_node_new(osm_sw);
 	if (!mtn) {
 		OSM_LOG(&sw->torus->osm->log, OSM_LOG_ERROR,
-			"Insufficient memory to build multicast tree\n");
+			"ERR 4E46: Insufficient memory to build multicast tree\n");
 		goto out;
 	}
 	mcast_tbl = osm_switch_get_mcast_tbl_ptr(osm_sw);
@@ -8659,7 +8783,7 @@ osm_mtree_node_t *mcast_stree_branch(struct t_switch *sw, osm_switch_t *osm_sw,
 		}
 	}
 	if (!(mcast_end_ports || mcast_fwd_ports)) {
-		free(mtn);
+		osm_mtree_destroy(mtn);
 		mtn = NULL;
 	} else if (depth > *max_depth)
 		*max_depth = depth;
@@ -8739,7 +8863,7 @@ ib_api_status_t torus_mcast_stree(void *context, osm_mgrp_box_t *mgb)
 				id = osm_node_get_node_guid(osm_port->p_node);
 				OSM_LOG(&ctx->osm->log, OSM_LOG_ERROR,
 					"ERR 4E41: osm_port (GUID 0x%04"PRIx64") "
-					"not in our fabric description\n",
+					"not in torus fabric description\n",
 					cl_ntoh64(id));
 				continue;
 			}
@@ -9076,8 +9200,8 @@ uint8_t torus_path_sl(void *context, uint8_t path_sl_hint,
 		if (!sport) {
 			guid = osm_node_get_node_guid(osm_sport->p_node);
 			OSM_LOG(log, OSM_LOG_INFO,
-				"Error: osm_sport (GUID 0x%04"PRIx64") "
-				"not in our fabric description\n",
+				"Note: osm_sport (GUID 0x%04"PRIx64") "
+				"not in torus fabric description\n",
 				cl_ntoh64(guid));
 			goto out;
 		}
@@ -9088,8 +9212,8 @@ uint8_t torus_path_sl(void *context, uint8_t path_sl_hint,
 		if (!dport) {
 			guid = osm_node_get_node_guid(osm_dport->p_node);
 			OSM_LOG(log, OSM_LOG_INFO,
-				"Error: osm_dport (GUID 0x%04"PRIx64") "
-				"not in our fabric description\n",
+				"Note: osm_dport (GUID 0x%04"PRIx64") "
+				"not in torus fabric description\n",
 				cl_ntoh64(guid));
 			goto out;
 		}
@@ -9137,13 +9261,11 @@ out:
 }
 
 static
-void check_vlarb_config(const char *vlarb_str, bool is_default,
-			const char *str, const char *pri, osm_log_t *log)
+void sum_vlarb_weights(const char *vlarb_str,
+		       unsigned total_weight[IB_MAX_NUM_VLS])
 {
-	unsigned total_weight[IB_MAX_NUM_VLS] = {0,};
 	unsigned i = 0, v, vl = 0;
 	char *end;
-	bool uniform;
 
 	while (*vlarb_str && i++ < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK) {
 		v = strtoul(vlarb_str, &end, 0);
@@ -9155,15 +9277,29 @@ void check_vlarb_config(const char *vlarb_str, bool is_default,
 		else
 			total_weight[vl] += v & 0xff;
 	}
-	uniform = true;
-	v = total_weight[0];
-	for (i = 1; i < 8; i++) {
-		if (i == 4)
-			v = total_weight[i];
-		if (total_weight[i] != v)
-			uniform = false;
+}
+
+static
+int uniform_vlarb_weight_value(unsigned *weight, unsigned count)
+{
+	int i, v = weight[0];
+
+	for (i = 1; i < count; i++) {
+		if (v != weight[i])
+			return -1;
 	}
-	if (!uniform)
+	return v;
+}
+
+static
+void check_vlarb_config(const char *vlarb_str, bool is_default,
+			const char *str, const char *pri, osm_log_t *log)
+{
+	unsigned total_weight[IB_MAX_NUM_VLS] = {0,};
+
+	sum_vlarb_weights(vlarb_str, total_weight);
+	if (!(uniform_vlarb_weight_value(&total_weight[0], 4) >= 0 &&
+	      uniform_vlarb_weight_value(&total_weight[4], 4) >= 0))
 		OSM_LOG(log, OSM_LOG_INFO,
 			"Warning: torus-2QoS requires same VLarb weights for "
 			"VLs 0-3; also for VLs 4-7: not true for %s "
@@ -9171,42 +9307,135 @@ void check_vlarb_config(const char *vlarb_str, bool is_default,
 			(is_default ? "default" : "configured"), str, pri);
 }
 
+/*
+ * Use this to check the qos_config for switch external ports.
+ */
 static
-void check_qos_config(osm_qos_options_t *opt, bool tgt_is_default,
-		      const char *str, osm_log_t *log)
+void check_qos_swe_config(osm_qos_options_t *opt,
+			  osm_qos_options_t *def, osm_log_t *log)
 {
-	const char *vlarb_str;
+	const char *vlarb_str, *tstr;
 	bool is_default;
+	unsigned max_vls;
 
-	if (opt->max_vls > 0 && opt->max_vls < 8)
+	max_vls = def->max_vls;
+	if (opt->max_vls > 0)
+		max_vls = opt->max_vls;
+
+	if (max_vls > 0 && max_vls < 8)
 		OSM_LOG(log, OSM_LOG_INFO,
 			"Warning: full torus-2QoS functionality not available "
-			"for configured %s_max_vls = %d\n", str, opt->max_vls);
+			"for configured %s_max_vls = %d\n",
+			(opt->max_vls > 0 ? "qos_swe" : "qos"), opt->max_vls);
 
-	if (opt->vlarb_high) {
-		is_default = false;
-		vlarb_str = opt->vlarb_high;
-	} else{
-		is_default = true;
+	vlarb_str = opt->vlarb_high;
+	is_default = false;
+	tstr = "qos_swe";
+	if (!vlarb_str) {
+		vlarb_str = def->vlarb_high;
+		tstr = "qos";
+	}
+	if (!vlarb_str) {
 		vlarb_str = OSM_DEFAULT_QOS_VLARB_HIGH;
+		is_default = true;
 	}
-	/*
-	 * Only check values that were actually configured, or the overall
-	 * defaults that target-specific (CA, switch port, etc) defaults
-	 * are set from.
-	 */
-	if (!is_default || tgt_is_default)
-		check_vlarb_config(vlarb_str, is_default, str, "high", log);
+	check_vlarb_config(vlarb_str, is_default, tstr, "high", log);
 
-	if (opt->vlarb_low) {
-		is_default = false;
-		vlarb_str = opt->vlarb_low;
-	} else {
+	vlarb_str = opt->vlarb_low;
+	is_default = false;
+	tstr = "qos_swe";
+	if (!vlarb_str) {
+		vlarb_str = def->vlarb_low;
+		tstr = "qos";
+	}
+	if (!vlarb_str) {
+		vlarb_str = OSM_DEFAULT_QOS_VLARB_LOW;
 		is_default = true;
+	}
+	check_vlarb_config(vlarb_str, is_default, tstr, "low", log);
+
+	if (opt->sl2vl)
+		OSM_LOG(log, OSM_LOG_INFO,
+			"Warning: torus-2QoS must override configured "
+			"qos_swe_sl2vl to generate deadlock-free routes\n");
+}
+
+static
+void check_ep_vlarb_config(const char *vlarb_str,
+			   bool is_default, bool is_specific,
+			   const char *str, const char *pri, osm_log_t *log)
+{
+	unsigned i, total_weight[IB_MAX_NUM_VLS] = {0,};
+	int val = 0;
+
+	sum_vlarb_weights(vlarb_str, total_weight);
+	for (i = 2; i < 8; i++) {
+		val += total_weight[i];
+	}
+	if (!val)
+		return;
+
+	if (is_specific)
+		OSM_LOG(log, OSM_LOG_INFO,
+			"Warning: torus-2QoS recommends 0 VLarb weights"
+			" for VLs 2-7 on endpoint links; not true for "
+			" configured %s_vlarb_%s\n", str, pri);
+	else
+		OSM_LOG(log, OSM_LOG_INFO,
+			"Warning: torus-2QoS recommends 0 VLarb weights "
+			"for VLs 2-7 on endpoint links; not true for %s "
+			"qos_vlarb_%s values used for %s_vlarb_%s\n",
+			(is_default ? "default" : "configured"), pri, str, pri);
+}
+
+/*
+ * Use this to check the qos_config for endports
+ */
+static
+void check_qos_ep_config(osm_qos_options_t *opt, osm_qos_options_t *def,
+			 const char *str, osm_log_t *log)
+{
+	const char *vlarb_str;
+	bool is_default, is_specific;
+	unsigned max_vls;
+
+	max_vls = def->max_vls;
+	if (opt->max_vls > 0)
+		max_vls = opt->max_vls;
+
+	if (max_vls > 0 && max_vls < 2)
+		OSM_LOG(log, OSM_LOG_INFO,
+			"Warning: full torus-2QoS functionality not available "
+			"for configured %s_max_vls = %d\n",
+			(opt->max_vls > 0 ? str : "qos"), opt->max_vls);
+
+	vlarb_str = opt->vlarb_high;
+	is_default = false;
+	is_specific = true;
+	if (!vlarb_str) {
+		vlarb_str = def->vlarb_high;
+		is_specific = false;
+	}
+	if (!vlarb_str) {
+		vlarb_str = OSM_DEFAULT_QOS_VLARB_HIGH;
+		is_default = true;
+	}
+	check_ep_vlarb_config(vlarb_str, is_default, is_specific,
+			      str, "high", log);
+
+	vlarb_str = opt->vlarb_low;
+	is_default = false;
+	is_specific = true;
+	if (!vlarb_str) {
+		vlarb_str = def->vlarb_low;
+		is_specific = false;
+	}
+	if (!vlarb_str) {
 		vlarb_str = OSM_DEFAULT_QOS_VLARB_LOW;
+		is_default = true;
 	}
-	if (!is_default || tgt_is_default)
-		check_vlarb_config(vlarb_str, is_default, str, "low", log);
+	check_ep_vlarb_config(vlarb_str, is_default, is_specific,
+			      str, "low", log);
 
 	if (opt->sl2vl)
 		OSM_LOG(log, OSM_LOG_INFO,
@@ -9251,9 +9480,10 @@ int torus_build_lfts(void *context)
 
 	OSM_LOG(&torus->osm->log, OSM_LOG_INFO,
 		"Found fabric w/ %d links, %d switches, %d CA ports, "
-		"minimum %d data VLs\n",
+		"minimum data VLs: endport %d, switchport %d\n",
 		(int)fabric->link_cnt, (int)fabric->switch_cnt,
-		(int)fabric->ca_cnt, (int)ctx->osm->subn.min_data_vls);
+		(int)fabric->ca_cnt, (int)ctx->osm->subn.min_data_vls,
+		(int)ctx->osm->subn.min_sw_data_vls);
 
 	if (!verify_setup(torus, fabric))
 		goto out;
@@ -9295,11 +9525,15 @@ out:
 			teardown_torus(ctx->torus);
 		ctx->torus = torus;
 
-		check_qos_config(&opt->qos_options, 1, "qos", log);
-		check_qos_config(&opt->qos_ca_options, 0, "qos_ca", log);
-		check_qos_config(&opt->qos_sw0_options, 0, "qos_sw0", log);
-		check_qos_config(&opt->qos_swe_options, 0, "qos_swe", log);
-		check_qos_config(&opt->qos_rtr_options, 0, "qos_rtr", log);
+		check_qos_swe_config(&opt->qos_swe_options, &opt->qos_options,
+				     log);
+
+		check_qos_ep_config(&opt->qos_ca_options,
+				    &opt->qos_options, "qos_ca", log);
+		check_qos_ep_config(&opt->qos_sw0_options,
+				    &opt->qos_options, "qos_sw0", log);
+		check_qos_ep_config(&opt->qos_rtr_options,
+				    &opt->qos_options, "qos_rtr", log);
 	}
 	teardown_fabric(fabric);
 	return status;
@@ -9316,7 +9550,9 @@ int osm_ucast_torus2QoS_setup(struct osm_routing_engine *r,
 
 	r->context = ctx;
 	r->ucast_build_fwd_tables = torus_build_lfts;
+	r->build_lid_matrices = ucast_dummy_build_lid_matrices;
 	r->update_sl2vl = torus_update_osm_sl2vl;
+	r->update_vlarb = torus_update_osm_vlarb;
 	r->path_sl = torus_path_sl;
 	r->mcast_build_stree = torus_mcast_stree;
 	r->destroy = torus_context_delete;
diff --git a/opensm/osm_trap_rcv.c b/opensm/osm_trap_rcv.c
index 4a59cfe..472083d 100644
--- a/opensm/osm_trap_rcv.c
+++ b/opensm/osm_trap_rcv.c
@@ -90,7 +90,7 @@ static osm_physp_t *get_physp_by_lid_and_num(IN osm_sm_t * sm,
 	if (!p_port)
 		return NULL;
 
-	if (osm_node_get_num_physp(p_port->p_node) < num)
+	if (osm_node_get_num_physp(p_port->p_node) <= num)
 		return NULL;
 
 	return osm_node_get_physp_ptr(p_port->p_node, num);
@@ -113,6 +113,8 @@ static uint64_t aging_tracker_callback(IN uint64_t key, IN uint32_t num_regs,
 	lid = (ib_net16_t) ((key & 0x0000FFFF00000000ULL) >> 32);
 	port_num = (uint8_t) ((key & 0x00FF000000000000ULL) >> 48);
 
+	CL_PLOCK_ACQUIRE(sm->p_lock);
+
 	p_physp = get_physp_by_lid_and_num(sm, lid, port_num);
 	if (!p_physp)
 		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
@@ -129,6 +131,7 @@ static uint64_t aging_tracker_callback(IN uint64_t key, IN uint32_t num_regs,
 		osm_physp_set_health(p_physp, TRUE);
 	}
 
+	CL_PLOCK_RELEASE(sm->p_lock);
 	OSM_LOG_EXIT(sm->p_log);
 
 	/* We want to remove the event from the tracker - so
@@ -213,6 +216,9 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p)
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	osm_madw_context_t context;
 	ib_port_info_t *pi = (ib_port_info_t *)payload;
+	osm_physp_t *physp0;
+	osm_port_t *p_port;
+	ib_net64_t m_key;
 	ib_api_status_t status;
 
 	/* select the nearest port to master opensm */
@@ -235,13 +241,28 @@ static int disable_port(osm_sm_t *sm, osm_physp_t *p)
 	context.pi_context.set_method = TRUE;
 	context.pi_context.light_sweep = FALSE;
 	context.pi_context.active_transition = FALSE;
+	context.pi_context.client_rereg = FALSE;
+	if (osm_node_get_type(p->p_node) == IB_NODE_TYPE_SWITCH &&
+	    osm_physp_get_port_num(p) != 0) {
+		physp0 = osm_node_get_physp_ptr(p->p_node, 0);
+		m_key = ib_port_info_get_m_key(&physp0->port_info);
+	} else
+		m_key = ib_port_info_get_m_key(&p->port_info);
+
+	if (osm_node_get_type(p->p_node) != IB_NODE_TYPE_SWITCH) {
+		if (!pi->base_lid) {
+			p_port = osm_get_port_by_guid(sm->p_subn,
+						      osm_physp_get_port_guid(p));
+			pi->base_lid = p_port->lid;
+		}
+		pi->master_sm_base_lid = sm->p_subn->sm_base_lid;
+	}
 
-	CL_PLOCK_ACQUIRE(sm->p_lock);
 	status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p),
 			   payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
 			   cl_hton32(osm_physp_get_port_num(p)),
+			   FALSE, m_key,
 			   CL_DISP_MSGID_NONE, &context);
-	CL_PLOCK_RELEASE(sm->p_lock);
 	return status;
 }
 
@@ -254,9 +275,9 @@ static void log_trap_info(osm_log_t *p_log, ib_mad_notice_attr_t *p_ntci,
 	if (ib_notice_is_generic(p_ntci)) {
 		char str[32];
 
-		if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(129)) ||
-		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(130)) ||
-		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(131)))
+		if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_LINK_INTEGRITY_THRESHOLD_TRAP)) ||
+		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_BUFFER_OVERRUN_THRESHOLD_TRAP)) ||
+		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_WATCHDOG_TIMER_EXPIRED_TRAP)))
 			snprintf(str, sizeof(str), " Port %u",
 				 p_ntci->data_details.ntc_129_131.port_num);
 		else
@@ -272,8 +293,8 @@ static void log_trap_info(osm_log_t *p_log, ib_mad_notice_attr_t *p_ntci,
 			cl_ntoh32(ib_notice_get_prod_type(p_ntci)),
 			ib_get_producer_type_str(ib_notice_get_prod_type(p_ntci)),
 			cl_hton16(source_lid), str, cl_ntoh64(trans_id));
-		if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(257)) ||
-		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(258))) {
+		if ((p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_BAD_PKEY_TRAP)) ||
+		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_BAD_QKEY_TRAP))) {
 			OSM_LOG(p_log, OSM_LOG_ERROR,
 				"Bad %s_Key:0x%x on SL:%d from "
 				"LID1:%u QP1:0x%x to "
@@ -352,6 +373,9 @@ static void trap_rcv_process_request(IN osm_sm_t * sm,
 	boolean_t physp_change_trap = FALSE;
 	uint64_t event_wheel_timeout = OSM_DEFAULT_TRAP_SUPRESSION_TIMEOUT;
 	boolean_t run_heavy_sweep = FALSE;
+	char buf[1024];
+	osm_dr_path_t *p_path;
+	unsigned n;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -421,11 +445,11 @@ static void trap_rcv_process_request(IN osm_sm_t * sm,
 	}
 
 	osm_dump_notice_v2(sm->p_log, p_ntci, FILE_ID, OSM_LOG_VERBOSE);
-
+	CL_PLOCK_ACQUIRE(sm->p_lock);
 	p_physp = osm_get_physp_by_mad_addr(sm->p_log, sm->p_subn,
 					    &tmp_madw.mad_addr);
 	if (p_physp)
-		p_smp->m_key = p_physp->port_info.m_key;
+		p_smp->m_key = ib_port_info_get_m_key(&p_physp->port_info);
 	else
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3809: "
 			"Failed to find source physical port for trap\n");
@@ -447,9 +471,9 @@ static void trap_rcv_process_request(IN osm_sm_t * sm,
 
 	if (is_gsi == FALSE) {
 		if (ib_notice_is_generic(p_ntci) &&
-		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(129) ||
-		     p_ntci->g_or_v.generic.trap_num == CL_HTON16(130) ||
-		     p_ntci->g_or_v.generic.trap_num == CL_HTON16(131))) {
+		    (p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_LINK_INTEGRITY_THRESHOLD_TRAP) ||
+		     p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_BUFFER_OVERRUN_THRESHOLD_TRAP) ||
+		     p_ntci->g_or_v.generic.trap_num == CL_HTON16(SM_WATCHDOG_TIMER_EXPIRED_TRAP))) {
 			/* If this is a trap 129, 130, or 131 - then this is a
 			 * trap signaling a change on a physical port.
 			 * Mark the physp_change_trap flag as TRUE.
@@ -513,15 +537,13 @@ static void trap_rcv_process_request(IN osm_sm_t * sm,
 	/* Check for node description update. IB Spec v1.2.1 pg 823 */
 	if (!ib_notice_is_generic(p_ntci))
 		goto check_sweep;
-	if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 &&
+	if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == SM_LOCAL_CHANGES_TRAP &&
 	    p_ntci->data_details.ntc_144.local_changes & TRAP_144_MASK_OTHER_LOCAL_CHANGES &&
 	    p_ntci->data_details.ntc_144.change_flgs & TRAP_144_MASK_NODE_DESCRIPTION_CHANGE) {
 		OSM_LOG(sm->p_log, OSM_LOG_INFO, "Trap 144 Node description update\n");
 
 		if (p_physp) {
-			CL_PLOCK_ACQUIRE(sm->p_lock);
 			osm_req_get_node_desc(sm, p_physp);
-			CL_PLOCK_RELEASE(sm->p_lock);
 			if (!(p_ntci->data_details.ntc_144.change_flgs & ~TRAP_144_MASK_NODE_DESCRIPTION_CHANGE) &&
 			    p_ntci->data_details.ntc_144.new_cap_mask == p_physp->port_info.capability_mask)
 				goto check_report;
@@ -530,12 +552,21 @@ static void trap_rcv_process_request(IN osm_sm_t * sm,
 				"ERR 3812: No physical port found for "
 				"trap 144: \"node description update\"\n");
 		goto check_sweep;
-	} else if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 145) {
-		if (p_physp)
-			/* this assumes that trap 145 content is not broken? */
-			p_physp->p_node->node_info.sys_guid =
-				p_ntci->data_details.ntc_145.new_sys_guid;
-		else
+	} else if (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == SM_SYS_IMG_GUID_CHANGED_TRAP) {
+		if (p_physp) {
+			CL_PLOCK_RELEASE(sm->p_lock);
+			CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
+			p_physp = osm_get_physp_by_mad_addr(sm->p_log,
+							    sm->p_subn,
+							    &tmp_madw.mad_addr);
+			if (p_physp) {
+				/* this assumes that trap 145 content is not broken? */
+				p_physp->p_node->node_info.sys_guid =
+					p_ntci->data_details.ntc_145.new_sys_guid;
+			}
+			CL_PLOCK_RELEASE(sm->p_lock);
+			CL_PLOCK_ACQUIRE(sm->p_lock);
+		} else
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR,
 				"ERR 3813: No physical port found for "
 				"trap 145: \"SystemImageGUID update\"\n");
@@ -543,6 +574,27 @@ static void trap_rcv_process_request(IN osm_sm_t * sm,
 	}
 
 check_sweep:
+	if (osm_log_is_active_v2(sm->p_log, OSM_LOG_INFO, FILE_ID)) {
+		if (ib_notice_is_generic(p_ntci) &&
+		    cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == SM_LINK_STATE_CHANGED_TRAP) {
+			p_path = (p_physp) ?
+			    osm_physp_get_dr_path_ptr(p_physp) : NULL;
+			if (p_path) {
+				n = sprintf(buf, "SM class trap %u: ",
+					    cl_ntoh16(p_ntci->g_or_v.generic.trap_num));
+				n += snprintf(buf + n, sizeof(buf) - n,
+					      "Directed Path Dump of %u hop path: "
+					      "Path = ", p_path->hop_count);
+
+				osm_dump_dr_path_as_buf(sizeof(buf) - n, p_path,
+							buf + n);
+
+				osm_log_v2(sm->p_log, OSM_LOG_INFO, FILE_ID,
+					   "%s\n", buf);
+			}
+		}
+	}
+
 	/* do a sweep if we received a trap */
 	if (sm->p_subn->opt.sweep_on_trap) {
 		/* if this is trap number 128 or run_heavy_sweep is TRUE -
@@ -552,8 +604,8 @@ check_sweep:
 		   TODO: In the future this can be changed to just getting
 		   PortInfo on this port instead of sweeping the entire subnet. */
 		if (ib_notice_is_generic(p_ntci) &&
-		    (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 128 ||
-		     cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == 144 ||
+		    (cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == SM_LINK_STATE_CHANGED_TRAP ||
+		     cl_ntoh16(p_ntci->g_or_v.generic.trap_num) == SM_LOCAL_CHANGES_TRAP ||
 		     run_heavy_sweep)) {
 			OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
 				"Forcing heavy sweep. Received trap:%u\n",
@@ -600,9 +652,7 @@ check_report:
 	}
 
 	/* we need a lock here as the InformInfo DB must be stable */
-	CL_PLOCK_ACQUIRE(sm->p_lock);
 	status = osm_report_notice(sm->p_log, sm->p_subn, p_ntci);
-	CL_PLOCK_RELEASE(sm->p_lock);
 	if (status != IB_SUCCESS) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3803: "
 			"Error sending trap reports (%s)\n",
@@ -611,18 +661,7 @@ check_report:
 	}
 
 Exit:
-	OSM_LOG_EXIT(sm->p_log);
-}
-
-static void trap_rcv_process_response(IN osm_sm_t * sm,
-				      IN const osm_madw_t * p_madw)
-{
-
-	OSM_LOG_ENTER(sm->p_log);
-
-	OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3808: "
-		"This function is not supported yet\n");
-
+	CL_PLOCK_RELEASE(sm->p_lock);
 	OSM_LOG_EXIT(sm->p_log);
 }
 
@@ -630,7 +669,7 @@ void osm_trap_rcv_process(IN void *context, IN void *data)
 {
 	osm_sm_t *sm = context;
 	osm_madw_t *p_madw = data;
-	ib_smp_t *p_smp;
+	ib_smp_t __attribute__((unused)) *p_smp;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -638,15 +677,9 @@ void osm_trap_rcv_process(IN void *context, IN void *data)
 
 	p_smp = osm_madw_get_smp_ptr(p_madw);
 
-	/*
-	   Determine if this is a request for our own Trap
-	   or if this is a response to our request for another
-	   SM's Trap.
-	 */
-	if (ib_smp_is_response(p_smp))
-		trap_rcv_process_response(sm, p_madw);
-	else
-		trap_rcv_process_request(sm, p_madw);
+	/* Only Trap requests get here */
+	CL_ASSERT(!ib_smp_is_response(p_smp));
+	trap_rcv_process_request(sm, p_madw);
 
 	OSM_LOG_EXIT(sm->p_log);
 }
diff --git a/opensm/osm_ucast_cache.c b/opensm/osm_ucast_cache.c
index f0b2346..2fab643 100644
--- a/opensm/osm_ucast_cache.c
+++ b/opensm/osm_ucast_cache.c
@@ -114,13 +114,19 @@ static cache_switch_t *cache_sw_new(uint16_t lid_ho, unsigned num_ports)
 
 static void cache_sw_destroy(cache_switch_t * p_sw)
 {
+	unsigned i;
+
 	if (!p_sw)
 		return;
 
 	if (p_sw->lft)
 		free(p_sw->lft);
-	if (p_sw->hops)
+	if (p_sw->hops) {
+		for (i = 0; i < p_sw->num_hops; i++)
+			if (p_sw->hops[i])
+				free(p_sw->hops[i]);
 		free(p_sw->hops);
+	}
 	free(p_sw);
 }
 
@@ -559,6 +565,17 @@ static void ucast_cache_validate(osm_ucast_mgr_t * p_mgr)
 					    osm_get_port_by_guid(p_mgr->p_subn,
 								 osm_physp_get_port_guid
 								 (p_remote_physp));
+					if (!p_remote_port) {
+						OSM_LOG(p_mgr->p_log,
+							OSM_LOG_ERROR,
+							"ERR AD04: No port was found for "
+							"port GUID 0x%" PRIx64 "\n",
+							cl_ntoh64(osm_physp_get_port_guid
+								      (p_remote_physp)));
+						osm_ucast_cache_invalidate
+						    (p_mgr);
+						goto Exit;
+					}
 					if (p_remote_port->is_new) {
 						OSM_LOG(p_mgr->p_log,
 							OSM_LOG_DEBUG,
diff --git a/opensm/osm_ucast_dfsssp.c b/opensm/osm_ucast_dfsssp.c
index d6d65b1..5eaff3d 100644
--- a/opensm/osm_ucast_dfsssp.c
+++ b/opensm/osm_ucast_dfsssp.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2009-2011 ZIH, TU Dresden, Federal Republic of Germany. All rights reserved.
+ * Copyright (C) 2012-2013 Tokyo Institute of Technology. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -52,6 +53,8 @@
 #include <opensm/osm_ucast_mgr.h>
 #include <opensm/osm_opensm.h>
 #include <opensm/osm_node.h>
+#include <opensm/osm_multicast.h>
+#include <opensm/osm_mcast_mgr.h>
 
 /* "infinity" for dijkstra */
 #define INF      0x7FFFFFFF
@@ -130,6 +133,7 @@ typedef struct dfsssp_context {
 	vertex_t *adj_list;
 	uint32_t adj_list_size;
 	vltable_t *srcdest2vl_table;
+	uint8_t *vl_split_count;
 } dfsssp_context_t;
 
 /**************** set initial values for structs **********************
@@ -339,7 +343,7 @@ static void heap_free(binary_heap_t * heap)
 /* compare function of two lids for stdlib qsort */
 static int cmp_lids(const void *l1, const void *l2)
 {
-	uint16_t lid1 = *((uint16_t *) l1), lid2 = *((uint16_t *) l2);
+	ib_net16_t lid1 = *((ib_net16_t *) l1), lid2 = *((ib_net16_t *) l2);
 
 	if (lid1 < lid2)
 		return -1;
@@ -352,19 +356,19 @@ static int cmp_lids(const void *l1, const void *l2)
 /* use stdlib to sort the lid array */
 static inline void vltable_sort_lids(vltable_t * vltable)
 {
-	qsort(vltable->lids, vltable->num_lids, sizeof(uint16_t), cmp_lids);
+	qsort(vltable->lids, vltable->num_lids, sizeof(ib_net16_t), cmp_lids);
 }
 
 /* use stdlib to get index of key in lid array;
    return -1 if lid isn't found in lids array
 */
-static inline int64_t vltable_get_lidindex(uint16_t * key, vltable_t * vltable)
+static inline int64_t vltable_get_lidindex(ib_net16_t * key, vltable_t * vltable)
 {
-	uint16_t *found_lid = NULL;
+	ib_net16_t *found_lid = NULL;
 
 	found_lid =
-	    (uint16_t *) bsearch(key, vltable->lids, vltable->num_lids,
-				 sizeof(uint16_t), cmp_lids);
+	    (ib_net16_t *) bsearch(key, vltable->lids, vltable->num_lids,
+				   sizeof(ib_net16_t), cmp_lids);
 	if (found_lid)
 		return found_lid - vltable->lids;
 	else
@@ -374,7 +378,7 @@ static inline int64_t vltable_get_lidindex(uint16_t * key, vltable_t * vltable)
 /* get virtual lane from src lid X dest lid kombination;
    return -1 for invalid lids
 */
-static int32_t vltable_get_vl(vltable_t * vltable, uint16_t slid, uint16_t dlid)
+static int32_t vltable_get_vl(vltable_t * vltable, ib_net16_t slid, ib_net16_t dlid)
 {
 	int64_t ind1 = vltable_get_lidindex(&slid, vltable);
 	int64_t ind2 = vltable_get_lidindex(&dlid, vltable);
@@ -387,8 +391,8 @@ static int32_t vltable_get_vl(vltable_t * vltable, uint16_t slid, uint16_t dlid)
 }
 
 /* set a virtual lane in the matrix */
-static inline void vltable_insert(vltable_t * vltable, uint16_t slid,
-				  uint16_t dlid, uint8_t vl)
+static inline void vltable_insert(vltable_t * vltable, ib_net16_t slid,
+				  ib_net16_t dlid, uint8_t vl)
 {
 	int64_t ind1 = vltable_get_lidindex(&slid, vltable);
 	int64_t ind2 = vltable_get_lidindex(&dlid, vltable);
@@ -436,8 +440,8 @@ static void vltable_print(osm_ucast_mgr_t * p_mgr, vltable_t * vltable)
 				OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 					"   route from src_lid=%" PRIu16
 					" to dest_lid=%" PRIu16 " on vl=%" PRIu8
-					"\n", vltable->lids[ind1],
-					vltable->lids[ind2],
+					"\n", cl_ntoh16(vltable->lids[ind1]),
+					cl_ntoh16(vltable->lids[ind2]),
 					vltable->vls[ind1 +
 						     ind2 * vltable->num_lids]);
 			}
@@ -464,7 +468,7 @@ static int vltable_alloc(vltable_t ** vltable, uint64_t size)
 	if (!(*vltable))
 		goto ERROR;
 	(*vltable)->num_lids = size;
-	(*vltable)->lids = (uint16_t *) malloc(size * sizeof(uint16_t));
+	(*vltable)->lids = (ib_net16_t *) malloc(size * sizeof(ib_net16_t));
 	if (!((*vltable)->lids))
 		goto ERROR;
 	(*vltable)->vls = (uint8_t *) malloc(size * size * sizeof(uint8_t));
@@ -815,7 +819,7 @@ static int update_channel_dep_graph(cdg_node_t ** cdg_root,
 		    osm_node_get_remote_node(local_node, local_port,
 					     &remote_port);
 		/* if remote_node is a Hca, then the last channel from switch to Hca would be a sink in the cdg -> skip */
-		if (!remote_node->sw)
+		if (!remote_node || !remote_node->sw)
 			break;
 		remote_lid = cl_ntoh16(osm_node_get_base_lid(remote_node, 0));
 
@@ -961,7 +965,7 @@ static int remove_path_from_cdg(cdg_node_t ** cdg_root, osm_port_t * src_port,
 		    osm_node_get_remote_node(local_node, local_port,
 					     &remote_port);
 		/* if remote_node is a Hca, then the last channel from switch to Hca would be a sink in the cdg -> skip */
-		if (!remote_node->sw)
+		if (!remote_node || !remote_node->sw)
 			break;
 		remote_lid = cl_ntoh16(osm_node_get_base_lid(remote_node, 0));
 
@@ -1013,6 +1017,127 @@ ERROR:
 /**********************************************************************
  **********************************************************************/
 
+/************ helper functions to generate an ordered list of ports ***
+ ************ (functions copied from osm_ucast_mgr.c and modified) ****
+ **********************************************************************/
+static void add_sw_endports_to_order_list(osm_switch_t * sw,
+					  osm_ucast_mgr_t * m,
+					  cl_qmap_t * guid_tbl,
+					  boolean_t add_guids)
+{
+	osm_port_t *port;
+	uint64_t port_guid;
+	osm_physp_t *p;
+	int i;
+	boolean_t found;
+
+	for (i = 1; i < sw->num_ports; i++) {
+		p = osm_node_get_physp_ptr(sw->p_node, i);
+		if (p && p->p_remote_physp && !p->p_remote_physp->p_node->sw) {
+			port_guid = p->p_remote_physp->port_guid;
+			port = osm_get_port_by_guid(m->p_subn, port_guid);
+			if (!port)
+				continue;
+			if (!cl_is_qmap_empty(guid_tbl)) {
+				found = (cl_qmap_get(guid_tbl, port_guid)
+					 != cl_qmap_end(guid_tbl));
+				if ((add_guids && !found)
+				    || (!add_guids && found))
+					continue;
+			}
+			if (!cl_is_item_in_qlist(&m->port_order_list,
+						 &port->list_item))
+				cl_qlist_insert_tail(&m->port_order_list,
+						     &port->list_item);
+			else
+				OSM_LOG(m->p_log, OSM_LOG_INFO,
+					"WRN AD37: guid 0x%016" PRIx64
+					" already in list\n", port_guid);
+		}
+	}
+}
+
+static void add_guid_to_order_list(uint64_t guid, osm_ucast_mgr_t * m)
+{
+	osm_port_t *port = osm_get_port_by_guid(m->p_subn, cl_hton64(guid));
+
+	if (!port) {
+		 OSM_LOG(m->p_log, OSM_LOG_DEBUG,
+			 "port guid not found: 0x%016" PRIx64 "\n", guid);
+	}
+
+	if (!cl_is_item_in_qlist(&m->port_order_list, &port->list_item))
+		cl_qlist_insert_tail(&m->port_order_list, &port->list_item);
+	else
+		OSM_LOG(m->p_log, OSM_LOG_INFO,
+			"WRN AD38: guid 0x%016" PRIx64 " already in list\n",
+			guid);
+}
+
+/* compare function of #Hca attached to a switch for stdlib qsort */
+static int cmp_num_hca(const void * l1, const void * l2)
+{
+	vertex_t *sw1 = *((vertex_t **) l1);
+	vertex_t *sw2 = *((vertex_t **) l2);
+	uint32_t num_hca1 = 0, num_hca2 = 0;
+
+	if (sw1)
+		num_hca1 = sw1->num_hca;
+	if (sw2)
+		num_hca2 = sw2->num_hca;
+
+	if (num_hca1 > num_hca2)
+		return -1;
+	else if (num_hca1 < num_hca2)
+		return 1;
+	else
+		return 0;
+}
+
+/* use stdlib to sort the switch array depending on num_hca */
+static inline void sw_list_sort_by_num_hca(vertex_t ** sw_list,
+					   uint32_t sw_list_size)
+{
+	qsort(sw_list, sw_list_size, sizeof(vertex_t *), cmp_num_hca);
+}
+
+/**********************************************************************
+ **********************************************************************/
+
+/************ helper functions to manage a map of CN and I/O guids ****
+ **********************************************************************/
+static int add_guid_to_map(void * cxt, uint64_t guid, char * p)
+{
+	cl_qmap_t *map = cxt;
+	name_map_item_t *item;
+
+	item = malloc(sizeof(*item));
+	if (!item)
+		return -1;
+
+	item->guid = cl_hton64(guid);	/* internal: network byte order */
+	item->name = NULL;		/* name isn't needed */
+	cl_qmap_insert(map, item->guid, &item->item);
+
+	return 0;
+}
+
+static void destroy_guid_map(cl_qmap_t * guid_tbl)
+{
+	name_map_item_t *p_guid = NULL, *p_next_guid = NULL;
+
+	p_next_guid = (name_map_item_t *) cl_qmap_head(guid_tbl);
+	while (p_next_guid != (name_map_item_t *) cl_qmap_end(guid_tbl)) {
+		p_guid = p_next_guid;
+		p_next_guid = (name_map_item_t *) cl_qmap_next(&p_guid->item);
+		free(p_guid);
+	}
+	cl_qmap_remove_all(guid_tbl);
+}
+
+/**********************************************************************
+ **********************************************************************/
+
 static void dfsssp_print_graph(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
 			       uint32_t size)
 {
@@ -1056,7 +1181,7 @@ static int dfsssp_build_graph(void *context)
 	dfsssp_context_t *dfsssp_ctx = (dfsssp_context_t *) context;
 	osm_ucast_mgr_t *p_mgr = (osm_ucast_mgr_t *) (dfsssp_ctx->p_mgr);
 
-	cl_qmap_t *port_tbl = &p_mgr->p_subn->port_guid_tbl;	/* 1 managment port per switch + 1 or 2 ports for each Hca */
+	cl_qmap_t *port_tbl = &p_mgr->p_subn->port_guid_tbl;	/* 1 management port per switch + 1 or 2 ports for each Hca */
 	osm_port_t *p_port = NULL;
 	cl_qmap_t *sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
 	cl_map_item_t *item = NULL;
@@ -1088,16 +1213,22 @@ static int dfsssp_build_graph(void *context)
 	if (!adj_list) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
 			"ERR AD02: cannot allocate memory for adj_list\n");
-		return 1;
+		goto ERROR;
 	}
 	for (i = 0; i < adj_list_size; i++)
 		set_default_vertex(&adj_list[i]);
 
-	/* count the total number of Hca / LIDs (for lmc>0) in the fabric */
+	dfsssp_ctx->adj_list = adj_list;
+	dfsssp_ctx->adj_list_size = adj_list_size;
+
+	/* count the total number of Hca / LIDs (for lmc>0) in the fabric;
+	   even include base/enhanced switch port 0; base SP0 will have lmc=0
+	 */
 	for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);
 	     item = cl_qmap_next(item)) {
 		p_port = (osm_port_t *) item;
-		if (osm_node_get_type(p_port->p_node) == IB_NODE_TYPE_CA) {
+		if (osm_node_get_type(p_port->p_node) == IB_NODE_TYPE_CA ||
+		    osm_node_get_type(p_port->p_node) == IB_NODE_TYPE_SWITCH) {
 			lmc = osm_port_get_lmc(p_port);
 			total_num_hca += (1 << lmc);
 		}
@@ -1122,12 +1253,16 @@ static int dfsssp_build_graph(void *context)
 			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
 				"ERR AD03: cannot allocate memory for a link\n");
 			dfsssp_context_destroy(context);
-			return 1;
+			goto ERROR;
 		}
 		head = link;
 		head->next = NULL;
 
-		/* iterate over all ports in the switch, start with port 1 (port 0 is a managment port) */
+		/* add SP0 to number of CA conneted to a switch */
+		lmc = osm_node_get_lmc(sw->p_node, 0);
+		adj_list[i].num_hca += (1 << lmc);
+
+		/* iterate over all ports in the switch, start with port 1 (port 0 is a management port) */
 		for (port = 1; port < sw->num_ports; port++) {
 			/* get the node behind the port */
 			remote_node =
@@ -1142,7 +1277,7 @@ static int dfsssp_build_graph(void *context)
 				continue;
 			/* if there is a Hca connected -> count and cycle */
 			if (!remote_node->sw) {
-				lmc = osm_port_get_lmc(p_port);
+				lmc = osm_node_get_lmc(remote_node, (uint32_t)remote_port);
 				adj_list[i].num_hca += (1 << lmc);
 				continue;
 			}
@@ -1158,7 +1293,12 @@ static int dfsssp_build_graph(void *context)
 				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
 					"ERR AD08: cannot allocate memory for a link\n");
 				dfsssp_context_destroy(context);
-				return 1;
+				while (head) {
+					link = head;
+					head = head->next;
+					free(link);
+				}
+				goto ERROR;
 			}
 			link = link->next;
 			set_default_link(link);
@@ -1167,7 +1307,7 @@ static int dfsssp_build_graph(void *context)
 			link->from = i;
 			link->from_port = port;
 			link->to_port = remote_port;
-			link->weight = total_num_hca * total_num_hca;	/* initilize with P^2 to force shortest paths */
+			link->weight = total_num_hca * total_num_hca;	/* initialize with P^2 to force shortest paths */
 		}
 
 		adj_list[i].links = head->next;
@@ -1190,11 +1330,11 @@ static int dfsssp_build_graph(void *context)
 	if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG))
 		dfsssp_print_graph(p_mgr, adj_list, adj_list_size);
 
-	dfsssp_ctx->adj_list = adj_list;
-	dfsssp_ctx->adj_list_size = adj_list_size;
-
 	OSM_LOG_EXIT(p_mgr->p_log);
 	return 0;
+
+ERROR:
+	return -1;
 }
 
 static void print_routes(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
@@ -1376,12 +1516,9 @@ static int dijkstra(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
    from the last dijsktra step
 */
 static int update_lft(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
-		      uint32_t adj_list_size, osm_port_t * p_port)
+		      uint32_t adj_list_size, osm_port_t * p_port, uint16_t lid)
 {
 	uint32_t i = 0;
-	int32_t index = -1;
-	uint64_t guid;
-	uint16_t lid = 0;
 	uint8_t port = 0;
 	uint8_t hops = 0;
 	osm_switch_t *p_sw = NULL;
@@ -1391,34 +1528,7 @@ static int update_lft(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
-	if (osm_node_get_type(p_port->p_node) == IB_NODE_TYPE_SWITCH) {
-		/* we have to search for the right switch, with it's lid to update the LFT */
-		guid = cl_ntoh64(osm_node_get_node_guid(p_port->p_node));
-		for (i = 0; i < adj_list_size; i++) {
-			if (adj_list[i].guid == guid) {
-				index = i;
-				break;
-			}
-		}
-	} else {
-		/* update the routing to a Hca -> index 0 contains the Hca */
-		index = 0;
-	}
-
-	if (index >= 0) {
-		lid = adj_list[index].lid;
-	} else {
-		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
-			"ERR AD06: cannot find port in adj_list to run update_lft\n");
-		return 1;
-	}
-
 	for (i = 1; i < adj_list_size; i++) {
-		/* for each switch the port to the 'self'lid is the managment port (=0) */
-		adj_list[i].sw->new_lft[adj_list[i].lid] = 0;
-		/* the hop count to to the 'self'lid is 0 for each switch */
-		osm_switch_set_hops(adj_list[i].sw, adj_list[i].lid, 0, 0);
-
 		/* if no route goes thru this switch -> cycle */
 		if (!(adj_list[i].used_link))
 			continue;
@@ -1489,11 +1599,141 @@ static int update_lft(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
 	return 0;
 }
 
+/* the function updates the multicast group membership information
+   similar to create_mgrp_switch_map (osm_mcast_mgr.c)
+   => with it we can identify if a switch needs to be processed
+   or not in update_mcft
+*/
+static void update_mgrp_membership(cl_qlist_t * port_list)
+{
+	osm_mcast_work_obj_t *wobj = NULL;
+	osm_port_t *port = NULL;
+	osm_switch_t *sw = NULL;
+	cl_list_item_t *i = NULL;
+
+	for (i = cl_qlist_head(port_list); i != cl_qlist_end(port_list);
+	     i = cl_qlist_next(i)) {
+		wobj = cl_item_obj(i, wobj, list_item);
+		port = wobj->p_port;
+		if (port->p_node->sw) {
+			sw = port->p_node->sw;
+			sw->is_mc_member = 1;
+		} else {
+			sw = port->p_physp->p_remote_physp->p_node->sw;
+			sw->num_of_mcm++;
+		}
+	}
+}
+
+/* reset is_mc_member and num_of_mcm for future computations */
+static void reset_mgrp_membership(vertex_t * adj_list, uint32_t adj_list_size)
+{
+	uint32_t i = 0;
+
+	for (i = 1; i < adj_list_size; i++) {
+		adj_list[i].sw->is_mc_member = 0;
+		adj_list[i].sw->num_of_mcm = 0;
+	}
+}
+
+/* update the multicast forwarding tables of all switches with the informations
+   from the previous dijsktra step for the current mlid
+*/
+static int update_mcft(osm_sm_t * p_sm, vertex_t * adj_list,
+		       uint32_t adj_list_size, uint16_t mlid_ho,
+		       cl_qmap_t * port_map, osm_switch_t * root_sw)
+{
+	uint32_t i = 0;
+	uint8_t port = 0, remote_port = 0;
+	uint8_t upstream_port = 0, downstream_port = 0;
+	ib_net64_t guid = 0;
+	osm_switch_t *p_sw = NULL;
+	osm_node_t *remote_node = NULL;
+	osm_physp_t *p_physp = NULL;
+	osm_mcast_tbl_t *p_tbl = NULL;
+	vertex_t *curr_adj = NULL;
+
+	OSM_LOG_ENTER(p_sm->p_log);
+
+	for (i = 1; i < adj_list_size; i++) {
+		p_sw = adj_list[i].sw;
+		OSM_LOG(p_sm->p_log, OSM_LOG_VERBOSE,
+			"Processing switch 0x%016" PRIx64
+			" (%s) for MLID 0x%X\n", cl_ntoh64(adj_list[i].guid),
+			p_sw->p_node->print_desc, mlid_ho);
+
+		/* if a) the switch does not support mcast  or
+		      b) no ports of this switch are part or the mcast group
+		   then cycle
+		 */
+		if (osm_switch_supports_mcast(p_sw) == FALSE ||
+		    (p_sw->num_of_mcm == 0 && !(p_sw->is_mc_member)))
+			continue;
+
+		p_tbl = osm_switch_get_mcast_tbl_ptr(p_sw);
+
+		/* add all ports of this sw to the mcast table,
+		   if they are part of the mcast grp
+		 */
+		if (p_sw->is_mc_member)
+			osm_mcast_tbl_set(p_tbl, mlid_ho, 0);
+		for (port = 1; port < p_sw->num_ports; port++) {
+			/* get the node behind the port */
+			remote_node =
+				osm_node_get_remote_node(p_sw->p_node, port,
+							 &remote_port);
+			/* check if connected and its not the same switch */
+			if (!remote_node || remote_node->sw == p_sw)
+				continue;
+			/* make sure the link is healthy */
+			p_physp = osm_node_get_physp_ptr(p_sw->p_node, port);
+			if (!p_physp || !osm_link_is_healthy(p_physp))
+				continue;
+			/* we don't add upstream ports in this step */
+			if (osm_node_get_type(remote_node) != IB_NODE_TYPE_CA)
+				continue;
+
+			guid = osm_physp_get_port_guid(osm_node_get_physp_ptr(
+						       remote_node,
+						       remote_port));
+			if (cl_qmap_get(port_map, guid)
+			    != cl_qmap_end(port_map))
+				osm_mcast_tbl_set(p_tbl, mlid_ho, port);
+		}
+
+		/* now we have to add the upstream port of 'this' switch and
+		   the downstream port of the next switch to the mcast table
+		   until we reach the root_sw
+		 */
+		curr_adj = &adj_list[i];
+		while (curr_adj->sw != root_sw) {
+			/* the used_link is the link that was used in dijkstra to reach this node,
+			   so the to_port is the local (upstream) port on curr_adj->sw
+			 */
+			upstream_port = curr_adj->used_link->to_port;
+			osm_mcast_tbl_set(p_tbl, mlid_ho, upstream_port);
+
+			/* now we go one step in direction root_sw and add the
+			   downstream port for the spanning tree
+			 */
+			downstream_port = curr_adj->used_link->from_port;
+			p_tbl = osm_switch_get_mcast_tbl_ptr(
+				adj_list[curr_adj->used_link->from].sw);
+			osm_mcast_tbl_set(p_tbl, mlid_ho, downstream_port);
+
+			curr_adj = &adj_list[curr_adj->used_link->from];
+		}
+	}
+
+	OSM_LOG_EXIT(p_sm->p_log);
+	return 0;
+}
+
 /* increment the edge weights of the df-/sssp graph which represent the number
    of paths on this link
 */
 static void update_weights(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
-			   uint32_t adj_list_size, osm_port_t * port)
+			   uint32_t adj_list_size)
 {
 	uint32_t i = 0, j = 0;
 	uint32_t additional_weight = 0;
@@ -1504,11 +1744,7 @@ static void update_weights(osm_ucast_mgr_t * p_mgr, vertex_t * adj_list,
 		/* if no route goes thru this switch -> cycle */
 		if (!(adj_list[i].used_link))
 			continue;
-		/* if the source of dijkstra was a Hca -> add num_hca for the weight, else a weight of 1 */
-		if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_CA)
-			additional_weight = adj_list[i].num_hca;
-		else
-			additional_weight = 1;
+		additional_weight = adj_list[i].num_hca;
 
 		j = i;
 		while (adj_list[j].used_link) {
@@ -1538,7 +1774,7 @@ static uint8_t get_avail_vl_in_subn(osm_ucast_mgr_t * p_mgr)
 	     item = cl_qmap_next(item)) {
 		sw = (osm_switch_t *) item;
 
-		/* ignore managment port 0 */
+		/* ignore management port 0 */
 		for (i = 1; i < osm_node_get_num_physp(sw->p_node); i++) {
 			osm_physp_t *p_physp =
 			    osm_node_get_physp_ptr(sw->p_node, i);
@@ -1574,12 +1810,13 @@ static int dfsssp_remove_deadlocks(dfsssp_context_t * dfsssp_ctx)
 {
 	osm_ucast_mgr_t *p_mgr = (osm_ucast_mgr_t *) dfsssp_ctx->p_mgr;
 
-	cl_qmap_t *port_tbl = &p_mgr->p_subn->port_guid_tbl;	/* 1 managment port per switch + 1 or 2 ports for each Hca */
+	cl_qmap_t *port_tbl = &p_mgr->p_subn->port_guid_tbl;	/* 1 management port per switch + 1 or 2 ports for each Hca */
 	cl_map_item_t *item1 = NULL, *item2 = NULL;
 	osm_port_t *src_port = NULL, *dest_port = NULL;
 
-	uint32_t i = 0, err = 0;
-	uint8_t test_vl = 0, vl_avail = 0, vl_needed = 1;
+	uint32_t i = 0, j = 0, err = 0;
+	uint8_t vl = 0, test_vl = 0, vl_avail = 0, vl_needed = 1;
+	double most_avg_paths = 0.0;
 	cdg_node_t **cdg = NULL, *start_here = NULL, *cycle = NULL;
 	cdg_link_t *weakest_link = NULL;
 	uint32_t srcdest = 0;
@@ -1591,6 +1828,7 @@ static int dfsssp_remove_deadlocks(dfsssp_context_t * dfsssp_ctx)
 	uint64_t *paths_per_vl = NULL;
 	uint64_t from = 0, to = 0, count = 0;
 	uint8_t *split_count = NULL;
+	uint8_t ntype = 0;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
@@ -1619,11 +1857,18 @@ static int dfsssp_remove_deadlocks(dfsssp_context_t * dfsssp_ctx)
 		cdg[i] = NULL;
 
 	count = 0;
-	/* count all ports (also multiple LIDs) of type CA for size of VL table */
+	/* count all ports (also multiple LIDs) of type CA or SP0 for size of VL table */
 	for (item1 = cl_qmap_head(port_tbl); item1 != cl_qmap_end(port_tbl);
 	     item1 = cl_qmap_next(item1)) {
 		dest_port = (osm_port_t *) item1;
-		if (osm_node_get_type(dest_port->p_node) == IB_NODE_TYPE_CA) {
+		ntype = osm_node_get_type(dest_port->p_node);
+		if (ntype == IB_NODE_TYPE_CA || ntype == IB_NODE_TYPE_SWITCH) {
+			/* only SP0 with SLtoVLMapping support will be processed */
+			if (ntype == IB_NODE_TYPE_SWITCH
+			    && !(dest_port->p_physp->port_info.capability_mask
+			    & IB_PORT_CAP_HAS_SL_MAP))
+				continue;
+
 			lmc = osm_port_get_lmc(dest_port);
 			count += (1 << lmc);
 		}
@@ -1641,64 +1886,79 @@ static int dfsssp_remove_deadlocks(dfsssp_context_t * dfsssp_ctx)
 	for (item1 = cl_qmap_head(port_tbl); item1 != cl_qmap_end(port_tbl);
 	     item1 = cl_qmap_next(item1)) {
 		dest_port = (osm_port_t *) item1;
-		if (osm_node_get_type(dest_port->p_node) == IB_NODE_TYPE_CA) {
+		ntype = osm_node_get_type(dest_port->p_node);
+		if (ntype == IB_NODE_TYPE_CA || ntype == IB_NODE_TYPE_SWITCH) {
+			/* only SP0 with SLtoVLMapping support will be processed */
+			if (ntype == IB_NODE_TYPE_SWITCH
+			    && !(dest_port->p_physp->port_info.capability_mask
+			    & IB_PORT_CAP_HAS_SL_MAP))
+				continue;
+
 			osm_port_get_lid_range_ho(dest_port, &min_lid_ho,
 						  &max_lid_ho);
 			for (dlid = min_lid_ho; dlid <= max_lid_ho; dlid++, i++)
-				srcdest2vl_table->lids[i] = dlid;
+				srcdest2vl_table->lids[i] = cl_hton16(dlid);
 		}
 	}
 	/* sort lids */
 	vltable_sort_lids(srcdest2vl_table);
 
 	test_vl = 0;
-	/* fill cdg[0] with routes from each src/dest port combination for all Hca in the subnet */
+	/* fill cdg[0] with routes from each src/dest port combination for all Hca/SP0 in the subnet */
 	for (item1 = cl_qmap_head(port_tbl); item1 != cl_qmap_end(port_tbl);
 	     item1 = cl_qmap_next(item1)) {
 		dest_port = (osm_port_t *) item1;
-		if (osm_node_get_type(dest_port->p_node) == IB_NODE_TYPE_CA) {
-
-			for (item2 = cl_qmap_head(port_tbl);
-			     item2 != cl_qmap_end(port_tbl);
-			     item2 = cl_qmap_next(item2)) {
-				src_port = (osm_port_t *) item2;
-				if (osm_node_get_type(src_port->p_node) ==
-				    IB_NODE_TYPE_CA && src_port != dest_port) {
-
-					/* iterate over LIDs of src and dest port */
-					osm_port_get_lid_range_ho(src_port,
-								  &min_lid_ho,
-								  &max_lid_ho);
-					for (slid = min_lid_ho;
-					     slid <= max_lid_ho; slid++) {
-						osm_port_get_lid_range_ho
-						    (dest_port, &min_lid_ho2,
-						     &max_lid_ho2);
-						for (dlid = min_lid_ho2;
-						     dlid <= max_lid_ho2;
-						     dlid++) {
-
-							/* try to add the path to cdg[0] */
-							err =
-							    update_channel_dep_graph
-							    (&(cdg[test_vl]),
-							     src_port, slid,
-							     dest_port, dlid);
-							if (err) {
-								OSM_LOG(p_mgr->
-									p_log,
-									OSM_LOG_ERROR,
-									"ERR AD14: cannot allocate memory for cdg node or link in update_channel_dep_graph(...)\n");
-								goto ERROR;
-							}
-							/* add the <s,d> kombination / coresponding virtual lane to the VL table */
-							vltable_insert
-							    (srcdest2vl_table,
-							     slid, dlid,
-							     test_vl);
-							paths_per_vl[test_vl]++;
+		ntype = osm_node_get_type(dest_port->p_node);
+		if ((ntype != IB_NODE_TYPE_CA && ntype != IB_NODE_TYPE_SWITCH)
+		    || !(dest_port->p_physp->port_info.capability_mask
+		    & IB_PORT_CAP_HAS_SL_MAP))
+			continue;
+
+		for (item2 = cl_qmap_head(port_tbl);
+		     item2 != cl_qmap_end(port_tbl);
+		     item2 = cl_qmap_next(item2)) {
+			src_port = (osm_port_t *) item2;
+			ntype = osm_node_get_type(src_port->p_node);
+			if ((ntype != IB_NODE_TYPE_CA
+			    && ntype != IB_NODE_TYPE_SWITCH)
+			    || !(src_port->p_physp->port_info.capability_mask
+			    & IB_PORT_CAP_HAS_SL_MAP))
+				continue;
 
+			if (src_port != dest_port) {
+				/* iterate over LIDs of src and dest port */
+				osm_port_get_lid_range_ho(src_port, &min_lid_ho,
+							  &max_lid_ho);
+				for (slid = min_lid_ho; slid <= max_lid_ho;
+				     slid++) {
+					osm_port_get_lid_range_ho
+					    (dest_port, &min_lid_ho2,
+					     &max_lid_ho2);
+					for (dlid = min_lid_ho2;
+					     dlid <= max_lid_ho2;
+					     dlid++) {
+
+						/* try to add the path to cdg[0] */
+						err =
+						    update_channel_dep_graph
+						    (&(cdg[test_vl]),
+						     src_port, slid,
+						     dest_port, dlid);
+						if (err) {
+							OSM_LOG(p_mgr->
+								p_log,
+								OSM_LOG_ERROR,
+								"ERR AD14: cannot allocate memory for cdg node or link in update_channel_dep_graph(...)\n");
+							goto ERROR;
 						}
+						/* add the <s,d> kombination / coresponding virtual lane to the VL table */
+						vltable_insert
+						    (srcdest2vl_table,
+						     cl_hton16(slid),
+						     cl_hton16(dlid),
+						     test_vl);
+						paths_per_vl[test_vl]++;
+
 					}
 
 				}
@@ -1724,6 +1984,7 @@ static int dfsssp_remove_deadlocks(dfsssp_context_t * dfsssp_ctx)
 				if (!weakest_link) {
 					OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
 						"ERR AD27: something went wrong in get_weakest_link_in_cycle(...)\n");
+					err = 1;
 					goto ERROR;
 				}
 
@@ -1745,8 +2006,15 @@ static int dfsssp_remove_deadlocks(dfsssp_context_t * dfsssp_ctx)
 					if (test_vl !=
 					    (uint8_t)
 					    vltable_get_vl(srcdest2vl_table,
-							   slid, dlid))
+							   cl_hton16(slid),
+							   cl_hton16(dlid))) {
+						/* this path has been moved
+						   before -> don't count
+						 */
+						paths_per_vl[test_vl]++;
+						paths_per_vl[test_vl + 1]--;
 						continue;
+					}
 
 					src_port =
 					    osm_get_port_by_lid(p_mgr->p_subn,
@@ -1787,8 +2055,10 @@ static int dfsssp_remove_deadlocks(dfsssp_context_t * dfsssp_ctx)
 							"ERR AD14: cannot allocate memory for cdg node or link in update_channel_dep_graph(...)\n");
 						goto ERROR;
 					}
-					vltable_insert(srcdest2vl_table, slid,
-						       dlid, test_vl + 1);
+					vltable_insert(srcdest2vl_table,
+						       cl_hton16(slid),
+						       cl_hton16(dlid),
+						       test_vl + 1);
 				}
 
 				if (weakest_link->num_pairs)
@@ -1828,59 +2098,87 @@ static int dfsssp_remove_deadlocks(dfsssp_context_t * dfsssp_ctx)
 	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
 		"Balancing the paths on the available Virtual Lanes\n");
 
-	/* balancing virtual lanes, but avoid additional cycle check -> balancing suboptimal */
-	if (vl_needed == 1) {
-		from = 0;
-		count = paths_per_vl[0] / vl_avail;
-		for (to = 1; to < vl_avail; to++) {
-			vltable_change_vl(srcdest2vl_table, from, to, count);
-			paths_per_vl[from] -= count;
-			paths_per_vl[to] += count;
-		}
-	} else if (vl_needed < vl_avail) {
-		split_count = (uint8_t *) malloc(vl_needed * sizeof(uint8_t));
-		if (!split_count) {
-			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
-				"ERR AD24: cannot allocate memory for split_count, skip balancing\n");
-		} else {
-			memset(split_count, 0, vl_needed * sizeof(uint8_t));
-			for (i = vl_needed; i < vl_avail; i++)
-				split_count[(i - vl_needed) % vl_needed]++;
-
-			to = vl_needed;
-			for (from = 0; from < vl_needed; from++) {
-				count =
-				    paths_per_vl[from] / (split_count[from] +
-							  1);
-				for (i = 0; i < split_count[from]; i++) {
-					vltable_change_vl(srcdest2vl_table,
-							  from, to, count);
-					paths_per_vl[from] -= count;
-					paths_per_vl[to] += count;
-					to++;
+	/* optimal balancing virtual lanes, under condition: no additional cycle checks;
+	   sl/vl != 0 might be assigned to loopback packets (i.e. slid/dlid on the
+	   same port for lmc>0), but thats no problem, see IBAS 10.2.2.3
+	 */
+	split_count = (uint8_t *) calloc(vl_avail, sizeof(uint8_t));
+	if (!split_count) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD24: cannot allocate memory for split_count, skip balancing\n");
+		err = 1;
+		goto ERROR;
+	}
+	/* initial state: paths for VLs won't be separated */
+	for (i = 0; i < ((vl_needed < vl_avail) ? vl_needed : vl_avail); i++)
+		split_count[i] = 1;
+	dfsssp_ctx->vl_split_count = split_count;
+	/* balancing is necessary if we have empty VLs */
+	if (vl_needed < vl_avail) {
+		/* split paths of VLs until we find an equal distribution */
+		for (i = vl_needed; i < vl_avail; i++) {
+			/* find VL with most paths in it */
+			vl = 0;
+			most_avg_paths = 0.0;
+			for (test_vl = 0; test_vl < vl_needed; test_vl++) {
+				if (most_avg_paths <
+				    ((double)paths_per_vl[test_vl] /
+				    split_count[test_vl])) {
+					vl = test_vl;
+					most_avg_paths =
+						(double)paths_per_vl[test_vl] /
+						split_count[test_vl];
 				}
 			}
-
-			free(split_count);
+			split_count[vl]++;
+		}
+		/* change the VL assignment depending on split_count for
+		   all VLs except VL 0
+		 */
+		for (from = vl_needed - 1; from > 0; from--) {
+			/* how much space needed for others? */
+			to = 0;
+			for (i = 0; i < from; i++)
+				to += split_count[i];
+			count = paths_per_vl[from];
+			vltable_change_vl(srcdest2vl_table, from, to, count);
+			/* change also the information within the split_count
+			   array; this is important for fast calculation later
+			 */
+			split_count[to] = split_count[from];
+			split_count[from] = 0;
+			paths_per_vl[to] = paths_per_vl[from];
+			paths_per_vl[from] = 0;
 		}
 	} else if (vl_needed > vl_avail) {
 		/* routing not possible, a further development would be the LASH-TOR approach (update: LASH-TOR isn't possible, there is a mistake in the theory) */
 		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
-			"ERR AD25: Not enough VL available (avail=%d, needed=%d); Stop dfsssp routing!\n",
+			"ERR AD25: Not enough VLs available (avail=%d, needed=%d); Stopping dfsssp routing!\n",
 			vl_avail, vl_needed);
+		err = 1;
 		goto ERROR;
 	}
 	/* else { no balancing } */
-	if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_INFO)) {
+
+	if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG)) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 			"Virtual Lanes per src/dest combination after balancing:\n");
 		vltable_print(p_mgr, srcdest2vl_table);
+	}
+	if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_INFO)) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
-			"Paths per VL (after balancing):\n");
-		for (i = 0; i < vl_avail; i++)
+			"Approx. #paths per VL (after balancing):\n");
+		j = 0;
+		count = 1; /* to prevent div. by 0 */
+		for (i = 0; i < vl_avail; i++) {
+			if (split_count[i] > 0) {
+				j = i;
+				count = split_count[i];
+			}
 			OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
 				"   %" PRIu32 ". lane: %" PRIu64 "\n", i,
-				paths_per_vl[i]);
+				paths_per_vl[j] / count);
+		}
 	}
 
 	free(paths_per_vl);
@@ -1907,7 +2205,7 @@ ERROR:
 }
 
 /* meta function which calls subfunctions for dijkstra, update lft and weights,
-   (and remove deadklocks) to calculate the routing for the subnet
+   (and remove deadlocks) to calculate the routing for the subnet
 */
 static int dfsssp_do_dijkstra_routing(void *context)
 {
@@ -1916,101 +2214,229 @@ static int dfsssp_do_dijkstra_routing(void *context)
 	vertex_t *adj_list = (vertex_t *) dfsssp_ctx->adj_list;
 	uint32_t adj_list_size = dfsssp_ctx->adj_list_size;
 
-	cl_qmap_t *port_tbl = &p_mgr->p_subn->port_guid_tbl;	/* 1 managment port per switch + 1 or 2 ports for each Hca */
+	vertex_t **sw_list = NULL;
+	uint32_t sw_list_size = 0;
+	uint64_t guid = 0;
+	cl_qlist_t *qlist = NULL;
+	cl_list_item_t *qlist_item = NULL;
+
 	cl_qmap_t *sw_tbl = &p_mgr->p_subn->sw_guid_tbl;
+	cl_qmap_t cn_tbl, io_tbl, *p_mixed_tbl = NULL;
 	cl_map_item_t *item = NULL;
 	osm_switch_t *sw = NULL;
 	osm_port_t *port = NULL;
 	uint32_t i = 0, err = 0;
 	uint16_t lid = 0, min_lid_ho = 0, max_lid_ho = 0;
+	uint8_t lmc = 0;
+	boolean_t cn_nodes_provided = FALSE, io_nodes_provided = FALSE;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 	OSM_LOG(p_mgr->p_log, OSM_LOG_VERBOSE,
 		"Calculating shortest path from all Hca/switches to all\n");
 
+	cl_qmap_init(&cn_tbl);
+	cl_qmap_init(&io_tbl);
+	p_mixed_tbl = &cn_tbl;
+
+	cl_qlist_init(&p_mgr->port_order_list);
+
 	/* reset the new_lft for each switch */
 	for (item = cl_qmap_head(sw_tbl); item != cl_qmap_end(sw_tbl);
 	     item = cl_qmap_next(item)) {
 		sw = (osm_switch_t *) item;
 		/* initialize LIDs in buffer to invalid port number */
 		memset(sw->new_lft, OSM_NO_PATH, sw->max_lid_ho + 1);
+		/* initialize LFT and hop count for bsp0/esp0 of the switch */
+		min_lid_ho = cl_ntoh16(osm_node_get_base_lid(sw->p_node, 0));
+		lmc = osm_node_get_lmc(sw->p_node, 0);
+		for (i = min_lid_ho; i < min_lid_ho + (1 << lmc); i++) {
+			/* for each switch the port to the 'self'lid is the management port 0 */
+			sw->new_lft[i] = 0;
+			/* the hop count to the 'self'lid is 0 for each switch */
+			osm_switch_set_hops(sw, i, 0, 0);
+		}
 	}
 
-	/* do the routing for the each Hca in the subnet */
-	for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);
-	     item = cl_qmap_next(item)) {
-		port = (osm_port_t *) item;
+	/* we need an intermediate array of pointers to switches in adj_list;
+	   this array will be sorted in respect to num_hca (descending)
+	 */
+	sw_list_size = adj_list_size - 1;
+	sw_list = (vertex_t **)malloc(sw_list_size * sizeof(vertex_t *));
+	if (!sw_list) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+			"ERR AD29: cannot allocate memory for sw_list in dfsssp_do_dijkstra_routing\n");
+		goto ERROR;
+	}
+	memset(sw_list, 0, sw_list_size * sizeof(vertex_t *));
 
-		/* if behind port is a Hca -> calculate shortest path with dijkstra from node to all switches/Hca */
-		if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_CA) {
-			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
-				"Processing Hca with GUID 0x%" PRIx64 "\n",
-				cl_ntoh64(osm_node_get_node_guid
-					  (port->p_node)));
+	/* fill the array with references to the 'real' sw in adj_list */
+	for (i = 0; i < sw_list_size; i++)
+		sw_list[i] = &(adj_list[i + 1]);
 
-			/* distribute the LID range across the ports that can reach those LIDs
-			   to have disjoint paths for one destination port with lmc>0
-			 */
-			osm_port_get_lid_range_ho(port, &min_lid_ho,
-						  &max_lid_ho);
-			for (lid = min_lid_ho; lid <= max_lid_ho; lid++) {
-				/* do dijkstra from this Hca/LID to each switch */
-				err =
-				    dijkstra(p_mgr, adj_list, adj_list_size,
-					     port, lid);
-				if (err)
-					return err;
-				if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log,
-				    OSM_LOG_DEBUG))
-					print_routes(p_mgr, adj_list,
-						     adj_list_size, port);
-
-				/* make an update for the linear forwarding tables of the switches */
-				err =
-				    update_lft(p_mgr, adj_list, adj_list_size,
-					       port);
-				if (err)
-					return err;
-
-				/* add weights for calculated routes to adjust the weights for the next cycle */
-				update_weights(p_mgr, adj_list, adj_list_size,
-					       port);
-
-				if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log,
-				    OSM_LOG_DEBUG))
-					dfsssp_print_graph(p_mgr, adj_list,
-							   adj_list_size);
+	/* sort the sw_list in descending order */
+	sw_list_sort_by_num_hca(sw_list, sw_list_size);
+
+	/* parse compute node guid file, if provided by the user */
+	if (p_mgr->p_subn->opt.cn_guid_file) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Parsing compute nodes from file %s\n",
+			p_mgr->p_subn->opt.cn_guid_file);
+
+		if (parse_node_map(p_mgr->p_subn->opt.cn_guid_file,
+				   add_guid_to_map, &cn_tbl)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR AD33: Problem parsing compute node guid file\n");
+			goto ERROR;
+		}
+
+		if (cl_is_qmap_empty(&cn_tbl))
+			OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+				"WRN AD34: compute node guids file contains no valid guids\n");
+		else
+			cn_nodes_provided = TRUE;
+	}
+
+	/* parse I/O guid file, if provided by the user */
+	if (p_mgr->p_subn->opt.io_guid_file) {
+		OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+			"Parsing I/O nodes from file %s\n",
+			p_mgr->p_subn->opt.io_guid_file);
+
+		if (parse_node_map(p_mgr->p_subn->opt.io_guid_file,
+				   add_guid_to_map, &io_tbl)) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR AD35: Problem parsing I/O guid file\n");
+			goto ERROR;
+		}
+
+		if (cl_is_qmap_empty(&io_tbl))
+			OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
+				"WRN AD36: I/O node guids file contains no valid guids\n");
+		else
+			io_nodes_provided = TRUE;
+	}
+
+	/* if we mix Hca/Tca/SP0 during the dijkstra routing, we might end up
+	   in rare cases with a bad balancing for Hca<->Hca connections, i.e.
+	   some inter-switch links get oversubscribed with paths;
+	   therefore: add Hca ports first to ensure good Hca<->Hca balancing
+	 */
+	if (cn_nodes_provided) {
+		for (i = 0; i < adj_list_size - 1; i++) {
+			if (sw_list[i] && sw_list[i]->sw) {
+				sw = (osm_switch_t *)(sw_list[i]->sw);
+				add_sw_endports_to_order_list(sw, p_mgr,
+							      &cn_tbl, TRUE);
+			} else {
+				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+					"ERR AD30: corrupted sw_list array in dfsssp_do_dijkstra_routing\n");
+				goto ERROR;
 			}
 		}
 	}
-	/* do the routing for the each switch in the subnet to add the routes from switch to switch */
-	for (item = cl_qmap_head(port_tbl); item != cl_qmap_end(port_tbl);
-	     item = cl_qmap_next(item)) {
-		port = (osm_port_t *) item;
+	/* then: add Tca ports to ensure good Hca->Tca balancing and separate
+	   paths towards I/O nodes on the same switch (if possible)
+	 */
+	if (io_nodes_provided) {
+		for (i = 0; i < adj_list_size - 1; i++) {
+			if (sw_list[i] && sw_list[i]->sw) {
+				sw = (osm_switch_t *)(sw_list[i]->sw);
+				add_sw_endports_to_order_list(sw, p_mgr,
+							      &io_tbl, TRUE);
+			} else {
+				OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+					"ERR AD32: corrupted sw_list array in dfsssp_do_dijkstra_routing\n");
+				goto ERROR;
+			}
+		}
+	}
+	/* then: add anything else, such as administration nodes, ... */
+	if (cn_nodes_provided && io_nodes_provided) {
+		cl_qmap_merge(&cn_tbl, &io_tbl);
+	} else if (io_nodes_provided) {
+		p_mixed_tbl = &io_tbl;
+	}
+	for (i = 0; i < adj_list_size - 1; i++) {
+		if (sw_list[i] && sw_list[i]->sw) {
+			sw = (osm_switch_t *)(sw_list[i]->sw);
+			add_sw_endports_to_order_list(sw, p_mgr, p_mixed_tbl,
+						      FALSE);
+		} else {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR AD39: corrupted sw_list array in dfsssp_do_dijkstra_routing\n");
+			goto ERROR;
+		}
+	}
+	/* last: add SP0 afterwards which have lower priority for balancing */
+	for (i = 0; i < sw_list_size; i++) {
+		if (sw_list[i] && sw_list[i]->sw) {
+			sw = (osm_switch_t *)(sw_list[i]->sw);
+			guid = cl_ntoh64(osm_node_get_node_guid(sw->p_node));
+			add_guid_to_order_list(guid, p_mgr);
+		} else {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
+				"ERR AD31: corrupted sw_list array in dfsssp_do_dijkstra_routing\n");
+			goto ERROR;
+		}
+	}
 
-		if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_SWITCH) {
+	/* the intermediate array lived long enough */
+	free(sw_list);
+	/* same is true for the compute node and I/O guid map */
+	destroy_guid_map(&cn_tbl);
+	cn_nodes_provided = FALSE;
+	destroy_guid_map(&io_tbl);
+	io_nodes_provided = FALSE;
+
+	/* do the routing for the each Hca in the subnet and each switch
+	   in the subnet (to add the routes to base/enhanced SP0)
+	 */
+	qlist = &p_mgr->port_order_list;
+	for (qlist_item = cl_qlist_head(qlist);
+	     qlist_item != cl_qlist_end(qlist);
+	     qlist_item = cl_qlist_next(qlist_item)) {
+		port = (osm_port_t *)cl_item_obj(qlist_item, port, list_item);
+
+		/* calculate shortest path with dijkstra from node to all switches/Hca */
+		if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_CA) {
+			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
+				"Processing Hca with GUID 0x%" PRIx64 "\n",
+				cl_ntoh64(osm_node_get_node_guid
+					  (port->p_node)));
+		} else if (osm_node_get_type(port->p_node) == IB_NODE_TYPE_SWITCH) {
 			OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
 				"Processing switch with GUID 0x%" PRIx64 "\n",
 				cl_ntoh64(osm_node_get_node_guid
 					  (port->p_node)));
+		} else {
+			/* we don't handle routers, in case they show up */
+			continue;
+		}
 
-			lid = cl_ntoh16(osm_node_get_base_lid(port->p_node, 0));
-			/* do dijkstra from this switch to each switch */
+		/* distribute the LID range across the ports that can reach those LIDs
+		   to have disjoint paths for one destination port with lmc>0;
+		   for switches with bsp0: min=max; with esp0: max>min if lmc>0
+		 */
+		osm_port_get_lid_range_ho(port, &min_lid_ho,
+					  &max_lid_ho);
+		for (lid = min_lid_ho; lid <= max_lid_ho; lid++) {
+			/* do dijkstra from this Hca/LID/SP0 to each switch */
 			err =
 			    dijkstra(p_mgr, adj_list, adj_list_size, port, lid);
 			if (err)
-				return err;
+				goto ERROR;
 			if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG))
 				print_routes(p_mgr, adj_list, adj_list_size,
 					     port);
 
 			/* make an update for the linear forwarding tables of the switches */
-			err = update_lft(p_mgr, adj_list, adj_list_size, port);
+			err =
+			    update_lft(p_mgr, adj_list, adj_list_size, port, lid);
 			if (err)
-				return err;
+				goto ERROR;
 
 			/* add weights for calculated routes to adjust the weights for the next cycle */
-			update_weights(p_mgr, adj_list, adj_list_size, port);
+			update_weights(p_mgr, adj_list, adj_list_size);
 
 			if (OSM_LOG_IS_ACTIVE_V2(p_mgr->p_log, OSM_LOG_DEBUG))
 				dfsssp_print_graph(p_mgr, adj_list,
@@ -2018,19 +2444,22 @@ static int dfsssp_do_dijkstra_routing(void *context)
 		}
 	}
 
+	/* ordered port list not needed after the dijkstra step */
+	cl_qlist_remove_all(&p_mgr->port_order_list);
+
 	/* try deadlock removal only for the dfsssp routing (not for the sssp case, which is a subset of the dfsssp algorithm) */
 	if (dfsssp_ctx->routing_type == OSM_ROUTING_ENGINE_TYPE_DFSSSP) {
 		/* remove potential deadlocks by assigning different virtual lanes to src/dest paths and balance the lanes */
 		err = dfsssp_remove_deadlocks(dfsssp_ctx);
 		if (err)
-			return err;
+			goto ERROR;
 	} else if (dfsssp_ctx->routing_type == OSM_ROUTING_ENGINE_TYPE_SSSP) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_INFO,
 			"SSSP routing specified -> skipping deadlock removal thru dfsssp_remove_deadlocks(...)\n");
 	} else {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
 			"ERR AD28: wrong routing engine specified in dfsssp_ctx\n");
-		return 1;
+		goto ERROR;
 	}
 
 	/* print the new_lft for each switch after routing is done */
@@ -2055,6 +2484,115 @@ static int dfsssp_do_dijkstra_routing(void *context)
 
 	OSM_LOG_EXIT(p_mgr->p_log);
 	return 0;
+
+ERROR:
+	if (!cl_is_qlist_empty(&p_mgr->port_order_list))
+		cl_qlist_remove_all(&p_mgr->port_order_list);
+	if (cn_nodes_provided)
+		destroy_guid_map(&cn_tbl);
+	if (io_nodes_provided)
+		destroy_guid_map(&io_tbl);
+	if (sw_list)
+		free(sw_list);
+	return -1;
+}
+
+/* meta function which calls subfunctions for finding the optimal switch
+   for the spanning tree, performing a dijkstra step with this sw as root,
+   and calculating the mcast table for MLID
+*/
+static ib_api_status_t dfsssp_do_mcast_routing(void * context,
+					       osm_mgrp_box_t * mbox)
+{
+	dfsssp_context_t *dfsssp_ctx = (dfsssp_context_t *) context;
+	osm_ucast_mgr_t *p_mgr = (osm_ucast_mgr_t *) dfsssp_ctx->p_mgr;
+	osm_sm_t *sm = (osm_sm_t *) p_mgr->sm;
+	vertex_t *adj_list = (vertex_t *) dfsssp_ctx->adj_list;
+	uint32_t adj_list_size = dfsssp_ctx->adj_list_size;
+	cl_qlist_t mcastgrp_port_list;
+	cl_qmap_t mcastgrp_port_map;
+	osm_switch_t *root_sw = NULL;
+	osm_port_t *port = NULL;
+	ib_net16_t lid = 0;
+	uint32_t err = 0, num_ports = 0;
+	ib_api_status_t status = IB_SUCCESS;
+
+	OSM_LOG_ENTER(sm->p_log);
+
+	/* create a map and a list of all ports which are member in the mcast
+	   group; map for searching elements and list for iteration
+	 */
+	if (osm_mcast_make_port_list_and_map(&mcastgrp_port_list,
+					     &mcastgrp_port_map, mbox)) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR AD50: "
+                        "Insufficient memory to make port list\n");
+                status = IB_ERROR;
+                goto Exit;
+        }
+
+	num_ports = cl_qlist_count(&mcastgrp_port_list);
+	if (num_ports < 2) {
+		OSM_LOG(sm->p_log, OSM_LOG_VERBOSE,
+			"MLID 0x%X has %u members - nothing to do\n",
+			mbox->mlid, num_ports);
+		goto Exit;
+	}
+
+	/* find the root switch for the spanning tree, which has the smallest
+	   hops count to all LIDs in the mcast group
+	 */
+	root_sw = osm_mcast_mgr_find_root_switch(sm, &mcastgrp_port_list);
+	if (!root_sw) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR AD51: "
+			"Unable to locate a suitable switch for group 0x%X\n",
+			mbox->mlid);
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	/* a) start one dijkstra step from the root switch to generate a
+	   spanning tree
+	   b) this might be a bit of an overkill to span the whole
+	   network, if there are only a few ports in the mcast group, but
+	   its only one dijkstra step for each mcast group and we did many
+	   steps before in the ucast routing for each LID in the subnet;
+	   c) we can use the subnet structure from the ucast routing, and
+	   don't even have to reset the link weights (=> therefore the mcast
+	   spanning tree will use less 'growded' links in the network)
+	   d) the mcast dfsssp algorithm will not change the link weights
+	 */
+	lid = osm_node_get_base_lid(root_sw->p_node, 0);
+	port = osm_get_port_by_lid(sm->p_subn, lid);
+	err = dijkstra(p_mgr, adj_list, adj_list_size, port, lid);
+	if (err) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR AD52: "
+			"Dijkstra step for mcast failed for group 0x%X\n",
+			mbox->mlid);
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	/* set mcast group membership again for update_mcft
+	   (unfortunately: osm_mcast_mgr_find_root_switch resets it)
+	 */
+	update_mgrp_membership(&mcastgrp_port_list);
+
+	/* update the mcast forwarding tables of the switches */
+	err = update_mcft(sm, adj_list, adj_list_size, mbox->mlid,
+			  &mcastgrp_port_map, root_sw);
+	if (err) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR AD53: "
+			"Update of mcast forwarding tables failed for group 0x%X\n",
+			mbox->mlid);
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+Exit:
+	reset_mgrp_membership(adj_list, adj_list_size);
+	osm_mcast_drop_port_list(&mcastgrp_port_list);
+	OSM_LOG_EXIT(sm->p_log);
+	return status;
 }
 
 /* called from extern in QP creation process to gain the the service level and
@@ -2064,14 +2602,18 @@ static uint8_t get_dfsssp_sl(void *context, uint8_t hint_for_default_sl,
 			     const ib_net16_t slid, const ib_net16_t dlid)
 {
 	dfsssp_context_t *dfsssp_ctx = (dfsssp_context_t *) context;
-	osm_ucast_mgr_t *p_mgr = (osm_ucast_mgr_t *) dfsssp_ctx->p_mgr;
 	osm_port_t *src_port, *dest_port;
 	vltable_t *srcdest2vl_table = NULL;
+	uint8_t *vl_split_count = NULL;
+	osm_ucast_mgr_t *p_mgr = NULL;
 	int32_t res = 0;
 
 	if (dfsssp_ctx
-	    && dfsssp_ctx->routing_type == OSM_ROUTING_ENGINE_TYPE_DFSSSP)
+	    && dfsssp_ctx->routing_type == OSM_ROUTING_ENGINE_TYPE_DFSSSP) {
+		p_mgr = (osm_ucast_mgr_t *) dfsssp_ctx->p_mgr;
 		srcdest2vl_table = (vltable_t *) (dfsssp_ctx->srcdest2vl_table);
+		vl_split_count = (uint8_t *) (dfsssp_ctx->vl_split_count);
+	}
 	else
 		return hint_for_default_sl;
 
@@ -2088,9 +2630,16 @@ static uint8_t get_dfsssp_sl(void *context, uint8_t hint_for_default_sl,
 
 	res = vltable_get_vl(srcdest2vl_table, slid, dlid);
 
-	if (res > -1)
-		return (uint8_t) res;
-	else
+	/* we will randomly distribute the traffic over multiple VLs if
+	   necessary for good balancing; therefore vl_split_count provides
+	   the number of VLs to use for certain traffic
+	 */
+	if (res > -1) {
+		if (vl_split_count[res] > 1)
+			return (uint8_t) (res + rand()%(vl_split_count[res]));
+		else
+			return (uint8_t) res;
+	} else
 		return hint_for_default_sl;
 }
 
@@ -2107,7 +2656,9 @@ static dfsssp_context_t *dfsssp_context_create(osm_opensm_t * p_osm,
 		dfsssp_ctx->routing_type = routing_type;
 		dfsssp_ctx->p_mgr = (osm_ucast_mgr_t *) & (p_osm->sm.ucast_mgr);
 		dfsssp_ctx->adj_list = NULL;
+		dfsssp_ctx->adj_list_size = 0;
 		dfsssp_ctx->srcdest2vl_table = NULL;
+		dfsssp_ctx->vl_split_count = NULL;
 	} else {
 		OSM_LOG(p_osm->sm.ucast_mgr.p_log, OSM_LOG_ERROR,
 			"ERR AD04: cannot allocate memory for dfsssp_ctx in dfsssp_context_create\n");
@@ -2135,12 +2686,19 @@ static void dfsssp_context_destroy(void *context)
 	}
 	free(adj_list);
 	dfsssp_ctx->adj_list = NULL;
+	dfsssp_ctx->adj_list_size = 0;
 
-	/* free srcdest2vl table (can be done because, dfsssp_context_destroy is called after osm_get_dfsssp_sl) */
+	/* free srcdest2vl table and the split count information table
+	   (can be done, because dfsssp_context_destroy is called after
+	    osm_get_dfsssp_sl)
+	 */
 	vltable_dealloc(&(dfsssp_ctx->srcdest2vl_table));
 	dfsssp_ctx->srcdest2vl_table = NULL;
 
-	free(context);
+	if (dfsssp_ctx->vl_split_count) {
+		free(dfsssp_ctx->vl_split_count);
+		dfsssp_ctx->vl_split_count = NULL;
+	}
 }
 
 static void delete(void *context)
@@ -2148,11 +2706,13 @@ static void delete(void *context)
 	if (!context)
 		return;
 	dfsssp_context_destroy(context);
+
+	free(context);
 }
 
 int osm_ucast_dfsssp_setup(struct osm_routing_engine *r, osm_opensm_t * p_osm)
 {
-	/* create context container and add ucast managment object */
+	/* create context container and add ucast management object */
 	dfsssp_context_t *dfsssp_context =
 	    dfsssp_context_create(p_osm, OSM_ROUTING_ENGINE_TYPE_DFSSSP);
 	if (!dfsssp_context) {
@@ -2163,15 +2723,21 @@ int osm_ucast_dfsssp_setup(struct osm_routing_engine *r, osm_opensm_t * p_osm)
 	r->context = (void *)dfsssp_context;
 	r->build_lid_matrices = dfsssp_build_graph;
 	r->ucast_build_fwd_tables = dfsssp_do_dijkstra_routing;
+	r->mcast_build_stree = dfsssp_do_mcast_routing;
 	r->path_sl = get_dfsssp_sl;
 	r->destroy = delete;
 
+	/* we initialize with the current time to achieve a 'good' randomized
+	   assignment in get_dfsssp_sl(...)
+	 */
+	srand(time(NULL));
+
 	return 0;
 }
 
 int osm_ucast_sssp_setup(struct osm_routing_engine *r, osm_opensm_t * p_osm)
 {
-	/* create context container and add ucast managment object */
+	/* create context container and add ucast management object */
 	dfsssp_context_t *dfsssp_context =
 	    dfsssp_context_create(p_osm, OSM_ROUTING_ENGINE_TYPE_SSSP);
 	if (!dfsssp_context) {
@@ -2182,6 +2748,7 @@ int osm_ucast_sssp_setup(struct osm_routing_engine *r, osm_opensm_t * p_osm)
 	r->context = (void *)dfsssp_context;
 	r->build_lid_matrices = dfsssp_build_graph;
 	r->ucast_build_fwd_tables = dfsssp_do_dijkstra_routing;
+	r->mcast_build_stree = dfsssp_do_mcast_routing;
 	r->destroy = delete;
 
 	return 0;
diff --git a/opensm/osm_ucast_file.c b/opensm/osm_ucast_file.c
index 6eeb144..730ce80 100644
--- a/opensm/osm_ucast_file.c
+++ b/opensm/osm_ucast_file.c
@@ -216,6 +216,17 @@ static int do_ucast_file_load(void *context)
 					file_name, lineno, p);
 				goto Exit;
 			}
+			if (port_num >=
+				osm_node_get_num_physp(p_sw->p_node)) {
+					OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
+						"Invalid port %d found "
+						"for switch %016" PRIx64 "\n",
+						port_num,
+						cl_ntoh64(osm_node_get_node_guid
+							(p_sw->p_node)));
+					goto Exit;
+			}
+
 			p = q;
 			/* additionally try to extract guid */
 			q = strstr(p, " portguid 0x");
diff --git a/opensm/osm_ucast_ftree.c b/opensm/osm_ucast_ftree.c
index 532a29f..ee37e79 100644
--- a/opensm/osm_ucast_ftree.c
+++ b/opensm/osm_ucast_ftree.c
@@ -277,7 +277,7 @@ static inline boolean_t tuple_assigned(IN ftree_tuple_t tuple)
 
 #define FTREE_TUPLE_BUFFERS_NUM 6
 
-static char *tuple_to_str(IN ftree_tuple_t tuple)
+static const char *tuple_to_str(IN ftree_tuple_t tuple)
 {
 	static char buffer[FTREE_TUPLE_BUFFERS_NUM][FTREE_TUPLE_BUFF_LEN];
 	static uint8_t ind = 0;
@@ -341,8 +341,6 @@ static ftree_sw_tbl_element_t *sw_tbl_element_create(IN ftree_sw_t * p_sw)
 
 static void sw_tbl_element_destroy(IN ftree_sw_tbl_element_t * p_element)
 {
-	if (!p_element)
-		return;
 	free(p_element);
 }
 
@@ -370,8 +368,7 @@ static ftree_port_t *port_create(IN uint8_t port_num,
 
 static void port_destroy(IN ftree_port_t * p_port)
 {
-	if (p_port)
-		free(p_port);
+	free(p_port);
 }
 
 /***************************************************
@@ -456,10 +453,10 @@ static void port_group_destroy(IN ftree_port_group_t * p_group)
 
 	/* remove all the elements of p_group->ports vector */
 	size = cl_ptr_vector_get_size(&p_group->ports);
-	for (i = 0; i < size; i++) {
-		cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port);
-		port_destroy(p_port);
-	}
+	for (i = 0; i < size; i++)
+		if (cl_ptr_vector_at(&p_group->ports, i, (void *)&p_port) == CL_SUCCESS)
+			port_destroy(p_port);
+
 	cl_ptr_vector_destroy(&p_group->ports);
 	free(p_group);
 }				/* port_group_destroy() */
@@ -559,18 +556,21 @@ static ftree_sw_t *sw_create(IN ftree_fabric_t * p_ftree,
 					   sizeof(ftree_port_group_t *));
 	if (p_sw->down_port_groups == NULL)
 		goto FREE_P_SW;
+	memset(p_sw->down_port_groups, 0, ports_num * sizeof(ftree_port_group_t *));
 
 	p_sw->up_port_groups =
 	    (ftree_port_group_t **) malloc(ports_num *
 					   sizeof(ftree_port_group_t *));
 	if (p_sw->up_port_groups == NULL)
 		goto FREE_DOWN;
+	memset(p_sw->up_port_groups, 0, ports_num * sizeof(ftree_port_group_t *));
 
 	p_sw->sibling_port_groups =
 	    (ftree_port_group_t **) malloc(ports_num *
 					   sizeof(ftree_port_group_t *));
 	if (p_sw->sibling_port_groups == NULL)
 		goto FREE_UP;
+	memset(p_sw->sibling_port_groups, 0, ports_num * sizeof(ftree_port_group_t *));
 
 	/* initialize lft buffer */
 	memset(p_osm_sw->new_lft, OSM_NO_PATH, p_osm_sw->lft_size);
@@ -609,12 +609,9 @@ static void sw_destroy(IN ftree_fabric_t * p_ftree, IN ftree_sw_t * p_sw)
 		port_group_destroy(p_sw->sibling_port_groups[i]);
 	for (i = 0; i < p_sw->up_port_groups_num; i++)
 		port_group_destroy(p_sw->up_port_groups[i]);
-	if (p_sw->down_port_groups)
-		free(p_sw->down_port_groups);
-	if (p_sw->sibling_port_groups)
-		free(p_sw->sibling_port_groups);
-	if (p_sw->up_port_groups)
-		free(p_sw->up_port_groups);
+	free(p_sw->down_port_groups);
+	free(p_sw->sibling_port_groups);
+	free(p_sw->up_port_groups);
 
 	free(p_sw);
 }				/* sw_destroy() */
@@ -813,6 +810,8 @@ static ftree_hca_t *hca_create(IN osm_node_t * p_osm_node)
 		free(p_hca);
 		return NULL;
 	}
+	memset(p_hca->up_port_groups, 0, osm_node_get_num_physp(p_hca->p_osm_node) *
+	       sizeof(ftree_port_group_t *));
 	p_hca->up_port_groups_num = 0;
 	return p_hca;
 }
@@ -829,8 +828,7 @@ static void hca_destroy(IN ftree_hca_t * p_hca)
 	for (i = 0; i < p_hca->up_port_groups_num; i++)
 		port_group_destroy(p_hca->up_port_groups[i]);
 
-	if (p_hca->up_port_groups)
-		free(p_hca->up_port_groups);
+	free(p_hca->up_port_groups);
 
 	free(p_hca);
 }
@@ -888,9 +886,24 @@ static ftree_port_group_t *hca_get_port_group_by_remote_lid(IN ftree_hca_t *
 	return NULL;
 }
 
+static ftree_port_group_t *hca_get_port_group_by_lid(IN ftree_hca_t *
+						     p_hca,
+						     IN uint16_t
+						     base_lid)
+{
+	uint32_t i;
+	for (i = 0; i < p_hca->up_port_groups_num; i++)
+		if (base_lid ==
+		    p_hca->up_port_groups[i]->base_lid)
+			return p_hca->up_port_groups[i];
+
+	return NULL;
+
+}
 /***************************************************/
 
-static void hca_add_port(IN ftree_hca_t * p_hca, IN uint8_t port_num,
+static void hca_add_port(IN ftree_fabric_t * p_ftree,
+			 IN ftree_hca_t * p_hca, IN uint8_t port_num,
 			 IN uint8_t remote_port_num, IN uint16_t base_lid,
 			 IN uint16_t remote_base_lid, IN ib_net64_t port_guid,
 			 IN ib_net64_t remote_port_guid,
@@ -905,7 +918,7 @@ static void hca_add_port(IN ftree_hca_t * p_hca, IN uint8_t port_num,
 	   in hca's that lead to switches */
 	CL_ASSERT(remote_node_type == IB_NODE_TYPE_SWITCH);
 
-	p_group = hca_get_port_group_by_remote_lid(p_hca, remote_base_lid);
+	p_group = hca_get_port_group_by_lid(p_hca, base_lid);
 
 	if (!p_group) {
 		p_group = port_group_create(base_lid, remote_base_lid,
@@ -916,9 +929,11 @@ static void hca_add_port(IN ftree_hca_t * p_hca, IN uint8_t port_num,
 					    p_remote_hca_or_sw, is_cn, is_io);
 		CL_ASSERT(p_group);
 		p_hca->up_port_groups[p_hca->up_port_groups_num++] = p_group;
-	}
-	port_group_add_port(p_group, port_num, remote_port_num);
-
+		port_group_add_port(p_group, port_num, remote_port_num);
+	} else
+		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR,
+			"ERR AB32: Duplicated LID for CA GUID: 0x%016" PRIx64 "\n",
+			cl_ntoh64(port_guid));
 }				/* hca_add_port() */
 
 /***************************************************
@@ -1271,7 +1286,7 @@ static void fabric_dump_hca_ordering(IN ftree_fabric_t * p_ftree)
 
 	char path[1024];
 	FILE *p_hca_ordering_file;
-	char *filename = "opensm-ftree-ca-order.dump";
+	const char *filename = "opensm-ftree-ca-order.dump";
 
 	snprintf(path, sizeof(path), "%s/%s",
 		 p_ftree->p_osm->subn.opt.dump_files_dir, filename);
@@ -1674,12 +1689,19 @@ static int fabric_create_leaf_switch_array(IN ftree_fabric_t * p_ftree)
 			last_leaf_idx = i;
 		}
 	}
-	CL_ASSERT(first_leaf_idx < last_leaf_idx);
 
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 		"Full leaf array info: first_leaf_idx = %u, last_leaf_idx = %u\n",
 		first_leaf_idx, last_leaf_idx);
 
+	if (first_leaf_idx >= last_leaf_idx) {
+		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_INFO, FILE_ID,
+			   "Faild to find leaf switches - topology is not "
+			   "fat-tree\n");
+		res = -1;
+		goto Exit;
+	}
+
 	/* Create array of REAL leaf switches, sorted by index.
 	   This array may contain switches at the same rank w/o CNs,
 	   in case this is the order of indexing. */
@@ -1689,7 +1711,6 @@ static int fabric_create_leaf_switch_array(IN ftree_fabric_t * p_ftree)
 	if (!p_ftree->leaf_switches) {
 		osm_log_v2(&p_ftree->p_osm->log, OSM_LOG_SYS, FILE_ID,
 			   "Fat-tree routing: Memory allocation failed\n");
-		free(all_switches_at_leaf_level);
 		res = -1;
 		goto Exit;
 	}
@@ -1703,8 +1724,7 @@ static int fabric_create_leaf_switch_array(IN ftree_fabric_t * p_ftree)
 		p_ftree->leaf_switches_num);
 
 Exit:
-	if (all_switches_at_leaf_level)
-		free(all_switches_at_leaf_level);
+	free(all_switches_at_leaf_level);
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
 }				/* fabric_create_leaf_switch_array() */
@@ -1766,11 +1786,11 @@ static boolean_t fabric_validate_topology(IN ftree_fabric_t * p_ftree)
 		p_sw = p_next_sw;
 		p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);
 
-		if (!reference_sw_arr[p_sw->rank]) {
+		if (!reference_sw_arr[p_sw->rank])
 			/* This is the first switch in the current level that
 			   we're checking - use it as a reference */
 			reference_sw_arr[p_sw->rank] = p_sw;
-		} else {
+		else {
 			/* compare this switch properties to the reference switch */
 
 			if (reference_sw_arr[p_sw->rank]->up_port_groups_num !=
@@ -1969,7 +1989,7 @@ static inline uint32_t find_lowest_loaded_group_on_sw(ftree_sw_t * p_sw)
  * When both port groups are equally loaded, it picks the one whom
  * remote switch down ports are least loaded.
  * This way, it prefers the switch from where it will be easier to go down (creating upward routes).
- * If both are equal, it picks the bigger GUID to be deterministic.
+ * If both are equal, it picks the lowest INDEX to be deterministic.
  */
 static inline int port_group_compare_load_down(const ftree_port_group_t * p1,
 					       const ftree_port_group_t * p2)
@@ -1990,12 +2010,21 @@ static inline int port_group_compare_load_down(const ftree_port_group_t * p1,
 		if (temp > 0)
 			return 1;
 	} while (0);
-	/* If they are both equal, choose the biggest GUID */
-	if (p1->remote_port_guid > p2->remote_port_guid)
-		return 1;
-
-	return -1;
+	/* If they are both equal, choose the lowest index */
+	return compare_port_groups_by_remote_switch_index(&p1, &p2);
+}
 
+static inline int port_group_compare_load_up(const ftree_port_group_t * p1,
+                                             const ftree_port_group_t * p2)
+{
+        int temp = p1->counter_up - p2->counter_up;
+        if (temp > 0)
+                return 1;
+        if (temp < 0)
+                return -1;
+
+        /* If they are both equal, choose the lowest index */
+        return compare_port_groups_by_remote_switch_index (&p1,&p2);
 }
 
 /*
@@ -2031,8 +2060,8 @@ bubble_sort_up(ftree_port_group_t ** p_group_array, uint32_t nmemb)
 		/* Comparing elements j and j-1 */
 		for (j = 1; j < (nmemb - i); j++) {
 			/* If they are the wrong way around */
-			if (p_group_array[j]->counter_up <
-			    p_group_array[j - 1]->counter_up) {
+			if (port_group_compare_load_up(p_group_array[j],
+						       p_group_array[j - 1]) < 0) {
 				/* We invert them */
 				tmp = p_group_array[j - 1];
 				p_group_array[j - 1] = p_group_array[j];
@@ -2063,13 +2092,12 @@ bubble_sort_siblings(ftree_port_group_t ** p_group_array, uint32_t nmemb)
 		/* Comparing elements j and j-1 */
 		for (j = 1; j < (nmemb - i); j++) {
 			/* If they are the wrong way around */
-			if (p_group_array[j]->counter_up <
-			    p_group_array[j - 1]->counter_up) {
+			if (port_group_compare_load_up(p_group_array[j],
+						       p_group_array[j - 1]) < 0) {
 				/* We invert them */
 				tmp = p_group_array[j - 1];
 				p_group_array[j - 1] = p_group_array[j];
 				p_group_array[j] = tmp;
-
 			}
 		}
 	}
@@ -2137,7 +2165,6 @@ fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
 				   IN ftree_sw_t * p_sw,
 				   IN ftree_sw_t * p_prev_sw,
 				   IN uint16_t target_lid,
-				   IN boolean_t is_real_lid,
 				   IN boolean_t is_main_path,
 				   IN boolean_t is_target_a_sw,
 				   IN uint8_t current_hops)
@@ -2153,9 +2180,6 @@ fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
 	boolean_t routed = 0;
 	uint8_t least_hops;
 
-	/* we shouldn't enter here if both real_lid and main_path are false */
-	CL_ASSERT(is_real_lid || is_main_path);
-
 	/* if there is no down-going ports */
 	if (p_sw->down_port_groups_num == 0)
 		return FALSE;
@@ -2170,7 +2194,7 @@ fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
 	for (k = 0;
 	     k <
 	     (p_sw->down_port_groups_num +
-	      (is_real_lid ? p_sw->sibling_port_groups_num : 0)); k++) {
+	      ((target_lid != 0) ? p_sw->sibling_port_groups_num : 0)); k++) {
 
 		if (k < p_sw->down_port_groups_num) {
 			p_group = p_sw->down_port_groups[k];
@@ -2200,6 +2224,8 @@ fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
 		/* find the least loaded port of the group (in indexing order) */
 		p_min_port = NULL;
 		ports_num = (uint16_t) cl_ptr_vector_get_size(&p_group->ports);
+		if(ports_num == 0)
+			continue;
 
 		for (j = 0; j < ports_num; j++) {
 			cl_ptr_vector_at(&p_group->ports, j, (void *)&p_port);
@@ -2234,13 +2260,13 @@ fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
 
 		/* Four possible cases:
 		 *
-		 *  1. is_real_lid == TRUE && is_main_path == TRUE:
+		 *  1. is_main_path == TRUE:
 		 *      - going DOWN(TRUE,TRUE) through ALL the groups
 		 *         + promoting port counter
 		 *         + setting path in remote switch fwd tbl
 		 *         + setting hops in remote switch on all the ports of each group
 		 *
-		 *  2. is_real_lid == TRUE && is_main_path == FALSE:
+		 *  2. is_main_path == FALSE:
 		 *      - going DOWN(TRUE,FALSE) through ALL the groups but only if
 		 *        the remote (lower) switch hasn't been already configured
 		 *        for this target LID (or with a longer path)
@@ -2248,39 +2274,27 @@ fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
 		 *         + setting path in remote switch fwd tbl if it hasn't been set yet
 		 *         + setting hops in remote switch on all the ports of each group
 		 *           if it hasn't been set yet
-		 *
-		 *  3. is_real_lid == FALSE && is_main_path == TRUE:
-		 *      - going DOWN(FALSE,TRUE) through ALL the groups
-		 *         + promoting port counter
-		 *         + NOT setting path in remote switch fwd tbl
-		 *         + NOT setting hops in remote switch
-		 *
-		 *  4. is_real_lid == FALSE && is_main_path == FALSE:
-		 *      - illegal state - we shouldn't get here
 		 */
 
-		/* setting fwd tbl port only if this is real LID */
-		if (is_real_lid) {
-			p_remote_sw->p_osm_sw->new_lft[target_lid] =
+		/* setting fwd tbl port only */
+		p_remote_sw->p_osm_sw->new_lft[target_lid] =
 			    p_min_port->remote_port_num;
-			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				"Switch %s: set path to CA LID %u through port %u\n",
 				tuple_to_str(p_remote_sw->tuple),
 				target_lid, p_min_port->remote_port_num);
 
-			/* On the remote switch that is pointed by the p_group,
-			   set hops for ALL the ports in the remote group. */
+		/* On the remote switch that is pointed by the p_group,
+			set hops for ALL the ports in the remote group. */
 
-			set_hops_on_remote_sw(p_group, target_lid,
-					      current_hops + 1, is_target_a_sw);
-		}
+		set_hops_on_remote_sw(p_group, target_lid,
+				      current_hops + 1, is_target_a_sw);
 
 		/* Recursion step:
 		   Assign upgoing ports by stepping down, starting on REMOTE switch */
 		routed = fabric_route_upgoing_by_going_down(p_ftree, p_remote_sw,	/* remote switch - used as a route-upgoing alg. start point */
 							    NULL,	/* prev. position - NULL to mark that we went down and not up */
 							    target_lid,	/* LID that we're routing to */
-							    is_real_lid,	/* whether the target LID is real or dummy */
 							    is_main_path,	/* whether this is path to HCA that should by tracked by counters */
 							    is_target_a_sw,	/* Whether target lid is a switch or not */
 							    current_hops + 1);	/* Number of hops done to this point */
@@ -2322,7 +2336,6 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 				   IN ftree_sw_t * p_sw,
 				   IN ftree_sw_t * p_prev_sw,
 				   IN uint16_t target_lid,
-				   IN boolean_t is_real_lid,
 				   IN boolean_t is_main_path,
 				   IN boolean_t is_target_a_sw,
 				   IN uint16_t reverse_hop_credit,
@@ -2340,14 +2353,11 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 	boolean_t created_route = FALSE;
 	boolean_t routed = FALSE;
 
-	/* we shouldn't enter here if both real_lid and main_path are false */
-	CL_ASSERT(is_real_lid || is_main_path);
 
 	/* Assign upgoing ports by stepping down, starting on THIS switch */
 	created_route = fabric_route_upgoing_by_going_down(p_ftree, p_sw,	/* local switch - used as a route-upgoing alg. start point */
 							   p_prev_sw,	/* switch that we went up from (NULL means that we went down) */
 							   target_lid,	/* LID that we're routing to */
-							   is_real_lid,	/* whether this target LID is real or dummy */
 							   is_main_path,	/* whether this path to HCA should by tracked by counters */
 							   is_target_a_sw,	/* Whether target lid is a switch or not */
 							   current_hops);	/* Number of hops done up to this point */
@@ -2375,7 +2385,6 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 				created_route |= fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
 										    p_sw,	/* this switch - prev. position switch for the function */
 										    target_lid,	/* LID that we're routing to */
-										    is_real_lid,	/* whether this target LID is real or dummy */
 										    is_main_path,	/* whether this is path to HCA that should by tracked by counters */
 										    is_target_a_sw,	/* Whether target lid is a switch or not */
 										    reverse_hop_credit - 1,	/* Remaining reverse_hops allowed */
@@ -2417,7 +2426,7 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 
 	/* Four possible cases:
 	 *
-	 *  1. is_real_lid == TRUE && is_main_path == TRUE:
+	 *  1. is_main_path == TRUE:
 	 *      - going UP(TRUE,TRUE) on selected min_group and min_port
 	 *         + promoting port counter
 	 *         + setting path in remote switch fwd tbl
@@ -2428,7 +2437,7 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 	 *         + setting hops in remote switch on all the ports of each group
 	 *           if it hasn't been set yet
 	 *
-	 *  2. is_real_lid == TRUE && is_main_path == FALSE:
+	 *  2. is_main_path == FALSE:
 	 *      - going UP(TRUE,FALSE) on ALL the groups, each time on port 0,
 	 *        but only if the remote (upper) switch hasn't been already
 	 *        configured for this target LID
@@ -2436,15 +2445,6 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 	 *         + setting path in remote switch fwd tbl if it hasn't been set yet
 	 *         + setting hops in remote switch on all the ports of each group
 	 *           if it hasn't been set yet
-	 *
-	 *  3. is_real_lid == FALSE && is_main_path == TRUE:
-	 *      - going UP(FALSE,TRUE) ONLY on selected min_group and min_port
-	 *         + promoting port counter
-	 *         + NOT setting path in remote switch fwd tbl
-	 *         + NOT setting hops in remote switch
-	 *
-	 *  4. is_real_lid == FALSE && is_main_path == FALSE:
-	 *      - illegal state - we shouldn't get here
 	 */
 
 	/* covering first half of case 1, and case 3 */
@@ -2452,7 +2452,7 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 		if (p_sw->is_leaf) {
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				" - Routing MAIN path for %s CA LID %u: %s --> %s\n",
-				(is_real_lid) ? "real" : "DUMMY",
+				(target_lid != 0) ? "real" : "DUMMY",
 				target_lid,
 				tuple_to_str(p_sw->tuple),
 				tuple_to_str(p_remote_sw->tuple));
@@ -2470,58 +2470,47 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 			    (p_min_group->remote_hca_or_sw.p_sw);
 		}
 
-		if (is_real_lid) {
-			/* This LID may already be in the LFT in the reverse_hop feature is used */
-			/* We update the LFT only if this LID isn't already present. */
+		/* This LID may already be in the LFT in the reverse_hop feature is used */
+		/* We update the LFT only if this LID isn't already present. */
 
-			/* skip if target lid has been already set on remote switch fwd tbl (with a bigger hop count) */
-			if ((p_remote_sw->p_osm_sw->new_lft[target_lid] ==
-			     OSM_NO_PATH)
-			    ||
-			    ((p_remote_sw->p_osm_sw->new_lft[target_lid] !=
-			      OSM_NO_PATH)
+		/* skip if target lid has been already set on remote switch fwd tbl (with a bigger hop count) */
+		if ((p_remote_sw->p_osm_sw->new_lft[target_lid] == OSM_NO_PATH)
+		    ||
+		    ((p_remote_sw->p_osm_sw->new_lft[target_lid] != OSM_NO_PATH)
 			     &&
-			     (current_hops + 1 <
-			      sw_get_least_hops(p_remote_sw, target_lid)))) {
+		      (current_hops + 1 <
+		       sw_get_least_hops(p_remote_sw, target_lid)))) {
 
-				p_remote_sw->p_osm_sw->new_lft[target_lid] =
-				    p_min_port->remote_port_num;
-				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+			p_remote_sw->p_osm_sw->new_lft[target_lid] =
+				p_min_port->remote_port_num;
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 					"Switch %s: set path to CA LID %u through port %u\n",
 					tuple_to_str(p_remote_sw->tuple),
 					target_lid,
 					p_min_port->remote_port_num);
 
-				/* On the remote switch that is pointed by the min_group,
-				   set hops for ALL the ports in the remote group. */
+			/* On the remote switch that is pointed by the min_group,
+			set hops for ALL the ports in the remote group. */
 
-				set_hops_on_remote_sw(p_min_group, target_lid,
+			set_hops_on_remote_sw(p_min_group, target_lid,
 						      current_hops + 1,
 						      is_target_a_sw);
-
-				/* Recursion step:
-				   Assign downgoing ports by stepping up, starting on REMOTE switch. */
-				created_route |= fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
-										    p_sw,	/* this switch - prev. position switch for the function */
-										    target_lid,	/* LID that we're routing to */
-										    is_real_lid,	/* whether this target LID is real or dummy */
-										    is_main_path,	/* whether this is path to HCA that should by tracked by counters */
-										    is_target_a_sw,	/* Whether target lid is a switch or not */
-										    reverse_hop_credit,	/* Remaining reverse_hops allowed */
-										    reverse_hops,	/* Number of reverse_hops done up to this point */
-										    current_hops
-										    +
-										    1);
-			}
 		}
+	/* Recursion step: Assign downgoing ports by stepping up, starting on REMOTE switch. */
+	created_route |= fabric_route_downgoing_by_going_up(p_ftree,
+							    p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
+							    p_sw,		/* this switch - prev. position switch for the function */
+							    target_lid,		/* LID that we're routing to */
+							    is_main_path,	/* whether this is path to HCA that should by tracked by counters */
+							    is_target_a_sw,	/* Whether target lid is a switch or not */
+							    reverse_hop_credit,	/* Remaining reverse_hops allowed */
+							    reverse_hops,	/* Number of reverse_hops done up to this point */
+							    current_hops + 1);
 	}
-	/* we're done for the third case */
-	if (!is_real_lid)
-		return created_route;
 
 	/* What's left to do at this point:
 	 *
-	 *  1. is_real_lid == TRUE && is_main_path == TRUE:
+	 *  1. is_main_path == TRUE:
 	 *      - going UP(TRUE,FALSE) on rest of the groups, each time on port 0,
 	 *        but only if the remote (upper) switch hasn't been already
 	 *        configured for this target LID
@@ -2530,7 +2519,7 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 	 *         + setting hops in remote switch on all the ports of each group
 	 *           if it hasn't been set yet
 	 *
-	 *  2. is_real_lid == TRUE && is_main_path == FALSE:
+	 *  2. is_main_path == FALSE:
 	 *      - going UP(TRUE,FALSE) on ALL the groups, each time on port 0,
 	 *        but only if the remote (upper) switch hasn't been already
 	 *        configured for this target LID
@@ -2576,6 +2565,8 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 		   trying to balance these routes - always pick port 0. */
 		p_min_port = NULL;
 		ports_num = (uint16_t) cl_ptr_vector_get_size(&p_group->ports);
+		if(ports_num == 0)
+			continue;
 		for (j = 0; j < ports_num; j++) {
 			cl_ptr_vector_at(&p_group->ports, j, (void *)&p_port);
 			if (!p_min_port) {
@@ -2604,7 +2595,6 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 		routed = fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
 							    p_sw,	/* this switch - prev. position switch for the function */
 							    target_lid,	/* LID that we're routing to */
-							    TRUE,	/* whether the target LID is real or dummy */
 							    FALSE,	/* whether this is path to HCA that should by tracked by counters */
 							    is_target_a_sw,	/* Whether target lid is a switch or not */
 							    reverse_hop_credit,	/* Remaining reverse_hops allowed */
@@ -2672,7 +2662,6 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 		routed = fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
 							    p_sw,	/* this switch - prev. position switch for the function */
 							    target_lid,	/* LID that we're routing to */
-							    TRUE,	/* whether the target LID is real or dummy */
 							    FALSE,	/* whether this is path to HCA that should by tracked by counters */
 							    is_target_a_sw,	/* Whether target lid is a switch or not */
 							    reverse_hop_credit,	/* Remaining reverse_hops allowed */
@@ -2709,7 +2698,6 @@ fabric_route_downgoing_by_going_up(IN ftree_fabric_t * p_ftree,
 		created_route |= fabric_route_downgoing_by_going_up(p_ftree, p_remote_sw,	/* remote switch - used as a route-downgoing alg. next step point */
 								    p_sw,	/* this switch - prev. position switch for the function */
 								    target_lid,	/* LID that we're routing to */
-								    TRUE,	/* whether the target LID is real or dummy */
 								    TRUE,	/* whether this is path to HCA that should by tracked by counters */
 								    is_target_a_sw,	/* Whether target lid is a switch or not */
 								    reverse_hop_credit - 1,	/* Remaining reverse_hops allowed */
@@ -2799,7 +2787,6 @@ static void fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
 			fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
 							   NULL,	/* prev. position switch */
 							   hca_lid,	/* LID that we're routing to */
-							   TRUE,	/* whether this HCA LID is real or dummy */
 							   TRUE,	/* whether this path to HCA should by tracked by counters */
 							   FALSE,	/* whether target lid is a switch or not */
 							   0,	/* Number of reverse hops allowed */
@@ -2821,16 +2808,26 @@ static void fabric_route_to_cns(IN ftree_fabric_t * p_ftree)
 			for (j = 0; j <
 			     p_ftree->max_cn_per_leaf - routed_targets_on_leaf;
 			     j++) {
+				ftree_sw_t *p_next_sw, *p_ftree_sw;
 				/* assign downgoing ports by stepping up */
 				fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
 								   NULL,	/* prev. position switch */
 								   0,	/* LID that we're routing to - ignored for dummy HCA */
-								   FALSE,	/* whether this HCA LID is real or dummy */
 								   TRUE,	/* whether this path to HCA should by tracked by counters */
 								   FALSE,	/* Whether the target LID is a switch or not */
 								   0,	/* Number of reverse hops allowed */
 								   0,	/* Number of reverse hops done yet */
 								   1);	/* Number of hops done yet */
+
+				p_next_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);
+				/* need to clean the LID 0 hops for dummy node */
+				while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {
+					p_ftree_sw = p_next_sw;
+					p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_ftree_sw->map_item);
+					p_ftree_sw->hops[0] = OSM_NO_PATH;
+					p_ftree_sw->p_osm_sw->new_lft[0] = OSM_NO_PATH;
+				}
+
 			}
 		}
 	}
@@ -2912,7 +2909,6 @@ static void fabric_route_to_non_cns(IN ftree_fabric_t * p_ftree)
 			fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
 							   NULL,	/* prev. position switch */
 							   hca_lid,	/* LID that we're routing to */
-							   TRUE,	/* whether this HCA LID is real or dummy */
 							   TRUE,	/* whether this path to HCA should by tracked by counters */
 							   FALSE,	/* Whether the target LID is a switch or not */
 							   p_hca_port_group->is_io ? p_ftree->p_osm->subn.opt.max_reverse_hops : 0,	/* Number or reverse hops allowed */
@@ -2965,7 +2961,6 @@ static void fabric_route_to_switches(IN ftree_fabric_t * p_ftree)
 		fabric_route_downgoing_by_going_up(p_ftree, p_sw,	/* local switch - used as a route-downgoing alg. start point */
 						   NULL,	/* prev. position switch */
 						   p_sw->base_lid,	/* LID that we're routing to */
-						   TRUE,	/* whether the target LID is a real or dummy */
 						   FALSE,	/* whether this path to HCA should by tracked by counters */
 						   TRUE,	/* Whether the target LID is a switch or not */
 						   0,	/* Number of reverse hops allowed */
@@ -3042,10 +3037,8 @@ static void fabric_route_roots(IN ftree_fabric_t * p_ftree)
 				"through port %u\n",
 				tuple_to_str(p_sw->tuple), lid, port_num);
 
-			if (p_ftree->p_osm->subn.opt.connect_roots) {
-				/* set local lft */
-				p_sw->p_osm_sw->new_lft[lid] = port_num;
-			}
+			/* set local lft */
+			p_sw->p_osm_sw->new_lft[lid] = port_num;
 
 			/*
 			 * Set local min hop table.
@@ -3263,7 +3256,8 @@ static void sw_reverse_rank(IN cl_map_item_t * const p_map_item,
 {
 	ftree_fabric_t *p_ftree = (ftree_fabric_t *) context;
 	ftree_sw_t *p_sw = (ftree_sw_t * const)p_map_item;
-	p_sw->rank = p_ftree->max_switch_rank - p_sw->rank;
+	if (p_sw->rank != 0xFFFFFFFF)
+		p_sw->rank = p_ftree->max_switch_rank - p_sw->rank;
 }
 
 /***************************************************
@@ -3280,8 +3274,11 @@ fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree, IN ftree_hca_t * p_hca)
 	osm_physp_t *p_remote_osm_port;
 	uint8_t i;
 	uint8_t remote_port_num;
-	boolean_t is_cn = FALSE;
+	boolean_t is_cn = TRUE;
+	boolean_t is_in_cn_file = FALSE;
 	boolean_t is_io = FALSE;
+	boolean_t is_cns_file_provided = fabric_cns_provided(p_ftree);
+	boolean_t is_ios_file_provided = fabric_ios_provided(p_ftree);
 	int res = 0;
 
 	for (i = 0; i < osm_node_get_num_physp(p_node); i++) {
@@ -3337,16 +3334,27 @@ fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree, IN ftree_hca_t * p_hca)
 		/* If CN file is not supplied, then all the CAs considered as Compute Nodes.
 		   Otherwise all the CAs are not CNs, and only guids that are present in the
 		   CN file will be marked as compute nodes. */
-		if (!fabric_cns_provided(p_ftree)) {
-			is_cn = TRUE;
-		} else {
+		if (is_cns_file_provided == TRUE) {
 			name_map_item_t *p_elem = (name_map_item_t *)
-			    cl_qmap_get(&p_ftree->cn_guid_tbl,
-					cl_ntoh64(osm_physp_get_port_guid
-						  (p_osm_port)));
+			cl_qmap_get(&p_ftree->cn_guid_tbl,
+				    cl_ntoh64(osm_physp_get_port_guid
+					     (p_osm_port)));
+			if (p_elem == (name_map_item_t *)
+				cl_qmap_end(&p_ftree->cn_guid_tbl))
+				is_cn = FALSE;
+			else
+				is_in_cn_file = TRUE;
+		}
+		if (is_in_cn_file == FALSE && is_ios_file_provided == TRUE) {
+			name_map_item_t *p_elem = (name_map_item_t *)
+			cl_qmap_get(&p_ftree->io_guid_tbl,
+				    cl_ntoh64(osm_physp_get_port_guid
+					     (p_osm_port)));
 			if (p_elem != (name_map_item_t *)
-			    cl_qmap_end(&p_ftree->cn_guid_tbl))
-				is_cn = TRUE;
+				cl_qmap_end(&p_ftree->io_guid_tbl)) {
+				is_io = TRUE;
+				is_cn = FALSE;
+			}
 		}
 
 		if (is_cn) {
@@ -3355,34 +3363,24 @@ fabric_construct_hca_ports(IN ftree_fabric_t * p_ftree, IN ftree_hca_t * p_hca)
 			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 				"Marking CN port GUID 0x%016" PRIx64 "\n",
 				cl_ntoh64(osm_physp_get_port_guid(p_osm_port)));
-		} else {
-			if (fabric_ios_provided(p_ftree)) {
-				name_map_item_t *p_elem = (name_map_item_t *)
-				    cl_qmap_get(&p_ftree->io_guid_tbl,
-						cl_ntoh64
-						(osm_physp_get_port_guid
-						 (p_osm_port)));
-				if (p_elem != (name_map_item_t *)
-				    cl_qmap_end(&p_ftree->io_guid_tbl))
-					is_io = TRUE;
-
+		} else if (is_io) {
 				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 					"Marking I/O port GUID 0x%016" PRIx64
 					"\n",
 					cl_ntoh64(osm_physp_get_port_guid
-						  (p_osm_port)));
+						 (p_osm_port)));
 
-			} else {
+		} else {
 				OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
 					"Marking non-CN port GUID 0x%016" PRIx64
 					"\n",
 					cl_ntoh64(osm_physp_get_port_guid
-						  (p_osm_port)));
-			}
+						 (p_osm_port)));
 		}
 		p_ftree->ca_ports++;
 
-		hca_add_port(p_hca,	/* local ftree_hca object */
+		hca_add_port(p_ftree,
+			     p_hca,	/* local ftree_hca object */
 			     i,	/* local port number */
 			     remote_port_num,	/* remote port number */
 			     cl_ntoh16(osm_node_get_base_lid(p_node, i)),	/* local lid */
@@ -3526,7 +3524,8 @@ struct rank_root_cxt {
 	ftree_fabric_t *fabric;
 	cl_list_t *list;
 };
-
+/***************************************************
+ ***************************************************/
 static int rank_root_sw_by_guid(void *cxt, uint64_t guid, char *p)
 {
 	struct rank_root_cxt *c = cxt;
@@ -3547,53 +3546,66 @@ static int rank_root_sw_by_guid(void *cxt, uint64_t guid, char *p)
 
 	return 0;
 }
-
-static int fabric_rank_from_roots(IN ftree_fabric_t * p_ftree)
+/***************************************************
+ ***************************************************/
+static boolean_t fabric_load_roots(IN ftree_fabric_t * p_ftree,
+				   IN cl_list_t* p_ranking_bfs_list)
 {
 	struct rank_root_cxt context;
+	unsigned num_roots;
+
+	if (p_ranking_bfs_list) {
+		cl_list_init(p_ranking_bfs_list, 10);
+
+		/* Rank all the roots and add them to list */
+		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+			"Fetching root nodes from file %s\n",
+			p_ftree->p_osm->subn.opt.root_guid_file);
+
+		context.fabric = p_ftree;
+		context.list = p_ranking_bfs_list;
+		if (parse_node_map(p_ftree->p_osm->subn.opt.root_guid_file,
+				   rank_root_sw_by_guid, &context)) {
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB2A: "
+				"cannot parse root guids file \'%s\'\n",
+				p_ftree->p_osm->subn.opt.root_guid_file);
+			return FALSE;
+		}
+
+		num_roots = cl_list_count(p_ranking_bfs_list);
+		if (!num_roots) {
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB25: "
+				"No valid roots supplied\n");
+			return FALSE;
+		}
+
+		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
+			"Ranked %u valid root switches\n", num_roots);
+	}
+	return TRUE;
+}
+/***************************************************
+ ***************************************************/
+static int fabric_rank_from_roots(IN ftree_fabric_t * p_ftree,
+				  IN cl_list_t* p_ranking_bfs_list)
+{
 	osm_node_t *p_osm_node;
 	osm_node_t *p_remote_osm_node;
 	osm_physp_t *p_osm_physp;
 	ftree_sw_t *p_sw;
 	ftree_sw_t *p_remote_sw;
-	cl_list_t ranking_bfs_list;
 	int res = 0;
-	unsigned num_roots;
 	unsigned max_rank = 0;
 	unsigned i;
 
 	OSM_LOG_ENTER(&p_ftree->p_osm->log);
-	cl_list_init(&ranking_bfs_list, 10);
 
-	/* Rank all the roots and add them to list */
-	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
-		"Fetching root nodes from file %s\n",
-		p_ftree->p_osm->subn.opt.root_guid_file);
-
-	context.fabric = p_ftree;
-	context.list = &ranking_bfs_list;
-	if (parse_node_map(p_ftree->p_osm->subn.opt.root_guid_file,
-			   rank_root_sw_by_guid, &context)) {
+	if (!p_ranking_bfs_list) {
 		res = -1;
 		goto Exit;
 	}
-
-	num_roots = cl_list_count(&ranking_bfs_list);
-	if (!num_roots) {
-		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_ERROR, "ERR AB25: "
-			"No valid roots supplied\n");
-		res = -1;
-		goto Exit;
-	}
-
-	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
-		"Ranked %u valid root switches\n", num_roots);
-
-	/* Now the list has all the roots.
-	   BFS the subnet and update rank on all the switches. */
-
-	while (!cl_is_list_empty(&ranking_bfs_list)) {
-		p_sw = (ftree_sw_t *) cl_list_remove_head(&ranking_bfs_list);
+	while (!cl_is_list_empty(p_ranking_bfs_list)) {
+		p_sw = (ftree_sw_t *) cl_list_remove_head(p_ranking_bfs_list);
 		p_osm_node = p_sw->p_osm_sw->p_node;
 
 		/* note: skipping port 0 on switches */
@@ -3624,7 +3636,7 @@ static int fabric_rank_from_roots(IN ftree_fabric_t * p_ftree)
 					sw_get_guid_ho(p_remote_sw),
 					p_remote_sw->rank);
 				max_rank = p_remote_sw->rank;
-				cl_list_insert_tail(&ranking_bfs_list,
+				cl_list_insert_tail(p_ranking_bfs_list,
 						    p_remote_sw);
 			}
 		}
@@ -3638,7 +3650,6 @@ static int fabric_rank_from_roots(IN ftree_fabric_t * p_ftree)
 	p_ftree->max_switch_rank = max_rank;
 
 Exit:
-	cl_list_destroy(&ranking_bfs_list);
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
 }				/* fabric_rank_from_roots() */
@@ -3687,18 +3698,49 @@ Exit:
 }				/* fabric_rank_from_hcas() */
 
 /***************************************************
+ * After ranking from HCA's we want to re-rank using
+ * the roots
  ***************************************************/
+static int fabric_rerank_using_root(IN ftree_fabric_t * p_ftree,
+				    IN cl_list_t* p_ranking_bfs_list)
+{
+	ftree_sw_t *p_sw = NULL;
+	ftree_sw_t *p_next_sw;
+	int res;
 
+	OSM_LOG_ENTER(&p_ftree->p_osm->log);
+	cl_list_init(p_ranking_bfs_list, 10);
+
+	p_next_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);
+	while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {
+		p_sw = p_next_sw;
+		p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);
+		if (p_sw->rank == 0)
+			cl_list_insert_tail(p_ranking_bfs_list, p_sw);
+		else
+			p_sw->rank = 0xFFFFFFFF;
+	}
+	res = fabric_rank_from_roots(p_ftree, p_ranking_bfs_list);
+	OSM_LOG_EXIT(&p_ftree->p_osm->log);
+	return res;
+}
+/***************************************************
+ ***************************************************/
 static int fabric_rank(IN ftree_fabric_t * p_ftree)
 {
-	int res = 0;
+	int res = -1;
+	cl_list_t ranking_bfs_list;
 
 	OSM_LOG_ENTER(&p_ftree->p_osm->log);
 
-	if (fabric_roots_provided(p_ftree))
-		res = fabric_rank_from_roots(p_ftree);
-	else
+	if (fabric_roots_provided(p_ftree) &&
+	    fabric_load_roots(p_ftree, &ranking_bfs_list))
+			res = fabric_rank_from_roots(p_ftree, &ranking_bfs_list);
+	else {
 		res = fabric_rank_from_hcas(p_ftree);
+		if (!res)
+			res = fabric_rerank_using_root(p_ftree, &ranking_bfs_list);
+	}
 
 	if (res)
 		goto Exit;
@@ -3707,6 +3749,7 @@ static int fabric_rank(IN ftree_fabric_t * p_ftree)
 		"FatTree max switch rank is %u\n", p_ftree->max_switch_rank);
 
 Exit:
+	cl_list_destroy(&ranking_bfs_list);
 	OSM_LOG_EXIT(&p_ftree->p_osm->log);
 	return res;
 }				/* fabric_rank() */
@@ -3878,7 +3921,92 @@ Exit:
 
 /***************************************************
  ***************************************************/
+/* Get HCA and switch node, check if this node is the
+ * Only switch that this HCA is connected to */
+static boolean_t has_one_remote_switch(IN ftree_fabric_t *p_ftree,
+				       IN ftree_hca_t *p_hca,
+				       IN osm_node_t* p_node)
+{
+	boolean_t found_other_sw = FALSE;
+	osm_physp_t *p_physp, *p_remote_physp;
+	int i = 1;
+	int ports_num;
+
+	ports_num = osm_node_get_num_physp(p_hca->p_osm_node);
+	while (!found_other_sw && (i < ports_num)) {
+		p_physp = osm_node_get_physp_ptr(p_hca->p_osm_node, i);
+		if (p_physp){
+			p_remote_physp = p_physp->p_remote_physp;
+			if (p_remote_physp && (p_remote_physp->p_node!=p_node))
+				/* Found connection to sw that is not p_node */
+				found_other_sw = TRUE;
+		}
+		i++;
+	}
+
+	return (!found_other_sw);
+}
 
+/***************************************************
+ ***************************************************/
+/* Get a Sw and remove all depended HCA's, meaning all
+ * HCA's which this is the only switch they are connected
+ * to	*/
+static int remove_depended_hca(IN ftree_fabric_t *p_ftree, IN ftree_sw_t *p_sw)
+{
+	ftree_hca_t *p_hca;
+	int counter = 0;
+	int port_num;
+	osm_physp_t* physp;
+	osm_node_t* sw_node;
+	uint64_t remote_hca_guid;
+
+	sw_node = p_sw->p_osm_sw->p_node;
+	for (port_num = 0; port_num < sw_node->physp_tbl_size; port_num++) {
+		physp = osm_node_get_physp_ptr(sw_node, port_num);
+		if (physp && physp->p_remote_physp) {
+			if (osm_node_get_type(physp->p_remote_physp->p_node) == IB_NODE_TYPE_CA) {
+				remote_hca_guid =
+				    osm_node_get_node_guid(physp->p_remote_physp->p_node);
+				p_hca = fabric_get_hca_by_guid(p_ftree, remote_hca_guid);
+				if (p_hca && has_one_remote_switch(p_ftree, p_hca, sw_node)) {
+					cl_qmap_remove_item(&p_ftree->hca_tbl, &p_hca->map_item);
+					hca_destroy(p_hca);
+					counter++;
+				}
+			}
+		}
+	}
+	return counter;
+}
+/***************************************************
+ ***************************************************/
+static void fabric_remove_unranked_sw(IN ftree_fabric_t *p_ftree)
+{
+	ftree_sw_t *p_sw = NULL;
+	ftree_sw_t *p_next_sw;
+	int removed_hca;
+	int count = 0;
+
+	p_next_sw = (ftree_sw_t *) cl_qmap_head(&p_ftree->sw_tbl);
+	while (p_next_sw != (ftree_sw_t *) cl_qmap_end(&p_ftree->sw_tbl)) {
+		p_sw = p_next_sw;
+		p_next_sw = (ftree_sw_t *) cl_qmap_next(&p_sw->map_item);
+		if (!sw_ranked(p_sw)) {
+			cl_qmap_remove_item(&p_ftree->sw_tbl,&p_sw->map_item);
+			removed_hca = remove_depended_hca(p_ftree, p_sw);
+			OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
+				"Removing Unranked sw 0x%" PRIx64 " (with %d dependent hca's)\n",
+				sw_get_guid_ho(p_sw),removed_hca);
+			sw_destroy(p_ftree, p_sw);
+			count++;
+		}
+	}
+	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_DEBUG,
+		"Removed %d invalid switches\n", count);
+}
+/***************************************************
+ ***************************************************/
 static int construct_fabric(IN void *context)
 {
 	ftree_fabric_t *p_ftree = context;
@@ -3961,6 +4089,7 @@ static int construct_fabric(IN void *context)
 		status = -1;
 		goto Exit;
 	}
+	fabric_remove_unranked_sw(p_ftree);
 
 	/* For each hca and switch, construct array of ports.
 	   This is done after the whole FatTree data structure is ready,
@@ -4047,6 +4176,9 @@ static int construct_fabric(IN void *context)
 	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
 		"Max LID in switch LFTs: %u\n", p_ftree->lft_max_lid);
 
+	/* Build the full lid matrices needed for multicast routing */
+	osm_ucast_mgr_build_lid_matrices(&p_ftree->p_osm->sm.ucast_mgr);
+
 Exit:
 	if (status != 0) {
 		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
@@ -4095,10 +4227,12 @@ static int do_routing(IN void *context)
 		"Filling switch forwarding tables for switch-to-switch paths\n");
 	fabric_route_to_switches(p_ftree);
 
-	OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
-		"Connecting switches that are unreachable within "
-		"Up/Down rules\n");
-	fabric_route_roots(p_ftree);
+	if (p_ftree->p_osm->subn.opt.connect_roots) {
+		OSM_LOG(&p_ftree->p_osm->log, OSM_LOG_VERBOSE,
+			"Connecting switches that are unreachable within "
+			"Up/Down rules\n");
+		fabric_route_roots(p_ftree);
+	}
 
 	/* for each switch, set its fwd table */
 	cl_qmap_apply_func(&p_ftree->sw_tbl, set_sw_fwd_table, (void *)p_ftree);
diff --git a/opensm/osm_ucast_lash.c b/opensm/osm_ucast_lash.c
index 6de7d31..9575e84 100644
--- a/opensm/osm_ucast_lash.c
+++ b/opensm/osm_ucast_lash.c
@@ -1288,7 +1288,6 @@ static uint8_t get_lash_sl(void *context, uint8_t path_sl_hint,
 	lash_t *p_lash = context;
 	osm_opensm_t *p_osm = p_lash->p_osm;
 
-
 	if (!(p_osm->routing_engine_used &&
 	      p_osm->routing_engine_used->type == OSM_ROUTING_ENGINE_TYPE_LASH))
 		return OSM_DEFAULT_SL;
diff --git a/opensm/osm_ucast_mgr.c b/opensm/osm_ucast_mgr.c
index b4cf0f2..f53e288 100644
--- a/opensm/osm_ucast_mgr.c
+++ b/opensm/osm_ucast_mgr.c
@@ -259,7 +259,7 @@ static void ucast_mgr_process_port(IN osm_ucast_mgr_t * p_mgr,
 					 p_mgr->p_subn->opt.lmc,
 					 p_mgr->is_dor,
 					 p_mgr->p_subn->opt.port_shifting,
-					 p_mgr->p_subn->opt.scatter_ports);
+					 p_port->use_scatter);
 
 	if (port == OSM_NO_PATH) {
 		/* do not try to overwrite the ppro of non existing port ... */
@@ -729,6 +729,7 @@ static int add_guid_to_order_list(void *ctx, uint64_t guid, char *p)
 
 	cl_qlist_insert_tail(&m->port_order_list, &port->list_item);
 	port->flag = 1;
+	port->use_scatter =  (m->p_subn->opt.guid_routing_order_no_scatter == TRUE) ? 0 : m->p_subn->opt.scatter_ports;
 
 	return 0;
 }
@@ -738,9 +739,10 @@ static void add_port_to_order_list(cl_map_item_t * p_map_item, void *ctx)
 	osm_port_t *port = (osm_port_t *) p_map_item;
 	osm_ucast_mgr_t *m = ctx;
 
-	if (!port->flag)
+	if (!port->flag) {
+		port->use_scatter = m->p_subn->opt.scatter_ports;
 		cl_qlist_insert_tail(&m->port_order_list, &port->list_item);
-	else
+	} else
 		port->flag = 0;
 }
 
@@ -799,11 +801,12 @@ static void add_sw_endports_to_order_list(osm_switch_t * sw,
 			port = osm_get_port_by_guid(m->p_subn,
 						    p->p_remote_physp->
 						    port_guid);
-			if (!port)
+			if (!port || port->flag)
 				continue;
 			cl_qlist_insert_tail(&m->port_order_list,
 					     &port->list_item);
 			port->flag = 1;
+			port->use_scatter = m->p_subn->opt.scatter_ports;
 		}
 	}
 }
@@ -864,8 +867,8 @@ static int ucast_mgr_build_lfts(osm_ucast_mgr_t * p_mgr)
 			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A0D: "
 				"cannot parse guid routing order file \'%s\'\n",
 				p_mgr->p_subn->opt.guid_routing_order_file);
-	} else
-		sort_ports_by_switch_load(p_mgr);
+	}
+	sort_ports_by_switch_load(p_mgr);
 
 	if (p_mgr->p_subn->opt.port_prof_ignore_file) {
 		cl_qmap_apply_func(&p_mgr->p_subn->sw_guid_tbl,
@@ -895,6 +898,7 @@ static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item,
 	osm_ucast_mgr_t *p_mgr = cxt;
 	osm_switch_t * p_sw = (osm_switch_t *) p_map_item;
 	osm_node_t *p_node;
+	osm_physp_t *p_physp;
 	osm_dr_path_t *p_path;
 	osm_madw_context_t context;
 	ib_api_status_t status;
@@ -916,7 +920,11 @@ static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item,
 	if (p_mgr->max_lid < p_sw->max_lid_ho)
 		p_mgr->max_lid = p_sw->max_lid_ho;
 
-	p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_node, 0));
+	p_physp = osm_node_get_physp_ptr(p_node, 0);
+
+	CL_ASSERT(p_physp);
+
+	p_path = osm_physp_get_dr_path_ptr(p_physp);
 
 	/*
 	   Set the top of the unicast forwarding table.
@@ -926,7 +934,9 @@ static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item,
 	if (lin_top != si.lin_top) {
 		set_swinfo_require = TRUE;
 		si.lin_top = lin_top;
-	}
+		context.si_context.lft_top_change = TRUE;
+	} else
+		context.si_context.lft_top_change = FALSE;
 
 	/* check to see if the change state bit is on. If it is - then we
 	   need to clear it. */
@@ -951,7 +961,9 @@ static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item,
 
 		status = osm_req_set(p_mgr->sm, p_path, (uint8_t *) & si,
 				     sizeof(si), IB_MAD_ATTR_SWITCH_INFO,
-				     0, CL_DISP_MSGID_NONE, &context);
+				     0, FALSE,
+				     ib_port_info_get_m_key(&p_physp->port_info),
+				     CL_DISP_MSGID_NONE, &context);
 
 		if (status != IB_SUCCESS)
 			OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A06: "
@@ -965,9 +977,9 @@ static void ucast_mgr_set_fwd_top(IN cl_map_item_t * p_map_item,
 static int set_lft_block(IN osm_switch_t *p_sw, IN osm_ucast_mgr_t *p_mgr,
 			 IN uint16_t block_id_ho)
 {
-	uint8_t block[IB_SMP_DATA_SIZE];
 	osm_madw_context_t context;
 	osm_dr_path_t *p_path;
+	osm_physp_t *p_physp;
 	ib_api_status_t status;
 
 	/*
@@ -982,15 +994,19 @@ static int set_lft_block(IN osm_switch_t *p_sw, IN osm_ucast_mgr_t *p_mgr,
 		return -1;
 	}
 
-	p_path = osm_physp_get_dr_path_ptr(osm_node_get_physp_ptr(p_sw->p_node, 0));
+	p_physp = osm_node_get_physp_ptr(p_sw->p_node, 0);
+	if (!p_physp)
+		return -1;
+
+	p_path = osm_physp_get_dr_path_ptr(p_physp);
 
 	context.lft_context.node_guid = osm_node_get_node_guid(p_sw->p_node);
 	context.lft_context.set_method = TRUE;
 
-	if (!osm_switch_get_lft_block(p_sw, block_id_ho, block) ||
-	    (!p_sw->need_update && !p_mgr->p_subn->need_update &&
-	     !memcmp(block, p_sw->new_lft + block_id_ho * IB_SMP_DATA_SIZE,
-		     IB_SMP_DATA_SIZE)))
+	if (!p_sw->need_update && !p_mgr->p_subn->need_update &&
+	    !memcmp(p_sw->new_lft + block_id_ho * IB_SMP_DATA_SIZE,
+		    p_sw->lft + block_id_ho * IB_SMP_DATA_SIZE,
+		    IB_SMP_DATA_SIZE))
 		return 0;
 
 	OSM_LOG(p_mgr->p_log, OSM_LOG_DEBUG,
@@ -1000,8 +1016,10 @@ static int set_lft_block(IN osm_switch_t *p_sw, IN osm_ucast_mgr_t *p_mgr,
 	status = osm_req_set(p_mgr->sm, p_path,
 			     p_sw->new_lft + block_id_ho * IB_SMP_DATA_SIZE,
 			     IB_SMP_DATA_SIZE, IB_MAD_ATTR_LIN_FWD_TBL,
-			     cl_hton32(block_id_ho),
+			     cl_hton32(block_id_ho), FALSE,
+			     ib_port_info_get_m_key(&p_physp->port_info),
 			     CL_DISP_MSGID_NONE, &context);
+
 	if (status != IB_SUCCESS) {
 		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 3A05: "
 			"Sending linear fwd. tbl. block failed (%s)\n",
@@ -1107,14 +1125,7 @@ int osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr)
 	if (!p_osm->routing_engine_used &&
 	    p_osm->no_fallback_routing_engine != TRUE) {
 		/* If configured routing algorithm failed, use default MinHop */
-		struct osm_routing_engine *r = p_osm->default_routing_engine;
-
-		r->build_lid_matrices(r->context);
-		failed = r->ucast_build_fwd_tables(r->context);
-		if (!failed) {
-			p_osm->routing_engine_used = r;
-			osm_ucast_mgr_set_fwd_tables(p_mgr);
-		}
+		failed = ucast_mgr_route(p_osm->default_routing_engine, p_osm);
 	}
 
 	if (p_osm->routing_engine_used) {
@@ -1174,3 +1185,8 @@ int osm_ucast_dor_setup(struct osm_routing_engine *r, osm_opensm_t * osm)
 	r->ucast_build_fwd_tables = ucast_dor_build_lfts;
 	return 0;
 }
+
+int ucast_dummy_build_lid_matrices(void *context)
+{
+	return 0;
+}
diff --git a/opensm/osm_ucast_updn.c b/opensm/osm_ucast_updn.c
index d6877fe..2da17de 100644
--- a/opensm/osm_ucast_updn.c
+++ b/opensm/osm_ucast_updn.c
@@ -594,12 +594,14 @@ static int updn_lid_matrices(void *ctx)
 
 		ret = parse_node_map(p_updn->p_osm->subn.opt.root_guid_file,
 				     rank_root_node, p_updn);
-		if (ret)
-			OSM_LOG(&p_updn->p_osm->log, OSM_LOG_ERROR, "ERR : "
+		if (ret) {
+			OSM_LOG(&p_updn->p_osm->log, OSM_LOG_ERROR, "ERR AA02: "
 				"cannot parse root guids file \'%s\'\n",
 				p_updn->p_osm->subn.opt.root_guid_file);
-		if (p_updn->p_osm->subn.opt.connect_roots &&
-		    p_updn->num_roots > 1)
+			osm_ucast_mgr_build_lid_matrices(&p_updn->p_osm->sm.ucast_mgr);
+			updn_find_root_nodes_by_min_hop(p_updn);
+		} else if (p_updn->p_osm->subn.opt.connect_roots &&
+			   p_updn->num_roots > 1)
 			osm_ucast_mgr_build_lid_matrices(&p_updn->p_osm->sm.ucast_mgr);
 	} else {
 		osm_ucast_mgr_build_lid_matrices(&p_updn->p_osm->sm.ucast_mgr);
@@ -614,7 +616,7 @@ static int updn_lid_matrices(void *ctx)
 		ret = parse_node_map(p_updn->p_osm->subn.opt.ids_guid_file,
 				     update_id, p_updn->p_osm);
 		if (ret)
-			OSM_LOG(&p_updn->p_osm->log, OSM_LOG_ERROR, "ERR : "
+			OSM_LOG(&p_updn->p_osm->log, OSM_LOG_ERROR, "ERR AA03: "
 				"cannot parse node ids file \'%s\'\n",
 				p_updn->p_osm->subn.opt.ids_guid_file);
 	}
diff --git a/opensm/osm_vl15intf.c b/opensm/osm_vl15intf.c
index 253578b..f85252c 100644
--- a/opensm/osm_vl15intf.c
+++ b/opensm/osm_vl15intf.c
@@ -346,7 +346,7 @@ void osm_vl15_shutdown(IN osm_vl15_t * p_vl, IN osm_mad_pool_t * p_mad_pool)
 	/* we only should get here after the VL15 interface was initialized */
 	CL_ASSERT(p_vl->state == OSM_VL15_STATE_READY);
 
-	/* grap a lock on the object */
+	/* grab a lock on the object */
 	cl_spinlock_acquire(&p_vl->lock);
 
 	/* go over all outstanding MADs and retire their transactions */
diff --git a/opensm/st.c b/opensm/st.c
index 754648c..c2ee014 100644
--- a/opensm/st.c
+++ b/opensm/st.c
@@ -166,7 +166,7 @@ static int new_size(int size)
 			return primes[i];
 	}
 	/* Ran out of polynomials */
-	return -1;		/* should raise exception */
+	return 0;		/* should raise exception */
 #endif
 }
 
@@ -196,7 +196,7 @@ size_t size;
 #endif
 
 	size = new_size(size);	/* round up to prime number */
-	if (size < 0)
+	if (!size)
 		return NULL;
 
 	tbl = alloc(st_table);
@@ -355,7 +355,7 @@ register st_table *table;
 	unsigned int hash_val;
 
 	new_num_bins = new_size(old_num_bins + 1);
-	if (new_num_bins < 0)
+	if (!new_num_bins)
 		return;
 
 	new_bins =
diff --git a/osmeventplugin/Makefile.am b/osmeventplugin/Makefile.am
index 79e3d55..28feedb 100644
--- a/osmeventplugin/Makefile.am
+++ b/osmeventplugin/Makefile.am
@@ -10,7 +10,7 @@ else
 DBGFLAGS = -g
 endif
 
-libosmeventplugin_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
+libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
 
 if HAVE_LD_VERSION_SCRIPT
     libosmeventplugin_version_script = -Wl,--version-script=$(srcdir)/libosmeventplugin.map
diff --git a/osmeventplugin/Makefile.in b/osmeventplugin/Makefile.in
index 38381ee..ee6b95e 100644
--- a/osmeventplugin/Makefile.in
+++ b/osmeventplugin/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -39,8 +39,12 @@ subdir = osmeventplugin
 DIST_COMMON = $(libosmeventplugininclude_HEADERS) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
-	$(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+	$(top_srcdir)/config/ltoptions.m4 \
+	$(top_srcdir)/config/ltsugar.m4 \
+	$(top_srcdir)/config/ltversion.m4 \
+	$(top_srcdir)/config/lt~obsolete.m4 \
+	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -69,12 +73,6 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
 am__installdirs = "$(DESTDIR)$(libdir)" \
 	"$(DESTDIR)$(libosmeventpluginincludedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
@@ -119,9 +117,10 @@ CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
+DEFAULT_START = @DEFAULT_START@
+DEFAULT_STOP = @DEFAULT_STOP@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -148,7 +147,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -175,6 +173,7 @@ PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
+RDMA_SERVICE = @RDMA_SERVICE@
 RELEASE = @RELEASE@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -191,7 +190,6 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -224,6 +222,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -245,7 +244,7 @@ INCLUDES = -I$(srcdir)/../include \
 lib_LTLIBRARIES = libosmeventplugin.la
 @DEBUG_FALSE at DBGFLAGS = -g
 @DEBUG_TRUE at DBGFLAGS = -ggdb -D_DEBUG_
-libosmeventplugin_la_CFLAGS = -Wall $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
+libosmeventplugin_la_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS) -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
 @HAVE_LD_VERSION_SCRIPT_FALSE at libosmeventplugin_version_script = 
 @HAVE_LD_VERSION_SCRIPT_TRUE at libosmeventplugin_version_script = -Wl,--version-script=$(srcdir)/libosmeventplugin.map
 osmeventplugin_api_version = $(shell grep LIBVERSION= $(srcdir)/libosmeventplugin.ver | sed 's/LIBVERSION=//')
@@ -325,7 +324,7 @@ clean-libLTLIBRARIES:
 	  echo "rm -f \"$${dir}/so_locations\""; \
 	  rm -f "$${dir}/so_locations"; \
 	done
-libosmeventplugin.la: $(libosmeventplugin_la_OBJECTS) $(libosmeventplugin_la_DEPENDENCIES) $(EXTRA_libosmeventplugin_la_DEPENDENCIES) 
+libosmeventplugin.la: $(libosmeventplugin_la_OBJECTS) $(libosmeventplugin_la_DEPENDENCIES) 
 	$(libosmeventplugin_la_LINK) -rpath $(libdir) $(libosmeventplugin_la_OBJECTS) $(libosmeventplugin_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -386,7 +385,9 @@ uninstall-libosmeventpluginincludeHEADERS:
 	@$(NORMAL_UNINSTALL)
 	@list='$(libosmeventplugininclude_HEADERS)'; test -n "$(libosmeventpluginincludedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(libosmeventpluginincludedir)'; $(am__uninstall_files_from_dir)
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(libosmeventpluginincludedir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(libosmeventpluginincludedir)" && rm -f $$files
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -487,15 +488,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/osmeventplugin/src/osmeventplugin.c b/osmeventplugin/src/osmeventplugin.c
index aaf7e80..0f3f9fb 100644
--- a/osmeventplugin/src/osmeventplugin.c
+++ b/osmeventplugin/src/osmeventplugin.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2013 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
  * Copyright (c) 2007 The Regents of the University of California.
  *
@@ -156,6 +157,17 @@ static void handle_trap_event(_log_events_t *log, ib_mad_notice_attr_t *p_ntc)
 
 /** =========================================================================
  */
+static void handle_lft_change_event(_log_events_t *log,
+				    osm_epi_lft_change_event_t *lft_change)
+{
+	fprintf(log->log_file,
+		"LFT changed for switch 0x%" PRIx64 " flags 0x%x LFTTop %u block %d\n",
+		cl_ntoh64(osm_node_get_node_guid(lft_change->p_sw->p_node)),
+		lft_change->flags, lft_change->lft_top, lft_change->block_num);
+}
+
+/** =========================================================================
+ */
 static void report(void *_log, osm_epi_event_id_t event_id, void *event_data)
 {
 	_log_events_t *log = (_log_events_t *) _log;
@@ -183,7 +195,8 @@ static void report(void *_log, osm_epi_event_id_t event_id, void *event_data)
 		fprintf(log->log_file, "Heavy sweep completed\n");
 		break;
 	case OSM_EVENT_ID_UCAST_ROUTING_DONE:
-		fprintf(log->log_file, "Unicast routing completed\n");
+		fprintf(log->log_file, "Unicast routing completed %d\n",
+			(osm_epi_ucast_routing_flags_t) event_data);
 		break;
 	case OSM_EVENT_ID_STATE_CHANGE:
 		fprintf(log->log_file, "SM state changed\n");
@@ -191,6 +204,9 @@ static void report(void *_log, osm_epi_event_id_t event_id, void *event_data)
 	case OSM_EVENT_ID_SA_DB_DUMPED:
 		fprintf(log->log_file, "SA DB dump file updated\n");
 		break;
+	case OSM_EVENT_ID_LFT_CHANGE:
+		handle_lft_change_event(log, (osm_epi_lft_change_event_t *) event_data);
+		break;
 	case OSM_EVENT_ID_MAX:
 	default:
 		osm_log(log->osmlog, OSM_LOG_ERROR,
diff --git a/osmtest/Makefile.am b/osmtest/Makefile.am
index 4c68852..f222a7c 100644
--- a/osmtest/Makefile.am
+++ b/osmtest/Makefile.am
@@ -13,7 +13,7 @@ osmtest_SOURCES = main.c osmtest.c osmt_service.c osmt_slvl_vl_arb.c \
 if OSMV_VAPI
 osmtest_SOURCES += osmt_mtl_regular_qp.c
 endif
-osmtest_CFLAGS = -Wall $(DBGFLAGS)
+osmtest_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS)
 osmtest_LDADD = -L../complib -losmcomp -L../libvendor -losmvendor -L../opensm -lopensm $(OSMV_LDADD)
 
 EXTRA_DIST = $(srcdir)/include/osmt_inform.h \
diff --git a/osmtest/Makefile.in b/osmtest/Makefile.in
index 2eb41d2..93665a9 100644
--- a/osmtest/Makefile.in
+++ b/osmtest/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -39,8 +39,12 @@ sbin_PROGRAMS = osmtest$(EXEEXT)
 subdir = osmtest
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/config/osmvsel.m4 \
-	$(top_srcdir)/configure.in
+am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+	$(top_srcdir)/config/ltoptions.m4 \
+	$(top_srcdir)/config/ltsugar.m4 \
+	$(top_srcdir)/config/ltversion.m4 \
+	$(top_srcdir)/config/lt~obsolete.m4 \
+	$(top_srcdir)/config/osmvsel.m4 $(top_srcdir)/configure.in
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -97,9 +101,10 @@ CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFAULT_EVENT_PLUGIN = @DEFAULT_EVENT_PLUGIN@
+DEFAULT_START = @DEFAULT_START@
+DEFAULT_STOP = @DEFAULT_STOP@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -126,7 +131,6 @@ LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
 MKDIR_P = @MKDIR_P@
 NM = @NM@
 NMEDIT = @NMEDIT@
@@ -153,6 +157,7 @@ PER_MOD_LOGGING_FILE = @PER_MOD_LOGGING_FILE@
 PREFIX_ROUTES_FILE = @PREFIX_ROUTES_FILE@
 QOS_POLICY_FILE = @QOS_POLICY_FILE@
 RANLIB = @RANLIB@
+RDMA_SERVICE = @RDMA_SERVICE@
 RELEASE = @RELEASE@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -169,7 +174,6 @@ abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__include = @am__include@
@@ -202,6 +206,7 @@ libdir = @libdir@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -222,7 +227,7 @@ top_srcdir = @top_srcdir@
 INCLUDES = -I$(srcdir)/include $(OSMV_INCLUDES)
 osmtest_SOURCES = main.c osmtest.c osmt_service.c osmt_slvl_vl_arb.c \
 	osmt_multicast.c osmt_inform.c $(am__append_1)
-osmtest_CFLAGS = -Wall $(DBGFLAGS)
+osmtest_CFLAGS = -Wall -Wwrite-strings $(DBGFLAGS)
 osmtest_LDADD = -L../complib -losmcomp -L../libvendor -losmvendor -L../opensm -lopensm $(OSMV_LDADD)
 EXTRA_DIST = $(srcdir)/include/osmt_inform.h \
    $(srcdir)/include/osmtest_subnet.h \
@@ -307,7 +312,7 @@ clean-sbinPROGRAMS:
 	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
 	echo " rm -f" $$list; \
 	rm -f $$list
-osmtest$(EXEEXT): $(osmtest_OBJECTS) $(osmtest_DEPENDENCIES) $(EXTRA_osmtest_DEPENDENCIES) 
+osmtest$(EXEEXT): $(osmtest_OBJECTS) $(osmtest_DEPENDENCIES) 
 	@rm -f osmtest$(EXEEXT)
 	$(osmtest_LINK) $(osmtest_OBJECTS) $(osmtest_LDADD) $(LIBS)
 
@@ -549,15 +554,10 @@ install-am: all-am
 
 installcheck: installcheck-am
 install-strip:
-	if test -z '$(STRIP)'; then \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	      install; \
-	else \
-	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
-	fi
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
 
 clean-generic:
diff --git a/osmtest/include/osmtest.h b/osmtest/include/osmtest.h
index c3134ef..f63ea74 100644
--- a/osmtest/include/osmtest.h
+++ b/osmtest/include/osmtest.h
@@ -86,6 +86,7 @@ typedef struct _osmtest_opt {
 	uint8_t wait_time;
 	char *log_file;
 	boolean_t ignore_path_records;
+	boolean_t full_world_path_recs;
 } osmtest_opt_t;
 
 /*
@@ -127,6 +128,7 @@ typedef struct _osmtest {
 
 	osmtest_opt_t opt;
 	ib_port_attr_t local_port;
+	ib_gid_t local_port_gid;
 	subnet_t exp_subn;
 	cl_qpool_t node_pool;
 	cl_qpool_t port_pool;
diff --git a/osmtest/main.c b/osmtest/main.c
index 7b586e9..f48910b 100644
--- a/osmtest/main.c
+++ b/osmtest/main.c
@@ -107,6 +107,7 @@ void show_usage()
 	       "          -d0  - Unused.\n"
 	       "          -d1  - Do not scan/compare path records.\n"
 	       "          -d2  - Force log flushing after each log message.\n"
+	       "          -d4  - Use full world path record queries.\n"
 	       "          Without -d, no debug options are enabled\n\n");
 	printf("-m <LID in hex>\n"
 	       "--max_lid <LID in hex>\n"
@@ -292,7 +293,7 @@ int main(int argc, char *argv[])
 		{"wait", 1, NULL, 'w'},
 		{"inventory", 1, NULL, 'i'},
 		{"max_lid", 1, NULL, 'm'},
-		{"guid", 2, NULL, 'g'},
+		{"guid", 1, NULL, 'g'},
 		{"port", 0, NULL, 'p'},
 		{"help", 0, NULL, 'h'},
 		{"stress", 1, NULL, 's'},
@@ -327,6 +328,7 @@ int main(int argc, char *argv[])
 	opt.create = FALSE;
 	opt.mmode = 1;
 	opt.ignore_path_records = FALSE;	/*  Do path Records too */
+	opt.full_world_path_recs = FALSE;
 	opt.flow = OSMT_FLOW_ALL;	/*  run all validation tests */
 	strcpy(flow_name, "All Validations");
 	strcpy(opt.file_name, "osmtest.dat");
@@ -533,6 +535,10 @@ int main(int argc, char *argv[])
 				printf("Force Log Flush\n");
 				opt.force_log_flush = TRUE;
 				break;
+			case 4:
+				printf("Use Full World Path Record Queries\n");
+				opt.full_world_path_recs = TRUE;
+				break;
 			case 3:
 				/* Used to be memory tracking */
 			default:
diff --git a/osmtest/osmt_multicast.c b/osmtest/osmt_multicast.c
index b861ad4..93b04a2 100644
--- a/osmtest/osmt_multicast.c
+++ b/osmtest/osmt_multicast.c
@@ -378,7 +378,7 @@ void osmt_init_mc_query_rec(IN osmtest_t * const p_osmt,
 	       sizeof(p_osmt->local_port.port_guid));
 
 	/*  use our own subnet prefix: */
-	p_mc_req->port_gid.unicast.prefix = CL_HTON64(0xFE80000000000000ULL);
+	p_mc_req->port_gid.unicast.prefix = cl_hton64(p_osmt->local_port_gid.unicast.prefix);
 
 	/*  ib_net32_t  qkey; */
 	/*  ib_net16_t  mlid; - we keep it zero for upper level to decide. */
@@ -435,10 +435,23 @@ void osmt_init_mc_query_rec(IN osmtest_t * const p_osmt,
  * - Try GetTable with PortGUID wildcarded and get back some groups.
  ***********************************************************************/
 
+#define PREFIX_MASK CL_HTON64(0xff10ffff00000000ULL)
+#define PREFIX_SIGNATURE CL_HTON64(0xff10601b00000000ULL)
+#define IPV4_PREFIX_MASK CL_HTON64(0xff10ffff00000000ULL)
+#define PREFIX_SIGNATURE_IPV4 CL_HTON64(0xff10401b00000000ULL)
+
+static unsigned is_ipv4_mgid(ib_gid_t * mgid)
+{
+	return ((mgid->unicast.prefix & IPV4_PREFIX_MASK) == PREFIX_SIGNATURE_IPV4);
+}
+
+static unsigned is_ipv6_mgid(ib_gid_t * mgid)
+{
+	return ((mgid->unicast.prefix & PREFIX_MASK) == PREFIX_SIGNATURE);
+}
+
 /* The following macro can be used only within the osmt_run_mcast_flow() function */
-#define IS_IPOIB_MGID(p_mgid) \
-           ( !memcmp(&osm_ipoib_good_mgid,    (p_mgid), sizeof(osm_ipoib_good_mgid)) || \
-             !memcmp(&osm_ts_ipoib_good_mgid, (p_mgid), sizeof(osm_ts_ipoib_good_mgid)) )
+#define IS_IPOIB_MGID(p_mgid) (is_ipv4_mgid(p_mgid) || is_ipv6_mgid(p_mgid))
 
 ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 {
@@ -486,6 +499,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		 0xff, 0xff, 0xff, 0xee,	/* 32 bit IPv4 broadcast address */
 		 },
 	};
+#if 0
 	static ib_gid_t osm_ts_ipoib_good_mgid = {
 		{
 		 0xff,		/* multicast field */
@@ -496,6 +510,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 		 0x00, 0x00, 0x00, 0x01,	/* 32 bit IPv4 broadcast address */
 		 },
 	};
+#endif
 	static ib_gid_t osm_ipoib_good_mgid = {
 		{
 		 0xff,		/* multicast field */
@@ -2096,9 +2111,9 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	OSM_LOG(&p_osmt->log, OSM_LOG_INFO,
 		"Validating Join State update remove (o15.0.1.14)...\n");
 
-	if (p_mc_res->scope_state != 0x25) {	/* scope is MSB - now only 0x0 so port is removed from MCG */
+	if (p_mc_res->scope_state != 0x20) {	/* scope is MSB - now only 0x0 so port is removed from MCG */
 		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 02BF: "
-			"Validating JoinState update failed. Expected 0x25 got: 0x%02X\n",
+			"Validating JoinState update failed. Expected 0x20 got: 0x%02X\n",
 			p_mc_res->scope_state);
 		status = IB_ERROR;
 		goto Exit;
@@ -2157,7 +2172,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt)
 	mc_req_rec.mgid = good_mgid;
 	mc_req_rec.mgid.raw[12] = 0xAA;
 	mc_req_rec.pkt_life = 0 | IB_PATH_SELECTOR_GREATER_THAN << 6;
-	mc_req_rec.scope_state = 0x21;	/* Full memeber */
+	mc_req_rec.scope_state = 0x21;	/* Full member */
 	comp_mask = IB_MCR_COMPMASK_GID | IB_MCR_COMPMASK_PORT_GID | IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |	/* all above are required */
 	    IB_MCR_COMPMASK_LIFE | IB_MCR_COMPMASK_LIFE_SEL;
 
diff --git a/osmtest/osmt_service.c b/osmtest/osmt_service.c
index a37c946..961c904 100644
--- a/osmtest/osmt_service.c
+++ b/osmtest/osmt_service.c
@@ -85,7 +85,7 @@ osmt_register_service(IN osmtest_t * const p_osmt,
 	/* set the new service record fields */
 	svc_rec.service_id = service_id;
 	svc_rec.service_pkey = service_pkey;
-	svc_rec.service_gid.unicast.prefix = 0;
+	svc_rec.service_gid.unicast.prefix = p_osmt->local_port_gid.unicast.prefix;
 	svc_rec.service_gid.unicast.interface_id = p_osmt->local_port.port_guid;
 	svc_rec.service_lease = service_lease;
 	memset(&svc_rec.service_key, 0, 16 * sizeof(uint8_t));
@@ -188,7 +188,7 @@ osmt_register_service_with_full_key(IN osmtest_t * const p_osmt,
 	/* set the new service record fields */
 	svc_rec.service_id = service_id;
 	svc_rec.service_pkey = service_pkey;
-	svc_rec.service_gid.unicast.prefix = 0;
+	svc_rec.service_gid.unicast.prefix = p_osmt->local_port_gid.unicast.prefix;
 	svc_rec.service_gid.unicast.interface_id = p_osmt->local_port.port_guid;
 	svc_rec.service_lease = service_lease;
 	memset(&svc_rec.service_key, 0, 16 * sizeof(uint8_t));
@@ -312,7 +312,7 @@ osmt_register_service_with_data(IN osmtest_t * const p_osmt,
 	/* set the new service record fields */
 	svc_rec.service_id = service_id;
 	svc_rec.service_pkey = service_pkey;
-	svc_rec.service_gid.unicast.prefix = 0;
+	svc_rec.service_gid.unicast.prefix = p_osmt->local_port_gid.unicast.prefix;
 	svc_rec.service_gid.unicast.interface_id = p_osmt->local_port.port_guid;
 	svc_rec.service_lease = service_lease;
 	memset(&svc_rec.service_key, 0, 16 * sizeof(uint8_t));
diff --git a/osmtest/osmtest.c b/osmtest/osmtest.c
index 68b0e40..11baa98 100644
--- a/osmtest/osmtest.c
+++ b/osmtest/osmtest.c
@@ -832,6 +832,69 @@ Exit:
 }
 
 static ib_api_status_t
+osmtest_get_path_rec_by_half_world_query(IN osmtest_t * const p_osmt,
+				  IN ib_net64_t sguid,
+				  IN osmtest_req_context_t * p_context)
+{
+	cl_status_t status = IB_SUCCESS;
+	osmv_query_req_t req;
+	osmv_user_query_t user;
+	ib_path_rec_t record;
+
+	OSM_LOG_ENTER(&p_osmt->log);
+
+	memset(&req, 0, sizeof(req));
+	memset(p_context, 0, sizeof(*p_context));
+	memset(&record, 0, sizeof(record));
+	memset(&user, 0, sizeof(user));
+
+        ib_gid_set_default(&(record.sgid), sguid);
+	record.num_path = 0x01;
+
+	p_context->p_osmt = p_osmt;
+	user.comp_mask = (IB_PR_COMPMASK_SGID | IB_PR_COMPMASK_NUMBPATH);
+	user.attr_id = IB_MAD_ATTR_PATH_RECORD;
+	user.p_attr = &record;
+
+	req.query_type = OSMV_QUERY_USER_DEFINED;
+	req.timeout_ms = p_osmt->opt.transaction_timeout;
+	req.retry_cnt = p_osmt->opt.retry_count;
+	req.flags = OSM_SA_FLAGS_SYNC;
+	req.query_context = p_context;
+	req.pfn_query_cb = osmtest_query_res_cb;
+	req.p_query_input = &user;
+	req.sm_key = 0;
+
+	status = osmv_query_sa(p_osmt->h_bind, &req);
+	if (status != IB_SUCCESS) {
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0063: "
+			"ib_query failed (%s)\n", ib_get_err_str(status));
+		goto Exit;
+	}
+
+	status = (*p_context).result.status;
+
+	if (status != IB_SUCCESS) {
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0066: "
+			"ib_query failed (%s)\n", ib_get_err_str(status));
+
+		if (status == IB_REMOTE_ERROR) {
+			OSM_LOG(&p_osmt->log, OSM_LOG_ERROR,
+				"Remote error = %s\n",
+				ib_get_mad_status_str(osm_madw_get_mad_ptr
+						      ((*p_context).result.
+						       p_result_madw)));
+		}
+		goto Exit;
+	}
+
+Exit:
+
+	OSM_LOG_EXIT(&p_osmt->log);
+	return (status);
+}
+
+static ib_api_status_t
 osmtest_get_path_rec_by_guid_pair(IN osmtest_t * const p_osmt,
 				  IN ib_net64_t sguid,
 				  IN ib_net64_t dguid,
@@ -2028,6 +2091,7 @@ osmtest_write_all_node_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
 	cl_status_t status;
 	size_t num_recs;
 	int result;
+	node_t *p_guid_node;
 
 	OSM_LOG_ENTER(&p_osmt->log);
 
@@ -2065,6 +2129,16 @@ osmtest_write_all_node_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
 		p_rec =
 		    osmv_get_query_node_rec(context.result.p_result_madw, i);
 		osmtest_write_node_info(p_osmt, fh, p_rec);
+
+		/* create a subnet object */
+		p_guid_node = node_new();
+		CL_ASSERT(p_guid_node != NULL);
+
+		/* copy the info to the subnet node object */
+		p_guid_node->rec = *p_rec;
+		cl_qmap_insert(&p_osmt->exp_subn.node_guid_tbl,
+				p_guid_node->rec.node_info.port_guid,
+				&p_guid_node->map_item);
 	}
 
 Exit:
@@ -2156,12 +2230,57 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
 	osmtest_req_context_t context;
 	const ib_path_rec_t *p_rec;
 	uint32_t i;
-	cl_status_t status;
+	cl_status_t status = CL_SUCCESS;
 	size_t num_recs;
 	int result;
+	node_t *p_dst_node;
+	cl_qmap_t *p_tbl;
 
 	OSM_LOG_ENTER(&p_osmt->log);
 
+	if (p_osmt->opt.full_world_path_recs)
+		goto full_world;
+
+	result = fprintf(fh, "#\n" "# Path Records\n" "#\n");
+	if (result < 0) {
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0026: "
+			"Write failed\n");
+		status = IB_ERROR;
+		goto Exit;
+	}
+
+	p_tbl = &p_osmt->exp_subn.node_guid_tbl;
+	p_dst_node = (node_t *) cl_qmap_head(p_tbl);
+
+	while (p_dst_node != (node_t *) cl_qmap_end(p_tbl)) {
+
+		OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,"Source : lid = 0x%d type = %d\n",
+				cl_ntoh16(p_dst_node->rec.lid),
+				p_dst_node->rec.node_info.node_type);
+
+		status = osmtest_get_path_rec_by_half_world_query(p_osmt, p_dst_node->rec.node_info.port_guid, &context);
+		if (status != IB_SUCCESS) {
+			OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0025: "
+					"osmtest_get_all_path_recs failed (%s)\n",
+					ib_get_err_str(status));
+			goto Exit;
+		}
+		/*
+		 * Write the received records out to the file.
+		 */
+		num_recs = context.result.result_cnt;
+		OSM_LOG(&p_osmt->log, OSM_LOG_VERBOSE, "Received %zu records\n", num_recs);
+
+		for (i = 0; i < num_recs; i++) {
+			p_rec =
+				osmv_get_query_path_rec(context.result.p_result_madw, i);
+			osmtest_write_path_info(p_osmt, fh, p_rec);
+		}
+		p_dst_node = (node_t *) cl_qmap_next(&p_dst_node->map_item);
+	}
+	goto Exit;
+
+full_world:
 	memset(&context, 0, sizeof(context));
 
 	/*
@@ -2171,12 +2290,11 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
 				      sizeof(*p_rec), &context);
 
 	if (status != IB_SUCCESS) {
-		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0025: "
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0002: "
 			"osmtest_get_all_recs failed (%s)\n",
 			ib_get_err_str(status));
 		goto Exit;
 	}
-
 	/*
 	 * Write the received records out to the file.
 	 */
@@ -2186,7 +2304,7 @@ osmtest_write_all_path_recs(IN osmtest_t * const p_osmt, IN FILE * fh)
 
 	result = fprintf(fh, "#\n" "# Path Records\n" "#\n");
 	if (result < 0) {
-		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0026: "
+		OSM_LOG(&p_osmt->log, OSM_LOG_ERROR, "ERR 0005: "
 			"Write failed\n");
 		status = IB_ERROR;
 		goto Exit;
@@ -3068,7 +3186,8 @@ Exit:
 	return (status);
 }
 
-inline uint32_t osmtest_path_rec_key_get(IN const ib_path_rec_t * const p_rec)
+static inline uint32_t
+osmtest_path_rec_key_get(IN const ib_path_rec_t * const p_rec)
 {
 	return (p_rec->dlid << 16 | p_rec->slid);
 }
@@ -7087,9 +7206,16 @@ osmtest_bind(IN osmtest_t * p_osmt,
 	ib_api_status_t status;
 	uint32_t num_ports = MAX_LOCAL_IBPORTS;
 	ib_port_attr_t attr_array[MAX_LOCAL_IBPORTS] = { {0} };
+	ib_gid_t gid[MAX_LOCAL_IBPORTS];
+	int i;
 
 	OSM_LOG_ENTER(&p_osmt->log);
 
+	for (i = 0; i < MAX_LOCAL_IBPORTS; i++) {
+		attr_array[i].num_gids = 1;
+		attr_array[i].p_gid_table = &gid[i];
+	}
+
 	/*
 	 * Call the transport layer for a list of local port
 	 * GUID values.
@@ -7136,7 +7262,17 @@ osmtest_bind(IN osmtest_t * p_osmt,
 	 * Copy the port info for the selected port.
 	 */
 	memcpy(&p_osmt->local_port, &attr_array[port_index],
-	       sizeof(p_osmt->local_port));
+	       sizeof(p_osmt->local_port) - sizeof(p_osmt->local_port.p_gid_table));
+	if (p_osmt->local_port.num_gids) {
+		p_osmt->local_port_gid.unicast.prefix = p_osmt->local_port.p_gid_table[0].unicast.prefix;
+		p_osmt->local_port_gid.unicast.interface_id = p_osmt->local_port.p_gid_table[0].unicast.interface_id;
+	} else {
+		p_osmt->local_port_gid.unicast.prefix = IB_DEFAULT_SUBNET_PREFIX_HO;
+		p_osmt->local_port_gid.unicast.interface_id = attr_array[port_index].port_guid;
+		p_osmt->local_port.p_gid_table = NULL;
+	}
+	p_osmt->local_port.num_gids = 1;
+	p_osmt->local_port.p_gid_table = &p_osmt->local_port_gid;
 
 	/* bind to the SA */
 	OSM_LOG(&p_osmt->log, OSM_LOG_DEBUG,
diff --git a/scripts/opensm.init b/scripts/opensm.init
index 4195092..ff86b32 100644
--- a/scripts/opensm.init
+++ b/scripts/opensm.init
@@ -7,9 +7,9 @@
 #
 ### BEGIN INIT INFO
 # Provides: opensm
-# Required-Start: $syslog
-# Required-Stop:
-# Default-Start: none
+# Required-Start: $syslog openibd
+# Required-Stop: $syslog openibd
+# Default-Start: null
 # Default-Stop: 0 1 6
 # Description:  Manage OpenSM
 ### END INIT INFO
@@ -42,14 +42,22 @@
 
 prefix=/usr/local
 exec_prefix=${prefix}
+pidfile=/var/run/opensm.pid
 
 # Source function library.
 if [[ -s /etc/init.d/functions ]]; then
+    # RHEL / CentOS / SL / Fedora.
     . /etc/init.d/functions
     rc_status() { :; }
     rc_exit() { exit $RETVAL; }
-fi
-if [[ -s /etc/rc.status ]]; then
+elif [[ -s /lib/lsb/init-functions ]]; then
+    # SLES / openSuSE / Debian.
+    . /lib/lsb/init-functions
+    rc_exit() { exit $RETVAL; }
+    success() { log_success_msg; }
+    failure() { log_failure_msg; }
+elif [[ -s /etc/rc.status ]]; then
+    # Older SuSE systems.
     . /etc/rc.status
     failure() { rc_status -v; }
     success() { rc_status -v; }
@@ -60,11 +68,19 @@ if [[ -s $CONFIG ]]; then
     . $CONFIG
 fi
 
+running () {
+    [ -e $pidfile ] &&
+        [ "$(readlink "/proc/$(<$pidfile)/exe")" = "${exec_prefix}/sbin/opensm" ]
+}
+
 start () {
+    if running; then
+	echo Already started
+	return 1
+    fi
     echo -n "Starting opensm: "
-    ${exec_prefix}/sbin/opensm --daemon $OPTIONS > /dev/null
+    ${exec_prefix}/sbin/opensm --daemon --pidfile $pidfile $OPTIONS > /dev/null
     if [[ $RETVAL -eq 0 ]]; then
-        touch /var/lock/subsys/opensm
         success
     else
         failure
@@ -76,7 +92,6 @@ stop () {
     echo -n "Shutting down opensm: "
     killproc opensm
     if [[ $RETVAL -eq 0 ]]; then
-        rm -f /var/lock/subsys/opensm
         success
     else
         failure
@@ -114,7 +129,7 @@ case "$1" in
 	restart
 	;;
     try-restart | condrestart)
-	[ -e /var/lock/subsys/opensm ] && restart
+	[ -e $pidfile ] && restart
 	;;
     resweep)
 	killall -HUP opensm
diff --git a/scripts/opensm.init.in b/scripts/opensm.init.in
index 0c84bd3..227c38c 100644
--- a/scripts/opensm.init.in
+++ b/scripts/opensm.init.in
@@ -7,10 +7,10 @@
 #
 ### BEGIN INIT INFO
 # Provides: opensm
-# Required-Start: $syslog
-# Required-Stop:
-# Default-Start: none
-# Default-Stop: 0 1 6
+# Required-Start: $syslog @RDMA_SERVICE@
+# Required-Stop: $syslog @RDMA_SERVICE@
+# Default-Start: @DEFAULT_START@
+# Default-Stop: @DEFAULT_STOP@
 # Description:  Manage OpenSM
 ### END INIT INFO
 #
@@ -42,14 +42,22 @@
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
+pidfile=/var/run/opensm.pid
 
 # Source function library.
 if [[ -s /etc/init.d/functions ]]; then
+    # RHEL / CentOS / SL / Fedora.
     . /etc/init.d/functions
     rc_status() { :; }
     rc_exit() { exit $RETVAL; }
-fi
-if [[ -s /etc/rc.status ]]; then
+elif [[ -s /lib/lsb/init-functions ]]; then
+    # SLES / openSuSE / Debian.
+    . /lib/lsb/init-functions
+    rc_exit() { exit $RETVAL; }
+    success() { log_success_msg; }
+    failure() { log_failure_msg; }
+elif [[ -s /etc/rc.status ]]; then
+    # Older SuSE systems.
     . /etc/rc.status
     failure() { rc_status -v; }
     success() { rc_status -v; }
@@ -60,11 +68,19 @@ if [[ -s $CONFIG ]]; then
     . $CONFIG
 fi
 
+running () {
+    [ -e $pidfile ] &&
+        [ "$(readlink "/proc/$(<$pidfile)/exe")" = "@sbindir@/opensm" ]
+}
+
 start () {
+    if running; then
+	echo Already started
+	return 1
+    fi
     echo -n "Starting opensm: "
-    @sbindir@/opensm --daemon $OPTIONS > /dev/null
+    @sbindir@/opensm --daemon --pidfile $pidfile $OPTIONS > /dev/null
     if [[ $RETVAL -eq 0 ]]; then
-        touch /var/lock/subsys/opensm
         success
     else
         failure
@@ -76,7 +92,6 @@ stop () {
     echo -n "Shutting down opensm: "
     killproc opensm
     if [[ $RETVAL -eq 0 ]]; then
-        rm -f /var/lock/subsys/opensm
         success
     else
         failure
@@ -114,7 +129,7 @@ case "$1" in
 	restart
 	;;
     try-restart | condrestart)
-	[ -e /var/lock/subsys/opensm ] && restart
+	[ -e $pidfile ] && restart
 	;;
     resweep)
 	killall -HUP opensm
diff --git a/scripts/redhat-opensm.init b/scripts/redhat-opensm.init
index 24a5663..e584909 100644
--- a/scripts/redhat-opensm.init
+++ b/scripts/redhat-opensm.init
@@ -7,6 +7,11 @@
 #
 ### BEGIN INIT INFO
 # Provides:       opensm
+# Required-Start: $syslog openibd
+# Required-Stop: $syslog openibd
+# Default-Start: null
+# Default-Stop: 0 1 6
+# Description:  Manage OpenSM
 ### END INIT INFO
 #
 # Copyright (c) 2008 Voltaire, Inc. All rights reserved.
diff --git a/scripts/redhat-opensm.init.in b/scripts/redhat-opensm.init.in
index 9c22275..415ab2f 100755
--- a/scripts/redhat-opensm.init.in
+++ b/scripts/redhat-opensm.init.in
@@ -7,6 +7,11 @@
 #
 ### BEGIN INIT INFO
 # Provides:       opensm
+# Required-Start: $syslog @RDMA_SERVICE@
+# Required-Stop: $syslog @RDMA_SERVICE@
+# Default-Start: @DEFAULT_START@
+# Default-Stop: @DEFAULT_STOP@
+# Description:  Manage OpenSM
 ### END INIT INFO
 #
 # Copyright (c) 2008 Voltaire, Inc. All rights reserved.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ofed/opensm.git



More information about the Pkg-ofed-commits mailing list