+AC_ARG_WITH(systemdenvfile,
+ [AS_HELP_STRING([--with-systemdenvfile@<:@=FILE|auto|yes|no@:>@], [Path of systemd EnvironmentFile [auto]])],
+ [], [with_systemdenvfile=auto])
+
+systemdenvfile=
+case "$with_systemdenvfile:$cross_compiling:$systemdsystemunitdir" in
+ auto:no:?*|yes:*:?*)
+ AC_MSG_CHECKING([for path of systemd EnvironmentFile])
+ for dir in sysconfig default; do
+ if test -d /etc/$dir; then
+ systemdenvfile='${sysconfdir}'/$dir/smartmontools
+ break
+ fi
+ done
+ AC_MSG_RESULT([${systemdenvfile:-no}])
+ case "$with_systemdenvfile:$systemdenvfile" in
+ yes:) AC_MSG_ERROR([Path of systemd EnvironmentFile not found]) ;;
+ esac ;;
+ auto:*|no:*) ;;
+ *:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
+ *) systemdenvfile="$with_systemdenvfile"
+esac
+AC_SUBST(systemdenvfile)
+