diff options
author | Christian Hopps <chopps@labn.net> | 2023-05-18 04:26:49 +0200 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2023-05-18 15:32:32 +0200 |
commit | 2596308a09c2b87a24165d0f98bc673e30b729d1 (patch) | |
tree | 154dd744f80ec234f45c510908e5b3892c770b4b /configure.ac | |
parent | Merge pull request #13546 from LabNConsulting/chopps/pylint-fix (diff) | |
download | frr-2596308a09c2b87a24165d0f98bc673e30b729d1.tar.xz frr-2596308a09c2b87a24165d0f98bc673e30b729d1.zip |
doc: configure: add configure option to generate .ccls file
`ccls` needs information from FRR build configuration to work,
so allow creation of a custom ccls config during autoconf.
Paraphrasing the doc entry: ccls is a very powerful tool that allows
dev environments to provide sophisticated IDE functionality, e.g.,
semantically aware jumps and code refactoring...
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index b9af76864..0120c517c 100644 --- a/configure.ac +++ b/configure.ac @@ -794,6 +794,9 @@ if test "$ac_cv_lib_json_c_json_object_get" = "no"; then fi ]) +AC_ARG_ENABLE([ccls], +AS_HELP_STRING([--enable-ccls], [Write .ccls config for this build])) + AC_ARG_ENABLE([dev_build], AS_HELP_STRING([--enable-dev-build], [build for development])) @@ -2820,6 +2823,42 @@ AC_CONFIG_FILES([tools/frrcommon.sh]) AC_CONFIG_FILES([tools/frr.service]) AC_CONFIG_FILES([tools/frr@.service]) +# dnl write out a ccls file with our compile configuration +# dnl have to add -Wno-unused-function otherwise foobar_cmd_magic causes +# dnl all DEFPY(), et al., macros to flag as errors. +AS_IF([test "$enable_ccls" = "yes"], [ + AC_CONFIG_COMMANDS([gen-dot-ccls], [ + cat > "${srcdir}/.ccls" <<EOF +clang +-DHAVE_CONFIG_H +-I. +-I./include +-I./lib +-I./lib/assert +-DSYSCONFDIR="${ac_frr_sysconfdir}" +-DCONFDATE=${ac_frr_confdate} +EOF + if test "$ac_abs_top_builddir" != "$ac_abs_top_srcdir"; then + echo "-I${ac_abs_top_builddir}" >> "${srcdir}/.ccls" + fi + if test -n "$FRR_ALL_CCLS_FLAGS"; then + echo ${FRR_ALL_CCLS_FLAGS} | tr ' ' '\n' >> "${srcdir}/.ccls" + fi + if test -n "$FRR_ALL_CCLS_CFLAGS"; then + cat >> "${srcdir}/.ccls" <<EOF +%c $(echo ${FRR_ALL_CCLS_CFLAGS} | sed -e 's/ */\n%c /g') +%c -Wno-unused-function +EOF +fi + ], [ + FRR_ALL_CCLS_FLAGS="$(echo ${LIBYANG_CFLAGS} ${LUA_INCLUDE} ${SQLITE3_CFLAGS} | sed -e 's/ */ /g')" + FRR_ALL_CCLS_CFLAGS="$(echo ${CFLAGS} ${WERROR} ${AC_CFLAGS} ${SAN_FLAGS} | sed -e 's/ */ /g')" + ac_frr_confdate="${CONFDATE}" + ac_frr_sysconfdir="${sysconfdir}/" + ]) +]) + + AS_IF([test "$with_pkg_git_version" = "yes"], [ AC_CONFIG_COMMANDS([lib/gitversion.h], [ dst="${ac_abs_top_builddir}/lib/gitversion.h" |