-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
57 lines (47 loc) · 2.21 KB
/
configure.ac
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([delux.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_FUNC_MALLOC
# Check if udevadm is in path. We need this to autoconfig
# the path to the sensor
AC_DEFUN(AC_PROG_UDEVADM, [AC_CHECK_PROG(UDEVADM,udevadm,yes)])
AC_PROG_UDEVADM
if test x"${UDEVADM}" == x"yes" ; then
AC_MSG_RESULT([Using udev to detect hardware device paths])
# Let the program know we auto-configured
AC_DEFINE_UNQUOTED([UDEV], [1], [Auto-detection of hardware was used])
#Check if hardware paths exist
if test ! -e "/sys/class/backlight"; then
AC_MSG_WARN([No backlight device found. Unable to autoconfigure, using manual.])
AC_DEFINE_UNQUOTED([UDEV], [0], [Auto-detection of hardware failed])
else
SCREEN=`udevadm info --export-db | grep backlight | grep DEVPATH | awk -F "/" '{print $NF}'`
screenpath="/sys/class/backlight/$SCREEN/brightness"
maxbrightdev="/sys/class/backlight/$SCREEN/max_brightness"
AC_DEFINE_UNQUOTED([SCRNPATH], ["$screenpath"], [The path to the backlight device])
AC_DEFINE_UNQUOTED([MAXBRIGHTDEV], ["$maxbrightdev"], [The maximum brightness registered by the ALS])
fi
if test ! -e "/sys/bus/iio/devices"; then
AC_MSG_WARN([No sensor device found. Unable to autoconfigure, using manual.])
AC_DEFINE_UNQUOTED([UDEV], [0], [Auto-detection of hardware failed])
else
SENS=`udevadm info --export-db | grep iio | grep DEVPATH | awk -F "/" '{print $NF}'`
sensorpath="/sys/bus/iio/devices/$SENS/in_illuminance0_input"
AC_DEFINE_UNQUOTED([SENSPATH], ["$sensorpath"], [Path to kernel device for sensor if direct hw access])
fi
else
AC_MSG_WARN([udevadm needed to auto-configure device paths. Falling back to manual.])
fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT