File: configure

package info (click to toggle)
gkrellm 2.3.5-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,552 kB
  • sloc: ansic: 56,915; makefile: 729; sh: 264
file content (73 lines) | stat: -rwxr-xr-x 1,273 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

# Configure some things for gkrellmd when make is run.
# This configure is run automatically so no need to run it by hand.
#
# Copyright (C) 2006-2009  Bill Wilson

for i
do
	if [ "$i" = "--without-libsensors" ]
	then
		without_libsensors=yes
	fi
done

PKG_INCLUDE=`pkg-config gtk+-2.0 --cflags`
PKG_LIB=`pkg-config gtk+-2.0 --libs`

rm -f configure.h configure.log test test.o test.c

touch configure.h

CC=${CC-gcc}

exec 5>./configure.log

if [ "$without_libsensors" != "yes" ]
then
echo "Checking for libsensors... " 1>& 5

cat << EOF > test.c
#include <stdio.h>
#include <sensors/sensors.h>

int main()
	{
	FILE	*f;

#if SENSORS_API_VERSION < 0x400 /* libsensors 3 code */
	FILE	*f;

	f = fopen("/etc/sensors.conf", "r");
	if (!f)
		return 1;
	if (sensors_init(f) != 0)
		return 1;
	fclose(f);
	return 0;
#else /* libsensors 4 code */
	if (sensors_init(NULL) != 0)
		return 1;
	return 0;
#endif
	}
EOF

$CC ${PKG_INCLUDE} -c test.c -o test.o 2>& 5
$CC test.o -o test ${PKG_LIBS} -lsensors 2>& 5

if [ -x ./test ] && ./test
then
	echo 'Defining HAVE_LIBSENSORS' 1>& 5
	echo '#define HAVE_LIBSENSORS 1' >> configure.h
else
	echo "Not found, sensors will not have libsensors support..." 1>& 5
fi
fi
# end of libsensors check


rm -f test test.o test.c

exit 0