File: check-bfd.sh

package info (click to toggle)
skyeye 1.2.5-4
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,236 kB
  • ctags: 19,345
  • sloc: ansic: 90,379; sh: 5,188; python: 707; cpp: 417; makefile: 322; exp: 38
file content (53 lines) | stat: -rw-r--r-- 888 bytes parent folder | download | duplicates (4)
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
#!/bin/sh
#
# Written by Anthony Lee 2007.03
#

printf "Checking bfd library ... "

case $CC in
	*gcc*)
		;;
	*)
		# other compiler, should be checked manually.
		printf "IGNORE\n"
		exit 0
		;;
esac

SRC="
#include <stdlib.h>
#include <bfd.h>
int main(int argc, char **argv)
{
	bfd *abfd = bfd_openr(NULL, NULL);
	return 0;
}
"

PROG="check-bfd"
OBJECT="${BINARY_DIR}${PROG}.o"
TARGET="${BINARY_DIR}${PROG}${SUFFIX}"
ERR_MESSAGE="*** It seems that you don't have bfd library.
*** Run \"make NO_BFD=1\" instead to ignore it."

if ! ( echo "$SRC" | $CC $EXTRA_CFLAGS -o "$OBJECT" -c -x c - > /dev/null 2>&1 ); then
	printf "FAILED\n\n"
	printf "$ERR_MESSAGE\n\n"
	exit 1
fi

if ! ( $CC -o "$TARGET" "$OBJECT" $BFD_LIBS $EXTRA_LIBS > /dev/null 2>&1 ); then
	printf "FAILED\n\n"
	printf "$ERR_MESSAGE\n\n"
	rm -f "$OBJECT"
	exit 1
fi

rm -f "$OBJECT"
rm -f "$TARGET"

printf "OK\n"

exit 0