aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2020-06-08 10:34:09 +0300
committerMatias Elo <matias.elo@nokia.com>2020-06-08 10:34:09 +0300
commit0b7fb60a26c39a8b1e34cb02cfd6785a188dec3f (patch)
tree93dd9ab65686d3430ef7f7845bd67beb712ba413 /m4
parent102173c31bf1af979488af3d3d4175d162ac0454 (diff)
parent0153b816e6aaa1c5e6308571d374b555f2173007 (diff)
Merge branch 'master' of https://github.com/OpenDataPlane/odp into odp-dpdk
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/odp_libconfig.m420
1 files changed, 16 insertions, 4 deletions
diff --git a/m4/odp_libconfig.m4 b/m4/odp_libconfig.m4
index 6b5bca268..29cc8c85b 100644
--- a/m4/odp_libconfig.m4
+++ b/m4/odp_libconfig.m4
@@ -1,5 +1,5 @@
-# ODP_LIBCONFIG(PLATFORM)
-# -----------------------
+# ODP_LIBCONFIG(PLATFORM, CONFIG-FILE-PATH)
+# -----------------------------------------
AC_DEFUN([ODP_LIBCONFIG],
[dnl
##########################################################################
@@ -14,6 +14,18 @@ AC_CHECK_PROGS([OD], [od])
AC_PROG_SED
AS_IF([test -z "$OD"], [AC_MSG_ERROR([Could not find 'od'])])
+##########################################################################
+# Check default configuration file
+##########################################################################
+AS_IF([test -z "$2"] || [test ! -f $2],
+ [AC_MSG_ERROR([Default configuration file not found])], [])
+
+conf_ver=$_ODP_CONFIG_VERSION_GENERATION.$_ODP_CONFIG_VERSION_MAJOR.$_ODP_CONFIG_VERSION_MINOR
+file_ver=`$SED 's/ //g' $2 | $GREP -oP '(?<=config_file_version=").*?(?=")'`
+
+AS_IF([test "x$conf_ver" = "x$file_ver"], [],
+ [AC_MSG_ERROR([Configuration file version mismatch (_ODP_CONFIG_VERSION=$conf_ver config_file_version=$file_ver)])])
+
odp_use_config=true
##########################################################################
# Create a header file odp_libconfig_config.h which containins null
@@ -22,9 +34,9 @@ odp_use_config=true
AC_CONFIG_COMMANDS([platform/$1/include/odp_libconfig_config.h],
[mkdir -p platform/$1/include
(echo "static const char config_builtin[[]] = {"; \
- $OD -An -v -tx1 < ${srcdir}/config/odp-$1.conf | \
+ $OD -An -v -tx1 < $CONFIG_FILE | \
$SED -e 's/[[0-9a-f]]\+/0x\0,/g' ; \
echo "0x00 };") > \
platform/$1/include/odp_libconfig_config.h],
- [with_platform=$with_platform OD=$OD SED=$SED])
+ [with_platform=$1 OD=$OD SED=$SED CONFIG_FILE=$2])
]) # ODP_LIBCONFIG