@@ -1510,6 +1510,7 @@ function mkl_lib_check_static {
1510
1510
#
1511
1511
# Arguments:
1512
1512
# [--override-action=<action>] (internal use, overrides action argument)
1513
+ # [--no-static] (do not attempt to link the library statically)
1513
1514
# [--libname=<lib>] (library name if different from config name, such as
1514
1515
# when the libname includes a dash)
1515
1516
# config name (library name (for pkg-config))
@@ -1521,19 +1522,27 @@ function mkl_lib_check_static {
1521
1522
function mkl_lib_check0 {
1522
1523
1523
1524
local override_action=
1524
- if [[ $1 == --override-action= * ]]; then
1525
- override_action=${1#* =}
1526
- shift
1527
- fi
1528
-
1529
- local staticopt=$( mkl_meta_get $1 " static" " " )
1530
-
1525
+ local nostaticopt=
1531
1526
local libnameopt=
1532
- local libname=$1
1533
- if [[ $1 == --libname* ]]; then
1534
- libnameopt=$1
1535
- libname=" ${libnameopt#* =} "
1527
+ local libname=
1528
+
1529
+ while [[ $1 == --* ]]; do
1530
+ if [[ $1 == --override-action= * ]]; then
1531
+ override_action=${1#* =}
1532
+ elif [[ $1 == --no-static ]]; then
1533
+ nostaticopt=$1
1534
+ elif [[ $1 == --libname* ]]; then
1535
+ libnameopt=$1
1536
+ libname=" ${libnameopt#* =} "
1537
+ else
1538
+ mkl_err " mkl_lib_check: invalid option $1 "
1539
+ exit 1
1540
+ fi
1536
1541
shift
1542
+ done
1543
+
1544
+ if [[ -z $libname ]]; then
1545
+ libname=$1
1537
1546
fi
1538
1547
1539
1548
local action=$3
@@ -1546,13 +1555,16 @@ function mkl_lib_check0 {
1546
1555
if [[ $WITH_PKGCONFIG == " y" ]]; then
1547
1556
# Let pkg-config populate CFLAGS, et.al.
1548
1557
# Return on success.
1549
- mkl_pkg_config_check $libnameopt " $1 " " $2 " cont " $4 " " $6 " && return $?
1558
+ mkl_pkg_config_check $nostaticopt $ libnameopt " $1 " " $2 " cont " $4 " " $6 " && return $?
1550
1559
fi
1551
1560
1552
1561
local libs=" $5 "
1553
- local stlibs=$( mkl_lib_check_static $1 " $libs " )
1554
- if [[ -n $stlibs ]]; then
1555
- libs=$stlibs
1562
+
1563
+ if [[ -z $nostaticopt ]]; then
1564
+ local stlibs=$( mkl_lib_check_static $1 " $libs " )
1565
+ if [[ -n $stlibs ]]; then
1566
+ libs=$stlibs
1567
+ fi
1556
1568
fi
1557
1569
1558
1570
if ! mkl_compile_check " $1 " " $2 " " $action " " $4 " " $libs " " $6 " ; then
@@ -1606,7 +1618,7 @@ function mkl_lib_check {
1606
1618
# being used is in-fact from the dependency builder (if supported),
1607
1619
# rather than a system installed alternative, so skip the pre-check and
1608
1620
# go directly to dependency installation/build below.
1609
- if [[ $MKL_SOURCE_DEPS_ONLY != y ]] || ! mkl_dep_has_builder $1 ; then
1621
+ if [[ $MKL_SOURCE_DEPS_ONLY != y ]] || ! mkl_dep_has_builder $name ; then
1610
1622
mkl_lib_check0 --override-action=cont " $1 " " $2 " " $3 " " $4 " " $5 " " $6 " " $7 " " $8 "
1611
1623
retcode=$?
1612
1624
if [[ $retcode -eq 0 ]]; then
@@ -1632,6 +1644,7 @@ function mkl_lib_check {
1632
1644
# Check for library with pkg-config
1633
1645
# Automatically sets CFLAGS and LIBS from pkg-config information.
1634
1646
# Arguments:
1647
+ # [--no-static] (do not attempt to link the library statically)
1635
1648
# [--libname=<lib>] (library name if different from config name, such as
1636
1649
# when the libname includes a dash)
1637
1650
# config name
@@ -1641,6 +1654,12 @@ function mkl_lib_check {
1641
1654
# source snippet
1642
1655
function mkl_pkg_config_check {
1643
1656
1657
+ local nostaticopt=
1658
+ if [[ $1 == --no-static ]]; then
1659
+ nostaticopt=$1
1660
+ shift
1661
+ fi
1662
+
1644
1663
local libname=$1
1645
1664
if [[ $1 == --libname* ]]; then
1646
1665
libname=" ${libnameopt#* =} "
@@ -1697,9 +1716,11 @@ $cflags"
1697
1716
1698
1717
mkl_mkvar_append $1 " CFLAGS" " $cflags "
1699
1718
1700
- local stlibs=$( mkl_lib_check_static $1 " $libs " )
1701
- if [[ -n $stlibs ]]; then
1702
- libs=$stlibs
1719
+ if [[ -z $nostaticopt ]]; then
1720
+ local stlibs=$( mkl_lib_check_static $1 " $libs " )
1721
+ if [[ -n $stlibs ]]; then
1722
+ libs=$stlibs
1723
+ fi
1703
1724
fi
1704
1725
1705
1726
mkl_dbg " $1 : from pkg-config: LIBS: prepend $libs "
0 commit comments