diff options
author | Omar Polo <op@omarpolo.com> | 2024-01-11 13:17:44 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2024-01-11 13:17:44 +0000 |
commit | 0d5282b6475a30a3f39559c67a1504cc7c6930ea (patch) | |
tree | c55d824f09766fae50a1c003e6a9c7ad1007af25 | |
parent | e78e2923eaefdd50c60a603502dd43f58b16e47e (diff) |
configure: add --sysconfdir / $SYSCONFDIR handling
so that we don't have to hardcode /etc in gmid.c. Helps on systems
like FreeBSD where the non-base programs are expected to look for
their config in /usr/local/etc.
-rwxr-xr-x | configure | 7 | ||||
-rw-r--r-- | gmid.c | 2 |
2 files changed, 8 insertions, 1 deletions
@@ -50,6 +50,7 @@ fi INSTALL=${INSTALL-install} PREFIX=${PREFIX-/usr/local} +SYSCONFDIR=${SYSCONFDIR-/etc} CDIAGFLAGS= CDIAGFLAGS="${CDIAGFLAGS} -W -Wall -Wextra -Wpointer-arith -Wuninitialized" @@ -100,6 +101,7 @@ while [ $# -gt 0 ]; do --bindir) key=BINDIR ;; --mandir) key=MANDIR ;; --prefix) key=PREFIX ;; + --sysconfdir) key=SYSCONFDIR ;; --with-libtls) key=LIBTLS ;; esac @@ -120,6 +122,7 @@ while [ $# -gt 0 ]; do LDFLAGS) LDFLAGS="$val" ;; PKG_CONFIG) PKG_CONFIG="$val" ;; PREFIX) PREFIX="$val" ;; + SYSCONFDIR) SYSCONFDIR="$val" ;; YACC) YACC="$val" ;; *) usage esac @@ -437,6 +440,10 @@ cat <<__HEREDOC__ #define DISABLE_SANDBOX ${DISABLE_SANDBOX} #define HAVE_LANDLOCK ${HAVE_LANDLOCK} +#ifndef SYSCONFDIR +# define SYSCONFDIR "${SYSCONFDIR}" +#endif + __HEREDOC__ if [ ${HAVE_ENDIAN_H} -eq 1 ]; then @@ -68,7 +68,7 @@ int pidfd = -1; int debug, verbose; -const char *config_path = "/etc/gmid.conf"; +const char *config_path = SYSCONFDIR "/gmid.conf"; const char *pidfile; static void |