From: Wesley W. Terpstra Date: Sat, 4 Mar 2017 02:50:37 +0000 (-0800) Subject: autoconf: put location of 'dtc' into config.h X-Git-Url: https://git.libre-soc.org/?p=riscv-isa-sim.git;a=commitdiff_plain;h=c71db7787b63fc1ab0c57672c9e469711748bda9 autoconf: put location of 'dtc' into config.h --- diff --git a/README.md b/README.md index 901c7f4..a5ed802 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Build Steps We assume that the RISCV environment variable is set to the RISC-V tools install path, and that the riscv-fesvr package is installed there. + $ apt-get install device-tree-compiler $ mkdir build $ cd build $ ../configure --prefix=$RISCV --with-fesvr=$RISCV diff --git a/config.h.in b/config.h.in index 566b1bc..15b5850 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,9 @@ /* Default value for --isa switch */ #undef DEFAULT_ISA +/* Path to the device-tree-compiler */ +#undef DTC + /* Define if subproject MCPPBS_SPROJ_NORM is enabled */ #undef DUMMY_ROCC_ENABLED diff --git a/configure b/configure index 4c272b3..eddc147 100755 --- a/configure +++ b/configure @@ -636,6 +636,7 @@ enable_stow EGREP GREP CXXCPP +DTC RANLIB AR ac_ct_CXX @@ -3378,6 +3379,51 @@ else RANLIB="$ac_cv_prog_RANLIB" fi +# Extract the first word of "dtc", so it can be a program name with args. +set dummy dtc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DTC+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DTC in + [\\/]* | ?:[\\/]*) + ac_cv_path_DTC="$DTC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DTC="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DTC=$ac_cv_path_DTC +if test -n "$DTC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DTC" >&5 +$as_echo "$DTC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +cat >>confdefs.h <<_ACEOF +#define DTC "$DTC" +_ACEOF + ac_ext=cpp diff --git a/configure.ac b/configure.ac index dbf50c9..ea64de7 100644 --- a/configure.ac +++ b/configure.ac @@ -51,6 +51,8 @@ AC_PROG_CC AC_PROG_CXX AC_CHECK_TOOL([AR],[ar]) AC_CHECK_TOOL([RANLIB],[ranlib]) +AC_PATH_PROG([DTC],[dtc]) +AC_DEFINE_UNQUOTED(DTC, ["$DTC"], [Path to the device-tree-compiler]) AC_C_BIGENDIAN(AC_MSG_ERROR([Spike requires a little-endian host]))