Skip to content

Commit da5dfb6

Browse files
committed
Move the check for curl, python, and libcjson into configure.ac
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 <sarcot@microsoft.com>
1 parent 23b995f commit da5dfb6

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

CLI/klish/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ all : $(SRC_REPLACEMENTS)
1919
tar xzvf klish-$(KLISH_VERSION).tgz -C $(SONIC_CLI_ROOT)
2020
cd ${KLISH_SRC} && QUILT_PATCHES=${CURDIR}/patches quilt push -a
2121

22-
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
22+
cd ${KLISH_SRC} && sh autogen.sh && ./configure --with-libxml2=/usr $(CROSS_CONFIGURE_OPTS) --enable-debug=no && make
2323

2424
mkdir -p $(SONIC_CLI_ROOT)/target/.libs
2525
cp $(CURDIR)/clish_start $(SONIC_CLI_ROOT)/target/.

CLI/klish/patches/0002-enhance-Klish-parser-with-improved-usability-and-pyt.patch

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From e629c76e73aa7b89490a8f8b52557fc22ec405d4 Mon Sep 17 00:00:00 2001
1+
From 0bdd0a1c0631c27cf21a60b2e3d6f1d17a950279 Mon Sep 17 00:00:00 2001
22
From: Kwan <kwangsuk_kim@dell.com>
33
Date: Mon, 4 Jan 2021 15:10:03 -0800
4-
Subject: [PATCH] enhance Klish parser with improved usability and python3
4+
Subject: [PATCH 2/2] enhance Klish parser with improved usability and python3
55
support (#76)
66
MIME-Version: 1.0
77
Content-Type: text/plain; charset=UTF-8
@@ -83,7 +83,7 @@ Miscellaneous bug fixes - subcommands or param while pressing tab etc.
8383
clish/shell/shell_tinyrl.c | 282 +++++++++++--
8484
clish/shell/shell_wdog.c | 2 +
8585
clish/shell/shell_xml.c | 42 +-
86-
configure.ac | 2 +
86+
configure.ac | 26 ++
8787
lub/argv.h | 1 +
8888
lub/argv/argv.c | 21 +
8989
lub/string.h | 2 +
@@ -102,7 +102,7 @@ Miscellaneous bug fixes - subcommands or param while pressing tab etc.
102102
tinyrl/history/history.c | 20 +-
103103
tinyrl/tinyrl.c | 74 ++++
104104
tinyrl/tinyrl.h | 12 +
105-
48 files changed, 3276 insertions(+), 223 deletions(-)
105+
48 files changed, 3300 insertions(+), 223 deletions(-)
106106
create mode 100644 clish/param/mgmt_clish_extn_param.c
107107
create mode 100644 clish/plugin/clish_api.h
108108
create mode 100644 clish/plugin/mgmt_clish_utils.c
@@ -3951,7 +3951,7 @@ index 8467ec1..6a4b49e 100644
39513951
return res;
39523952
}
39533953
diff --git a/configure.ac b/configure.ac
3954-
index 9d3e49f..42e46e6 100644
3954+
index 9d3e49f..9666bb7 100644
39553955
--- a/configure.ac
39563956
+++ b/configure.ac
39573957
@@ -25,6 +25,8 @@ AC_PROG_CC
@@ -3963,6 +3963,38 @@ index 9d3e49f..42e46e6 100644
39633963
AC_CONFIG_HEADERS([config.h])
39643964
AM_INIT_AUTOMAKE(subdir-objects)
39653965
AM_PROG_CC_C_O
3966+
@@ -107,6 +109,31 @@ if test x$use_lua != xno; then
3967+
AX_LUA_LIBS()
3968+
fi
3969+
3970+
+################################
3971+
+# Get Python headers
3972+
+################################
3973+
+AM_PATH_PYTHON([3])
3974+
+AX_PYTHON_DEVEL([>= '3'])
3975+
+
3976+
+CPPFLAGS="${CPPFLAGS} ${PYTHON_CPPFLAGS}"
3977+
+LDFLAGS="${LDFLAGS} ${PYTHON_LIBS}"
3978+
+
3979+
+################################
3980+
+# Get Curl headers
3981+
+################################
3982+
+PKG_CHECK_MODULES([CURL], [libcurl])
3983+
+
3984+
+CPPFLAGS="${CPPFLAGS} ${CURL_CFLAGS}"
3985+
+LDFLAGS="${LDFLAGS} ${CURL_LIBS}"
3986+
+
3987+
+################################
3988+
+# Get cjson headers
3989+
+################################
3990+
+PKG_CHECK_MODULES([CJSON], [libcjson])
3991+
+
3992+
+CPPFLAGS="${CPPFLAGS} ${CJSON_CFLAGS}"
3993+
+LDFLAGS="${LDFLAGS} ${CJSON_LIBS}"
3994+
+
3995+
################################
3996+
# Check for the roxml library
3997+
################################
39663998
diff --git a/lub/argv.h b/lub/argv.h
39673999
index 7e0c7cc..7da2bc4 100644
39684000
--- a/lub/argv.h

0 commit comments

Comments
 (0)