{"name":"buildcheck","version":"0.0.2","author":{"name":"Brian White","email":"mscdex@mscdex.net"},"description":"Build environment checking (a la autoconf) for node.js","main":"./lib/index.js","engines":{"node":">=10.0.0"},"devDependencies":{"@mscdex/eslint-config":"^1.1.0","eslint":"^7.0.0"},"scripts":{"lint":"eslint --cache --report-unused-disable-directives --ext=.js .eslintrc.js lib","lint:fix":"npm run lint -- --fix"},"keywords":["build","autoconf","addons","compiler","environment"],"licenses":[{"type":"MIT","url":"http://github.com/mscdex/buildcheck/raw/master/LICENSE"}],"repository":{"type":"git","url":"git+ssh://git@github.com/mscdex/buildcheck.git"},"_resolved":"","_integrity":"","_from":"https://github.com/mscdex/buildcheck/tarball/v0.0.2","bugs":{"url":"https://github.com/mscdex/buildcheck/issues"},"homepage":"https://github.com/mscdex/buildcheck#readme","_id":"buildcheck@0.0.2","_nodeVersion":"10.22.1","_npmVersion":"6.14.6","dist":{"integrity":"sha512-V8jsKuMjGyUR6vDqIEKEUwzA44RYLdShqvwQt1bimI3RfLYDfvvbD+kjL+ZlaVH7epmxQHx2HflkfmH+5ipxIA==","shasum":"db0ae2d4067b1c91618fc6b470eae235ff17cc96","tarball":"http://registry-npm.ywwl.com/buildcheck/download/buildcheck-0.0.2.tgz","fileCount":14,"unpackedSize":42188,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCd77KwnvB1TBuyq8AQ/EBRlJad4N8SoKJasRepm8MOPwIhAJtriPyIZ5h5RAq43d9ArmZOU9Ii7K0a5CL7wJwiCY4B"}],"size":12293,"noattachment":false,"key":"/buildcheck/-/buildcheck-0.0.2.tgz"},"_npmUser":{"name":"mscdex","email":"mscdex@mscdex.net"},"directories":{},"maintainers":[{"name":"mscdex","email":"mscdex@mscdex.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buildcheck_0.0.2_1634871484977_0.3103629551650462"},"_hasShrinkwrap":false,"readme":"# Description\n\nBuild environment checking for [node.js](http://nodejs.org/).\n\nThis allows for autoconf-like functionality for node addons/build scripts.\n\n**Note:** Obsolete and/or exotic build environments or platforms not supported\nby node.js are not supported.\n\n## Requirements\n\n* [node.js](http://nodejs.org/) -- v10.0.0 or newer\n* Supported compilers:\n  * gcc\n  * clang\n  * MSVC 2013+ and Windows SDK 8.1+\n\n## Installation\n\n    npm install buildcheck\n\n## Examples\n\n### Check if a C function exists\n\n```js\n'use strict';\n\nconst BuildEnvironment = require('buildcheck');\n\nconst buildEnv = new BuildEnvironment();\n\nconsole.log(buildEnv.checkFunction('c', 'preadv2'));\n```\n\n### Check if a C header is usable\n\n```js\n'use strict';\n\nconst BuildEnvironment = require('buildcheck');\n\nconst buildEnv = new BuildEnvironment();\n\nconsole.log(buildEnv.checkHeader('c', 'linux/io_uring.h'));\n```\n\n### Try to compile some C code\n\n```js\n'use strict';\n\nconst BuildEnvironment = require('buildcheck');\n\nconst buildEnv = new BuildEnvironment();\n\n// Should be a successful compile\nconsole.log(buildEnv.tryCompile('c', 'int main() { return 0; }'));\n\n// Should be a failed compile\nconsole.log(buildEnv.tryCompile('c', 'int main() { return z; }'));\n```\n\n## API\n\n### Exports\n\nThe exported value is `BuildEnvironment`, the main class for dealing with a build environment.\n\n### BuildEnvironment\n\n#### Methods\n\n* **(constructor)**([< _object_ >config]) - Creates and returns a new BuildEnvironment instance. `config` may contain:\n\n  * **compilerC** - _string_ - C compiler command to use. *Note: this is ignored on Windows.* **Default:** `process.env.CC` or `'cc'`\n\n  * **compilerCXX** - _string_ - C++ compiler command to use. *Note: this is ignored on Windows.* **Default:** `process.env.CXX` or `'c++'`\n\n  * **msvs_version** - _mixed_ - A string or number containing the year of the Visual Studio compiler to use. *Note: this is for Windows only.* **Default:** newest version installed\n\n* **checkDeclared**(< _string_ >lang, < _string_ >symbolName[, < _object_ >options]) - _boolean_ - Checks if a symbol `symbolName` is declared where `lang` is either `'c'` or `'c++'`. Returns `true` if symbol exists, `false` otherwise. `options` may contain:\n\n  * **headers** - _array_ - A list of headers to try when checking if the symbol is declared. `checkFunction()` will always first try without a library. If not supplied, a default list of common (platform-specific) headers will be used.\n\n  * **searchLibs** - _array_ - A list of library names (without the `'-l'` prefix) to try when checking if the symbol is declared. `checkDeclared()` will always first try without a library.\n\n* **checkFunction**(< _string_ >lang, < _string_ >functionName[, < _object_ >options]) - _boolean_ - Checks if a function `functionName` exists and is linkable where `lang` is either `'c'` or `'c++'`. Returns `true` if function exists, `false` otherwise. `options` may contain:\n\n  * **searchLibs** - _array_ - A list of library names (without the `'-l'` prefix) to try when checking for this function. `checkFunction()` will always first try without a library.\n\n* **checkFeature**(< _string_ >featureName) - _mixed_ - Executes a special test for a \"feature\" and returns the result. Supported values for `featureName`:\n\n  * `'strerror_r'` - Returns an object containing:\n\n    * `declared` - _boolean_ - Whether `strerror_r()` is declared\n\n    * `returnsCharPtr` - _boolean_ - If `strerror_r()` is declared, whether it returns `char*` (a GNU extension) or not.\n\n* **checkHeader**(< _string_ >lang, < _string_ >headerName) - _boolean_ - Checks if the header `headerName` exists and is usable where `lang` is either `'c'` or `'c++'`. Returns `true` if the header exists and is usable, `false` otherwise.\n\n* **defines**([< _string_ >lang[, < _boolean_ >rendered]]) - _array_ - Returns a list of features, functions, headers, and symbols known to be defined by this build environment instance. `lang` is either `'c'` or `'c++'` If `lang` is not set, defines for both `'c'` and `'c++'` will be returned. If `rendered` is `true` (defaults to `false`), autoconf-style defines (e.g. \"HAVE_FOO=1\") will be returned instead. Defines coming from features utilize base strings/names from autoconf for better compatibility.\n\n* **libs**([< _string_ >lang]) - _array_ - Returns a list of (`'-l'`-prefixed) libraries known to be required for features and functions defined by this build environment instance. `lang` is either `'c'` or `'c++'` If `lang` is not set, defines for both `'c'` and `'c++'` will be returned.\n\n* **tryCompile**(< _string_ >lang, < _string_ >code[, < _array_ >compilerParams]) - _mixed_ - Attempts to compile `code` where `lang` is either `'c'` or `'c++'`. `compilerParams` is an optional array of compiler/linker flags to include. Returns `true` on successful compilation, or an _Error_ instance with an `output` property containing the compiler error output.\n","publish_time":1634871485145,"_cnpm_publish_time":1634871485145,"dist-tags":{"latest":"0.0.7"}}