diff --git a/config/ext.json b/config/ext.json index 7e4718e9..fab1d737 100644 --- a/config/ext.json +++ b/config/ext.json @@ -157,7 +157,11 @@ "mongodb": { "type": "external", "source": "mongodb", - "arg-type": "custom" + "arg-type": "custom", + "lib-suggests": [ + "icu", + "openssl" + ] }, "mysqli": { "type": "builtin", diff --git a/src/SPC/builder/extension/mongodb.php b/src/SPC/builder/extension/mongodb.php index 843ee39b..6214720d 100644 --- a/src/SPC/builder/extension/mongodb.php +++ b/src/SPC/builder/extension/mongodb.php @@ -12,6 +12,19 @@ class mongodb extends Extension { public function getUnixConfigureArg(): string { - return '--enable-mongodb --without-mongodb-sasl'; + $arg = '--enable-mongodb --without-mongodb-sasl'; + if ($this->builder->getLib('openssl')) { + $arg .= '--with-mongodb-system-libs=no --with-mongodb-ssl=openssl'; + } else { + // 禁用,否则链接的是系统库 + $arg .= ''; + } + if ($this->builder->getLib('icu')) { + $arg .= '--with-mongodb-system-libs=no --with-mongodb-ssl=openssl'; + } else { + // 禁用,否则链接的是系统库 + $arg .= ''; + } + return $arg; } }