Use default config file when none is provided

Add config option to set a default config file path. If
none given, the default config file path is /etc/clixon.xml.
This commit is contained in:
Matthew Smith 2018-01-14 21:25:17 -06:00
parent 363bd5d19d
commit 6a9697c2ff
4 changed files with 32 additions and 2 deletions

View file

@ -161,6 +161,12 @@ if test "x${with_keyvalue}" == xyes; then
AC_CONFIG_FILES(datastore/keyvalue/Makefile)
fi
# Set default config file location
AC_ARG_WITH([configfile],
[AS_HELP_STRING([--with-configfile],[set default path to config file])],
[DEFAULT_CONFIG="$withval"],
[DEFAULT_CONFIG="/etc/clixon.xml"])
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_HEADERS(crypt.h)
@ -182,6 +188,9 @@ AC_CHECK_FUNCS(inet_aton sigaction sigvec strlcpy strsep strndup alphasort versi
# same as clixon_DATADIR defined in clixon.mk.cpp for Makefiles
AC_DEFINE_UNQUOTED(CLIXON_DATADIR, "${prefix}/share/clixon", [Clixon data dir for system yang files etc])
# Default location for config file
AC_DEFINE_UNQUOTED(CLIXON_DEFAULT_CONFIG,"${DEFAULT_CONFIG}",[Location for apps to find default config file])
AH_BOTTOM([#include <clixon_custom.h>])
# See also datastore/keyvalue/Makefile in with_keyvalue clause above