gkrellm/server/configure

73 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

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
exec 5>./configure.log
2008-02-01 21:36:15 +03:00
CC=${CC-gcc}
echo "CC : ${CC}" 1>& 5
echo "CFLAGS: ${CFLAGS}" 1>& 5
2008-02-01 21:36:15 +03:00
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
$CC ${CFLAGS} -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 ]
2008-02-01 21:36:15 +03:00
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