commit:     2d6f89d8646178917eb87db94fd710f68f304e3d
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 13 22:27:12 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Dec 14 00:05:40 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=2d6f89d8

gen_funcs.sh: Add is_glibc() function

This function will allow to detect if CHOST is using glibc
or not.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_funcs.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gen_funcs.sh b/gen_funcs.sh
index 32d367e..87e4b3a 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -225,6 +225,20 @@ has_space_characters() {
        echo "${has_space_characters}"
 }
 
+is_glibc() {
+       if ! hash getconf &>/dev/null
+       then
+               gen_die "getconf not found. Unable to determine libc 
implementation!"
+       fi
+
+       local is_glibc=no
+
+       getconf GNU_LIBC_VERSION &>/dev/null
+       [ $? -eq 0 ] && is_glibc=yes
+
+       echo "${is_glibc}"
+}
+
 is_gzipped() {
        [[ ${#} -ne 1 ]] \
                && gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid 
usage of ${FUNCNAME}(): Function takes exactly one argument (${#} given)!"

Reply via email to