diff --git a/chocpkg/modules.sh b/chocpkg/modules.sh index acb0ad5..1283c05 100644 --- a/chocpkg/modules.sh +++ b/chocpkg/modules.sh @@ -21,6 +21,10 @@ check_pkgconfig() { install_module check_pkgconfig "$@" } +check_library() { + install_module check_library "$@" +} + check_tool() { install_module check_tool "$@" } diff --git a/chocpkg/modules/check_library.sh b/chocpkg/modules/check_library.sh new file mode 100644 index 0000000..91b8338 --- /dev/null +++ b/chocpkg/modules/check_library.sh @@ -0,0 +1,14 @@ + +check_library::init() { + PACKAGE_INSTALLED_LIB=$1 +} + +# Function that returns true if a specified C library is installed. +do_check() { + # TODO: A better way to choose compiler command? + ${CC:-gcc} \ + -l$PACKAGE_INSTALLED_LIB $LDFLAGS \ + -o/dev/null \ + -x c <( echo "int main() {}") +} +