blob: 9398c3a722a3df69d666b842a2b823b05f42dd8c (
plain)
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
|
#!/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_header detects presense of header file
by compiling a test program.
Usage: mkc_check_header [OPTIONS] header.h
Examples:
mkc_check_header stdint.h
mkc_check_header getopt.h
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=header_`echo $1 | tr /. __`
. mkc_check_common.sh
##################################################
# test
check_itself (){
cat > "$tmpc" <<EOF
#include <$1>
int main ()
{
return 0;
}
EOF
if $CC -c -o "${tmpo}" $CPPFLAGS $CFLAGS "${tmpc}" 2>"${tmperr}"
then
echo 1
else
echo 0
fi
}
check_and_cache "checking for header $1" "$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
|