diff options
author | midipix <writeonce@midipix.org> | 2016-06-30 02:47:43 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-06-30 02:47:43 -0400 |
commit | 7383214f317653f2313cb882bca8a0f8960435f2 (patch) | |
tree | 4f432cbe27acd58511cc2740db3711cc073553cb /src/logic/slbt_exec_link.c | |
parent | daf3df1ea9a5947b0647e97b3500d11b45b875ca (diff) | |
download | slibtool-7383214f317653f2313cb882bca8a0f8960435f2.tar.bz2 slibtool-7383214f317653f2313cb882bca8a0f8960435f2.tar.xz |
link mode: append '/.libs' to -L arguments as needed.
Diffstat (limited to 'src/logic/slbt_exec_link.c')
-rw-r--r-- | src/logic/slbt_exec_link.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c index cdda42b..32da53a 100644 --- a/src/logic/slbt_exec_link.c +++ b/src/logic/slbt_exec_link.c @@ -244,6 +244,7 @@ static int slbt_exec_link_adjust_argument_vector( { char ** carg; char ** aarg; + char * ldir; char * slash; char * mark; char * darg; @@ -259,6 +260,7 @@ static int slbt_exec_link_adjust_argument_vector( char rpathlnk[PATH_MAX]; bool fwholearchive = false; struct stat st; + int fd; for (argc=0,carg=ectx->cargv; *carg; carg++) argc++; @@ -294,7 +296,31 @@ static int slbt_exec_link_adjust_argument_vector( } /* argument translation */ - if (**carg == '-') { + mark = *carg; + + if ((mark[0] == '-') && (mark[1] == 'L')) { + if (mark[2]) { + ldir = &mark[2]; + } else { + *aarg++ = *carg++; + ldir = *carg; + } + + mark = ldir + strlen(ldir); + + if (mark[-1] == '/') + strcpy(mark,".libs"); + else + strcpy(mark,"/.libs"); + + if ((fd = open(ldir,O_DIRECTORY,0)) < 0) + *mark = 0; + else + close(fd); + + *aarg++ = *carg++; + + } else if (**carg == '-') { *aarg++ = *carg++; } else if (!(dot = strrchr(*carg,'.'))) { |