diff --git a/configure.ac b/configure.ac index 7ee06d3b5..4e6f97d14 100644 --- a/configure.ac +++ b/configure.ac @@ -209,18 +209,24 @@ AC_SUBST(PPPD_PLUGIN_DIR, "$PPPD_PLUGIN_DIR", [The pppd plugin directory]) AC_ARG_WITH([runtime-dir], AS_HELP_STRING([--with-runtime-dir=DIR],[Specify the runtime directory for pppd])) AS_IF([test -n "$with_runtime_dir"], - [PPPD_RUNTIME_DIR="$with_runtime_dir"], - [PPPD_RUNTIME_DIR="${runstatedir}/pppd"]) -AC_SUBST(PPPD_RUNTIME_DIR) + [PPPD_RUNTIME_DIR="$with_runtime_dir"; + AC_DEFINE_UNQUOTED(PPPD_RUNTIME_DIR, "$PPPD_RUNTIME_DIR", [The pppd runtime directory])]) # -# Specify runtime directory +# Specify lock directory +AC_ARG_WITH([lock-dir], + AS_HELP_STRING([--with-lock-dir=DIR],[Specify the lock directory for pppd])) +AS_IF([test -n "$with_lock_dir"], + [PPPD_LOCK_DIR="$with_lock_dir"; + AC_DEFINE_UNQUOTED(PPPD_LOCK_DIR, "$PPPD_LOCK_DIR", [The pppd lock directory])]) + +# +# Specify logfile directory AC_ARG_WITH([logfile-dir], AS_HELP_STRING([--with-logfile-dir=DIR],[Specify the log directory for pppd])) AS_IF([test -n "$with_logfile_dir"], - [PPPD_LOGFILE_DIR="$with_logfile_dir"], - [PPPD_LOGFILE_DIR="${localstatedir}/log/ppp"]) -AC_SUBST(PPPD_LOGFILE_DIR) + [PPPD_LOGFILE_DIR="$with_logfile_dir"]; + AC_DEFINE_UNQUOTED(PPPD_LOGFILE_DIR, "$PPPD_LOGFILE_DIR", [The pppd logfile directory])]) # # System CA certificates path @@ -410,8 +416,9 @@ Setting up SunOS kernel module(s)" echo " $PACKAGE_NAME version $PACKAGE_VERSION Prefix...............: $prefix - Runtime Dir..........: $PPPD_RUNTIME_DIR - Logfile Dir..........: $PPPD_LOGFILE_DIR + Runtime Dir..........: ${PPPD_RUNTIME_DIR:-system default} + Lock Dir.............: ${PPPD_LOCK_DIR:-system default} + Logfile Dir..........: ${PPPD_LOGFILE_DIR:-system default} Plugin Dir...........: $PPPD_PLUGIN_DIR System CA Path ......: ${SYSTEM_CA_PATH:-not set} With OpenSSL.........: ${with_openssl:-yes} diff --git a/pppd/Makefile.am b/pppd/Makefile.am index e5bedf26a..6971cbb10 100644 --- a/pppd/Makefile.am +++ b/pppd/Makefile.am @@ -83,7 +83,7 @@ pppd_SOURCES = \ upap.c \ utils.c -pppd_CPPFLAGS = -DSYSCONFDIR=\"${sysconfdir}\" -DLOCALSTATEDIR=\"${localstatedir}\" -DPPPD_RUNTIME_DIR='"@PPPD_RUNTIME_DIR@"' -DPPPD_LOGFILE_DIR='"@PPPD_LOGFILE_DIR@"' +pppd_CPPFLAGS = -DSYSCONFDIR=\"${sysconfdir}\" -DLOCALSTATEDIR=\"${localstatedir}\" pppd_LDFLAGS = pppd_LIBS = diff --git a/pppd/pathnames.h b/pppd/pathnames.h index de2fb6889..29e2ce1d0 100644 --- a/pppd/pathnames.h +++ b/pppd/pathnames.h @@ -37,10 +37,14 @@ * sysconfdir is ${prefix}/etc. Setting prefix to /usr, you'll have to override * sysconfdir with /etc to avoid installing config files into /usr/etc. * - * In addition, there are three explicit variables that has overrides via configure: - * - PPPD_RUNTIME_DIR, set by --with-runtime-dir= - * - PPPD_LOGFILE_DIR, set by --with-logfile-dir= - * - PPPD_PLUGIN_DIR, set by --with-plugin-dir= + * In addition, there are explicit variables that have overrides via configure: + * - SYSCONFDIR, set by --sysconfdir= or its platform default + * - LOCALSATEDIR, set by --localstatedir= or its platform default + * - PPPD_RUNTIME_DIR, set by --with-runtime-dir= or undef + * - PPPD_LOCK_DIR, set by --with-lock-dir= or undef + * - PPPD_LOGFILE_DIR, set by --with-logfile-dir= or undef + * If pppd is built with plugins, additionally: + * - PPPD_PLUGIN_DIR, set by --with-plugin-dir= or its platform default */ #ifndef PPP_PATHNAMES_H #define PPP_PATHNAMES_H @@ -59,22 +63,39 @@ /* * PPPD_RUNTIME_DIR is set by passing --with-runtime-dir= via configure - * the default value set by configure when option is absent is ${localstatedir}/run/pppd */ #ifdef PPPD_RUNTIME_DIR #define PPP_PATH_VARRUN PPPD_RUNTIME_DIR #else -#define PPP_PATH_VARRUN _PATH_VARRUN +#define PPP_PATH_VARRUN _PATH_VARRUN "/pppd" +#endif + +/* + * PPPD_LOCK_DIR is set by passing --with-lock-dir= via configure + */ +#ifdef PPPD_LOCK_DIR +#define PPP_PATH_LOCKDIR PPPD_LOCK_DIR +#else +#ifdef __linux__ +#define PPP_PATH_LOCKDIR LOCALSTATEDIR "/lock" +#else +#ifdef SVR4 +#define PPP_PATH_LOCKDIR LOCALSTATEDIR "/spool/locks" +#else +#define PPP_PATH_LOCKDIR LOCALSTATEDIR "/spool/lock" +#endif +#endif + + #endif /* * PPPD_LOGFILE_DIR is set by passing --with-logfile-dir= via configure - * the default value set by configure when option is absent is ${localstatedir}/log/ppp */ #ifdef PPPD_LOGFILE_DIR #define PPP_PATH_VARLOG PPPD_LOGFILE_DIR #else -#define PPP_PATH_VARLOG _PATH_VARRUN "/log/ppp" +#define PPP_PATH_VARLOG LOCALSTATEDIR "log/ppp" #endif /* @@ -119,15 +140,4 @@ #define PPP_PATH_PPPDB PPP_PATH_VARRUN "/pppd2.tdb" -#ifdef __linux__ -#define PPP_PATH_LOCKDIR PPP_PATH_VARRUN "/lock" -#else -#ifdef SVR4 -#define PPP_PATH_LOCKDIR LOCALSTATEDIR "/spool/locks" -#else -#define PPP_PATH_LOCKDIR LOCALSTATEDIR "/spool/lock" -#endif -#endif - - #endif /* PPP_PATHNAMES_H */ diff --git a/pppd/pppdconf.h.in b/pppd/pppdconf.h.in index 9fb6f4b0f..a98d2d8d3 100644 --- a/pppd/pppdconf.h.in +++ b/pppd/pppdconf.h.in @@ -76,4 +76,13 @@ /* The pppd version */ #undef PPPD_VERSION +/* runtime dir as per configure's --with-runtime-dir */ +#undef PPPD_RUNTIME_DIR + +/* lock dir as per configure's --with-lock-dir */ +#undef PPPD_LOCK_DIR + +/* logfile dir as per configure's --with-logfile-dir */ +#undef PPPD_LOGFILE_DIR + #endif