AC_INIT([vpp], [18.10], [vpp-dev@fd.io]) LT_INIT AC_CONFIG_AUX_DIR([.]) AM_INIT_AUTOMAKE([subdir-objects]) AM_SILENT_RULES([yes]) AC_CONFIG_FILES([ \ Makefile \ plugins/Makefile \ vpp-api/python/Makefile \ vpp-api/java/Makefile \ vpp-api/vapi/Makefile \ vlib/config.h \ vppinfra/config.h \ ]) AC_CONFIG_MACRO_DIR([m4]) AC_PROG_CC AC_PROG_CPP AM_PROG_AS AM_PROG_LIBTOOL AM_PATH_PYTHON AM_CONDITIONAL([CROSSCOMPILE], [test "$cross_compiling" == "yes"]) ############################################################################### # Macros ############################################################################### AC_DEFUN([ENABLE_ARG], [ AC_ARG_ENABLE($1, AC_HELP_STRING(patsubst([--enable-$1],[_],[-]), $2), [enable_$1=yes n_enable_$1=1], [enable_$1=no n_enable_$1=0]) AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes") m4_append([list_of_enabled], [$1], [, ]) ]) AC_DEFUN([DISABLE_ARG], [ AC_ARG_ENABLE($1, AC_HELP_STRING(patsubst([--disable-$1],[_],[-]), $2), [enable_$1=no n_enable_$1=0], [enable_$1=yes n_enable_$1=1]) AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes") m4_append([list_of_enabled], [$1], [, ]) ]) AC_DEFUN([WITH_ARG], [ AC_ARG_WITH($1, AC_HELP_STRING(patsubst([--with-$1],[_],[-]), $2), [with_$1=yes n_with_$1=1], [with_$1=no n_with_$1=0]) AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes") m4_append([list_of_with], [$1], [, ]) ]) AC_DEFUN([WITHOUT_ARG], [ AC_ARG_WITH($1, AC_HELP_STRING(patsubst([--without-$1],[_],[-]), $2), [with_$1=no n_with_$1=0], [with_$1=yes n_with_$1=1]) AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes") m4_append([list_of_with], [$1], [, ]) ]) AC_DEFUN([PLUGIN_ENABLED], [ AC_ARG_ENABLE($1_plugin, AC_HELP_STRING([--disable-$1-plugin], [Do not build $1 plugin]), [enable_$1_plugin=no], [enable_$1_plugin=yes ]) AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes") m4_append([list_of_plugins], [$1], [, ]) ]) AC_DEFUN([PLUGIN_DISABLED], [ AC_ARG_ENABLE($1_plugin, AC_HELP_STRING([--enable-$1-plugin], [Build $1 plugin]), [enable_$1_plugin=yes ], [enable_$1_plugin=no]) AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes") m4_append([list_of_plugins], [$1], [, ]) ]) AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ]) AC_DEFUN([DPDK_IS_PMD_ENABLED], [ AC_MSG_CHECKING([for $1 in rte_config.h]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[return RTE_$1;]], )], [with_$2=yes] [AC_MSG_RESULT([yes])], [with_$2=no] [AC_MSG_RESULT([no])] ) AM_CONDITIONAL(m4_toupper(WITH_$2), test "$with_$2" = "yes") m4_append_uniq([list_of_with], [$2], [, ]) ]) # Check if compiler supports specific flag AC_DEFUN([CC_CHECK_FLAG], [ AC_MSG_CHECKING([if $CC supports $1]) AC_LANG_PUSH([C]) ac_saved_cflags="$CFLAGS" CFLAGS="-Werror $1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [cc_flag_check=yes], [cc_flag_check=no] ) AC_MSG_RESULT([$cc_flag_check]) CFLAGS="$ac_saved_cflags" AC_LANG_POP([C]) ]) # This function deduces the BUILD HOST cache-line size by # inspecting /sys and/or /proc depending on the kernel / arch in use as_fn_log2_cache_line_size_p() { sysfs_cache_path="/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size" m4_define([read_cache_line_size_from_sysfs], [`head -n 1 $1`]) m4_define([read_midr_implementer], [`awk '/implementer/ {print $[]4;exit}' /proc/cpuinfo`]) m4_define([read_midr_cpuid], [`awk '/part/ {print $[]4;exit}' /proc/cpuinfo`]) #Check if sysfs path exists,to ignore warning, else do manual mapping AC_CHECK_FILE($sysfs_cache_path, [ cache_line_size=read_cache_line_size_from_sysfs($sysfs_cache_path); if test $cache_line_size = "32" ; then log2_cache_line_size="5"; elif test $cache_line_size = "64" ; then log2_cache_line_size="6"; elif test $cache_line_size = "128" ; then log2_cache_line_size="7"; fi AC_MSG_NOTICE([cache_line_size/log2_cache_line_size deduced as $cache_line_size/$log2_cache_line_size]) ], [ #Define Implementer Ids here implementer_id_cavium=0x43 #Define CPU Ids here cpu_id_cavium_thunderx_cn88xx=0x0a1 cpu_id_cavium_thunderx2_cn99xx=0x0af implementer=read_midr_implementer() cpuid=read_midr_cpuid() AC_MSG_CHECKING([for implementerid/cpuid to set log2_cache_line_size]) # Switch case to map log2_cache_line_size for implementer/cpuid combination. # Default case of Switch sets log2_cache_line_size to 6 AS_CASE($implementer, #Switch Case for Cavium SoC's [$implementer_id_cavium], [AS_CASE($cpuid, #Only ThunderX2 is 64B. Remaining chips are 128B [$cpu_id_cavium_thunderx2_cn99xx], [AC_MSG_RESULT([Cavium/ThunderX2]);log2_cache_line_size=6], [$cpu_id_cavium_thunderx_cn88xx], [AC_MSG_RESULT([Cavium/ThunderX]);log2_cache_line_size=7], [log2_cache_line_size=7;AC_MSG_RESULT([Cavium/OCTEONTx($cpuid)])] )], #Add implementer specific case here: #Default case: 64B for all SoC's [log2_cache_line_size=6;AC_MSG_RESULT([$implementer/$cpuid])] ) AC_MSG_NOTICE([log2_cache_line_size deduced as $log2_cache_line_size]) ] ) echo $log2_cache_line_size } ############################################################################### # configure arguments ############################################################################### # --enable-X ENABLE_ARG(tests, [Enable unit tests]) ENABLE_ARG(dpdk_shared, [Enable unit tests]) ENABLE_ARG(perftool, [Enable perftool]) ENABLE_ARG(g2, [Enable g2]) ENABLE_ARG(dlmalloc, [Enable dlmalloc]) # --disable-X DISABLE_ARG(vlib, [Disable vlib and dependant libs and binaries]) DISABLE_ARG(svm, [Disable svm and dependant libs and binaries]) DISABLE_ARG(papi, [Disable Python API bindings]) DISABLE_ARG(japi, [Disable Java API bindings]) # --with-X # --without-X WITH