Skip to content

Commit

Permalink
Move the check for curl, python, and libcjson into configure.ac
Browse files Browse the repository at this point in the history
Instead of hardcoding the include paths and library paths in the
Makefile, add dynamic checks for curl, python, and libcjson into
configure.ac.

Signed-off-by: Saikrishna Arcot <[email protected]>
  • Loading branch information
saiarcot895 committed Aug 18, 2022
1 parent 23b995f commit 993b595
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CLI/klish/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ all : $(SRC_REPLACEMENTS)
tar xzvf klish-$(KLISH_VERSION).tgz -C $(SONIC_CLI_ROOT)
cd ${KLISH_SRC} && QUILT_PATCHES=${CURDIR}/patches quilt push -a

cd ${KLISH_SRC} && sh autogen.sh && ./configure --with-libxml2=/usr $(CROSS_CONFIGURE_OPTS) --enable-debug=no LIBS='-l:libcurl-gnutls.so.4 -L$(LIB_PATH) -lpython3.7m -Wl,-rpath=$(LIB_PATH) -lcjson' CFLAGS='${CFLAGS} -g -I/usr/include/python3.7m' CPPFLAGS='${CPPFLAGS} -I/usr/include/cjson' && make
cd ${KLISH_SRC} && sh autogen.sh && ./configure --with-libxml2=/usr $(CROSS_CONFIGURE_OPTS) --enable-debug=no && make

mkdir -p $(SONIC_CLI_ROOT)/target/.libs
cp $(CURDIR)/clish_start $(SONIC_CLI_ROOT)/target/.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From e629c76e73aa7b89490a8f8b52557fc22ec405d4 Mon Sep 17 00:00:00 2001
From 0bdd0a1c0631c27cf21a60b2e3d6f1d17a950279 Mon Sep 17 00:00:00 2001
From: Kwan <[email protected]>
Date: Mon, 4 Jan 2021 15:10:03 -0800
Subject: [PATCH] enhance Klish parser with improved usability and python3
Subject: [PATCH 2/2] enhance Klish parser with improved usability and python3
support (#76)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Expand Down Expand Up @@ -83,7 +83,7 @@ Miscellaneous bug fixes - subcommands or param while pressing tab etc.
clish/shell/shell_tinyrl.c | 282 +++++++++++--
clish/shell/shell_wdog.c | 2 +
clish/shell/shell_xml.c | 42 +-
configure.ac | 2 +
configure.ac | 26 ++
lub/argv.h | 1 +
lub/argv/argv.c | 21 +
lub/string.h | 2 +
Expand All @@ -102,7 +102,7 @@ Miscellaneous bug fixes - subcommands or param while pressing tab etc.
tinyrl/history/history.c | 20 +-
tinyrl/tinyrl.c | 74 ++++
tinyrl/tinyrl.h | 12 +
48 files changed, 3276 insertions(+), 223 deletions(-)
48 files changed, 3300 insertions(+), 223 deletions(-)
create mode 100644 clish/param/mgmt_clish_extn_param.c
create mode 100644 clish/plugin/clish_api.h
create mode 100644 clish/plugin/mgmt_clish_utils.c
Expand Down Expand Up @@ -3951,7 +3951,7 @@ index 8467ec1..6a4b49e 100644
return res;
}
diff --git a/configure.ac b/configure.ac
index 9d3e49f..42e46e6 100644
index 9d3e49f..9666bb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,8 @@ AC_PROG_CC
Expand All @@ -3963,6 +3963,37 @@ index 9d3e49f..42e46e6 100644
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(subdir-objects)
AM_PROG_CC_C_O
@@ -107,6 +109,30 @@ if test x$use_lua != xno; then
AX_LUA_LIBS()
fi

+################################
+# Get Python headers
+################################
+AX_PYTHON_DEVEL([>= '3'])
+
+CPPFLAGS="${CPPFLAGS} ${PYTHON_CPPFLAGS}"
+LDFLAGS="${LDFLAGS} ${PYTHON_LIBS}"
+
+################################
+# Get Curl headers
+################################
+PKG_CHECK_MODULES([CURL], [libcurl])
+
+CPPFLAGS="${CPPFLAGS} ${CURL_CFLAGS}"
+LDFLAGS="${LDFLAGS} ${CURL_LIBS}"
+
+################################
+# Get cjson headers
+################################
+PKG_CHECK_MODULES([CJSON], [libcjson])
+
+CPPFLAGS="${CPPFLAGS} ${CJSON_CFLAGS}"
+LDFLAGS="${LDFLAGS} ${CJSON_LIBS}"
+
################################
# Check for the roxml library
################################
diff --git a/lub/argv.h b/lub/argv.h
index 7e0c7cc..7da2bc4 100644
--- a/lub/argv.h
Expand Down

0 comments on commit 993b595

Please sign in to comment.