/usr/bin/mkc_check_funclib is in mk-configure 0.25.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | #!/bin/sh
############################################################
# Copyright (c) 2009-2010 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
############################################################
set -e
LC_ALL=C
export LC_ALL
##################################################
# options
usage (){
cat <<EOF
mkc_check_funclib detects presense of function in a library
by compiling and linking a test program.
Usage: mkc_check_funclib [OPTIONS] function [libraries...]
OPTIONS:
-h display this help
-d delete cache files
Examples:
mkc_check_funclib dlopen dl
mkc_check_funclib dlopen
mkc_check_funclib strlcpy
mkc_check_funclib select socket
EOF
}
if test $# -eq 0; then
usage
exit 1
fi
if test "_$1" = '_-h'; then
usage
exit 0
fi
if test "_$1" = '_-d'; then
delcache=1
shift
fi
##################################################
# initializing
pathpart=funclib_`echo $* | tr '/. ' ___`
funcname=$1
shift
. mkc_check_common.sh
for i in "$@"; do
LDADD="$LDADD -l$i"
libs_msg="$libs_msg -l$i"
done
if test -n "$libs_msg"; then
libs_msg=" ($libs_msg )"
fi
##################################################
# test
check_itself (){
# preparations
if test "$funcname" = main; then
fname=__fake__
else
fname="$funcname"
fi
cat > "$tmpc" <<EOF
static void __fake__ () {}
void $fname ();
int main ()
{
$fname ();
return 0;
}
EOF
# test itself
if $CC -o "$tmpexe" "$tmpc" $LDFLAGS $LDADD 2>"$tmperr"; then
echo 1
else
# SunPro may leave object files in current directory.
# We need not this garbage. Also we cannot use smart shell
# expansions because of crappy Solaris' /bin/sh.
tmpbase=`basename "$tmpc" | sed 's/[.][^.]*$//'`
rm -f ${tmpbase}.o
echo 0
fi
}
check_and_cache "checking for function ${funcname}${libs_msg}" "$cache" "$@"
##################################################
# clean-ups
cleanup
##################################################
# finishing
if test "$ret" -eq 1; then
printme 'yes\n' 1>&2
else
printme 'no\n' 1>&2
fi
echo $ret
|