[PATCH 02/12] Prepare -dlopen option for shared archive members.

Michael Haubenwallner <[email protected]>
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <1349192093-24173-3-git-send-email-michael.haubenwallner@salomon.at>
* build-aux/ltmain.m4sh: (func_mode_execute) For the -dlopen option,
when testing if the file to be dlopen'ed exists, strip the optional
shared archive member (seen on AIX) from dlname first.
---
 build-aux/ltmain.m4sh |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/build-aux/ltmain.m4sh b/build-aux/ltmain.m4sh
index 14f3c37..22b56a1 100644
--- a/build-aux/ltmain.m4sh
+++ b/build-aux/ltmain.m4sh
@@ -1777,10 +1777,20 @@ func_mode_execute ()
 	func_dirname "$file" "" "."
 	dir=$func_dirname_result
 
-	if test -f "$dir/$objdir/$dlname"; then
+	# dlname may be "archive(member)" on AIX
+	case $dlname in
+	*'('*')')
+	  # func_stripname does not work with '(*)',
+	  # need to pass '(member)' instead.
+	  func_stripname '' "`IFS='()'; set -- $dlname; echo \"($2)\"`" "$dlname"
+	  ;;
+	*) func_stripname_result="$dlname" ;;
+	esac
+
+	if test -f "$dir/$objdir/$func_stripname_result"; then
 	  func_append dir "/$objdir"
 	else
-	  if test ! -f "$dir/$dlname"; then
+	  if test ! -f "$dir/$func_stripname_result"; then
 	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
 	  fi
 	fi
-- 
1.7.3.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.