123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. AC_INIT([light], [1.2], [https://github.com/haikarainen/light/issues])
  2. AM_INIT_AUTOMAKE([1.11 foreign subdir-objects])
  3. AM_SILENT_RULES([yes])
  4. AC_CONFIG_SRCDIR([src/light.c])
  5. AC_CONFIG_HEADER([config.h])
  6. AC_CONFIG_FILES([Makefile src/Makefile])
  7. AC_PROG_CC
  8. AC_PROG_INSTALL
  9. AC_HEADER_STDC
  10. AC_ARG_WITH([udev],
  11. AS_HELP_STRING([--with-udev@<:@=PATH@:>@], [use udev instead of SUID root, optional rules.d path]),
  12. [udev=$withval], [udev=no])
  13. AC_ARG_WITH([systemd],
  14. AS_HELP_STRING([--with-systemd], [use systemd-logind for unprivileged brightness changes]),
  15. [], [systemd=no])
  16. AC_ARG_WITH([elogind],
  17. AS_HELP_STRING([--with-elogind], [use elogind for unprivileged brightness changes]),
  18. [], [elogind=no])
  19. AC_MSG_CHECKING(for udev rules.d)
  20. AS_IF([test "x$udev" != "xno"], [
  21. AS_IF([test "x$udev" = "xyes"], [
  22. udevdir="\${prefix}/lib/udev/rules.d"
  23. ],[
  24. udevdir="$udev"
  25. ])
  26. AC_SUBST(udevdir)
  27. AC_MSG_RESULT([$udevdir])
  28. ],[
  29. AC_MSG_RESULT([disabled, classic SUID root mode])
  30. ])
  31. AC_MSG_CHECKING(for systemd)
  32. AS_IF([test "x$systemd" != "xno"], [
  33. AC_CHECK_LIB([systemd], [sd_bus_call_method])
  34. ],[
  35. AC_MSG_RESULT([disabled])
  36. ])
  37. AC_MSG_CHECKING(for elogind)
  38. AS_IF([test "x$elogind" != "xno"], [
  39. AC_CHECK_LIB([elogind], [sd_bus_call_method])
  40. ],[
  41. AC_MSG_RESULT([disabled])
  42. ])
  43. # Allow classic SUID root behavior if udev rule is not used
  44. AM_CONDITIONAL(UDEV, [test "x$udev" != "xno"])
  45. AM_CONDITIONAL(CLASSIC, [test "x$udev" = "xno"])
  46. AC_OUTPUT