2008-02-01 21:36:15 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Configure some things for gkrellmd when make is run.
|
|
|
|
# This configure is run automatically so no need to run it by hand.
|
|
|
|
#
|
2009-12-26 20:08:15 +03:00
|
|
|
# Copyright (C) 2006-2009 Bill Wilson
|
2008-02-01 21:36:15 +03:00
|
|
|
|
|
|
|
for i
|
|
|
|
do
|
|
|
|
if [ "$i" = "--without-libsensors" ]
|
|
|
|
then
|
|
|
|
without_libsensors=yes
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2009-12-26 20:08:15 +03:00
|
|
|
#if SENSORS_API_VERSION < 0x400 /* libsensors 3 code */
|
|
|
|
FILE *f;
|
|
|
|
|
2008-02-01 21:36:15 +03:00
|
|
|
f = fopen("/etc/sensors.conf", "r");
|
|
|
|
if (!f)
|
|
|
|
return 1;
|
|
|
|
if (sensors_init(f) != 0)
|
|
|
|
return 1;
|
|
|
|
fclose(f);
|
|
|
|
return 0;
|
2009-12-26 20:08:15 +03:00
|
|
|
#else /* libsensors 4 code */
|
|
|
|
if (sensors_init(NULL) != 0)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
#endif
|
2008-02-01 21:36:15 +03:00
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2014-08-23 20:11:20 +04:00
|
|
|
$CC -c test.c -o test.o 2>& 5
|
|
|
|
$CC test.o -o test -lsensors 2>& 5
|
2008-02-01 21:36:15 +03:00
|
|
|
|
|
|
|
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
|