12c0dd7b6SThomas Monjalon#! /bin/sh 22c0dd7b6SThomas Monjalon# SPDX-License-Identifier: BSD-3-Clause 32c0dd7b6SThomas Monjalon# 42c0dd7b6SThomas Monjalon# Print link options -l for static link of ibverbs. 52c0dd7b6SThomas Monjalon# 62c0dd7b6SThomas Monjalon# Static flavour of ibverbs and the providers libs are explicitly picked, 72c0dd7b6SThomas Monjalon# thanks to the syntax -l:libfoo.a 82c0dd7b6SThomas Monjalon# Other libs (pthread and nl) are unchanged, i.e. linked dynamically by default. 92c0dd7b6SThomas Monjalon# 102c0dd7b6SThomas Monjalon# PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. 112c0dd7b6SThomas Monjalon 12*2cca6031SThomas Monjalonlib='libibverbs' 13*2cca6031SThomas Monjalondeps='pthread|nl' 14*2cca6031SThomas Monjalon 15*2cca6031SThomas Monjalonpkg-config --libs --static $lib | 162c0dd7b6SThomas Monjalon tr '[:space:]' '\n' | 17*2cca6031SThomas Monjalon sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," | # explicit .a 18*2cca6031SThomas Monjalon sed -n '/^-[Ll]/p' | # extra link options may break with make 19*2cca6031SThomas Monjalon tac | 20*2cca6031SThomas Monjalon awk "/^-l:$lib.a/&&c++ {next} 1" | # drop first duplicates of main lib 21*2cca6031SThomas Monjalon tac 22