From 9cd764f0310aeffdcd7c2cf42d46690a9493b5b8 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 7 Feb 2023 18:32:32 +0100 Subject: [PATCH] example/main: replace hard-coded path with variables from configure Signed-off-by: Joachim Wiberg --- configure | 13 +++++++++++++ configure.ac | 13 +++++++++++++ example/main/example.xml.in | 20 ++++++++++---------- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 6e9b4bcf..0d0694cf 100755 --- a/configure +++ b/configure @@ -633,6 +633,9 @@ ac_ct_CXX CXXFLAGS CXX CPP +LOCALSTATEDIR +LIBDIR +SYSCONFDIR MIB_GENERATED_YANG_DIR YANG_STANDARD_DIR YANG_INSTALLDIR @@ -3419,6 +3422,7 @@ HAVE_HTTP1=false # SNMP tests require generated YANGs from MIBs +# Used in expansion in, e.g., example/main/example.xml.in # ac_ext=c @@ -5844,6 +5848,15 @@ fi +# Expand for easy replacement in example/main/example.xml.in +# Special case is $libdir, which is composed from $exec_prefix +test "x$prefix" = xNONE && prefix=$ac_default_prefix +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +SYSCONFDIR=`eval echo $sysconfdir` +LIBDIR=`eval echo $libdir` +LIBDIR=`eval echo $LIBDIR` +LOCALSTATEDIR=`eval echo $localstatedir` + ac_config_files="$ac_config_files Makefile lib/Makefile lib/src/Makefile lib/clixon/Makefile apps/Makefile apps/cli/Makefile apps/backend/Makefile apps/netconf/Makefile apps/restconf/Makefile apps/snmp/Makefile include/Makefile etc/Makefile etc/clixonrc example/Makefile example/main/Makefile example/main/example.xml extras/rpm/Makefile docker/Makefile docker/clixon-dev/Makefile docker/example/Makefile docker/test/Makefile util/Makefile yang/Makefile yang/clixon/Makefile yang/mandatory/Makefile doc/Makefile test/Makefile test/config.sh test/cicd/Makefile test/vagrant/Makefile" cat >confcache <<\_ACEOF diff --git a/configure.ac b/configure.ac index 0b645cd4..337e378c 100644 --- a/configure.ac +++ b/configure.ac @@ -129,6 +129,10 @@ AC_SUBST(YANG_INSTALLDIR) AC_SUBST(YANG_STANDARD_DIR) # SNMP tests require generated YANGs from MIBs AC_SUBST(MIB_GENERATED_YANG_DIR) +# Used in expansion in, e.g., example/main/example.xml.in +AC_SUBST(SYSCONFDIR) +AC_SUBST(LIBDIR) +AC_SUBST(LOCALSTATEDIR) # AC_PROG_CC() @@ -420,6 +424,15 @@ AC_ARG_ENABLE(nls) AH_BOTTOM([#include ]) +# Expand for easy replacement in example/main/example.xml.in +# Special case is $libdir, which is composed from $exec_prefix +test "x$prefix" = xNONE && prefix=$ac_default_prefix +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +SYSCONFDIR=`eval echo $sysconfdir` +LIBDIR=`eval echo $libdir` +LIBDIR=`eval echo $LIBDIR` +LOCALSTATEDIR=`eval echo $localstatedir` + AC_OUTPUT(Makefile lib/Makefile lib/src/Makefile diff --git a/example/main/example.xml.in b/example/main/example.xml.in index 4cb2a3e4..c50a8975 100644 --- a/example/main/example.xml.in +++ b/example/main/example.xml.in @@ -1,23 +1,23 @@ - /usr/local/etc/example.xml + @SYSCONFDIR@/example.xml ietf-netconf:startup ietf-netconf:confirmed-commit clixon-restconf:allow-auth-none clixon-restconf:fcgi - /usr/local/share/clixon + @YANG_INSTALLDIR@ @YANG_STANDARD_DIR@ clixon-example example - /usr/local/lib/example/backend - /usr/local/lib/example/netconf - /usr/local/lib/example/restconf - /usr/local/lib/example/cli - /usr/local/lib/example/clispec - /usr/local/var/example/example.sock - /usr/local/var/example/example.pidfile + @LIBDIR@/example/backend + @LIBDIR@/example/netconf + @LIBDIR@/example/restconf + @LIBDIR@/example/cli + @LIBDIR@/example/clispec + @LOCALSTATEDIR@/run/example.sock + @LOCALSTATEDIR@/run/example.pid 0 0 - /usr/local/var/example + @LOCALSTATEDIR@/lib/misc init disabled true