diff options
author | Peter Stuge <peter@stuge.se> | 2008-11-22 17:13:36 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2008-11-22 17:13:36 +0000 |
commit | dad1e3091f2d9a3fc03b9ca83c2990e23b4ea32c (patch) | |
tree | 4ca71d53ba7405b720fa977614fd68a96bf3d3bd /util/msrtool/configure | |
parent | d24fe7e80ede60847afaa2ae30692b072ea06eda (diff) |
msrtool: Release Candidate 1
msrtool can decode MSRs and print the value of every field in human
readable form. It can also be used to save a set of MSRs to a file,
and at a later time compare the saved values with current values in
hardware.
Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3766 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/msrtool/configure')
-rwxr-xr-x | util/msrtool/configure | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/util/msrtool/configure b/util/msrtool/configure new file mode 100755 index 0000000000..f627a6541f --- /dev/null +++ b/util/msrtool/configure @@ -0,0 +1,162 @@ +#!/bin/sh +# +# This file is part of msrtool. +# +# Copyright (c) 2008 Peter Stuge <peter@stuge.se> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# If this is left unset, try to set the version string from the highest +# revision number of the checked out files later. +VERSION="" + +REV="$(svnversion -c . 2>/dev/null)"; REV="${REV/*:}" +VERSION="${VERSION:-$REV}" + +function findprog() { + local WHAT FROMENV FILE + WHAT="${1}" + shift + FROMENV="${1}" + shift + echo -n "searching for ${WHAT} (${*})..." 1>&2 + test -n "${FROMENV}" && { + echo " using environment: ${FROMENV}" 1>&2 + echo "${FROMENV}" + exit 0 + } + for parm in $(seq 0 $#); do + test -z "${1}" && { + shift + continue + } + FILE="$(which "${1}" 2>/dev/null)" + test $? -eq 0 && { + echo "${1}" + break + } + shift + done + test -z "${1}" && { + echo " not found!" 1>&2 + echo 1>&2 + echo "This is a fatal error, configure is exiting!" 1>&2 + exit 1 + } + echo " using ${FILE} in PATH" 1>&2 + exit 0 +} + +function trycompile() { + local WHAT OUT + WHAT="${1}" + shift + echo -n "finding CFLAGS for ${WHAT}... " 1>&2 + OUT="${OUT}\n${CC} ${CFLAGS} -o .config.o -c .config.c" + OUT="${OUT}\n$(${CC} ${CFLAGS} -o .config.o -c .config.c 2>&1)" + test $? -eq 0 && { + echo " using: ${CFLAGS}" 1>&2 + echo "${CFLAGS}" + exit 0 + } + for parm in $(seq 1 $#); do + OUT="${OUT}\n${CC} ${CFLAGS} ${1} -o .config.o -c .config.c 2>&1" + OUT="${OUT}\n$(${CC} ${CFLAGS} ${1} -o .config.o -c .config.c 2>&1)" + test $? -eq 0 && { + echo " using: ${CFLAGS} ${1}" 1>&2 + echo "${CFLAGS} ${1}" + exit 0 + } + shift + done + echo "failed!" 1>&2 + echo 1>&2 + echo -n "The following compiler commands were executed:" 1>&2 + echo -e "${OUT}\n" 1>&2 + echo "This is a fatal error, configure is exiting!" 1>&2 + echo 1>&2 + echo "You can try to fix this by manually setting CFLAGS in the environment before" 1>&2 + echo "running configure. E.g.:" 1>&2 + echo "CFLAGS=-I/opt/somedir/include ${0}" 1>&2 + echo 1>&2 + exit 1 +} + +function trylink() { + local WHAT OUT + WHAT="${1}" + shift + echo -n "finding LDFLAGS for ${WHAT}... " 1>&2 + OUT="${OUT}\n${CC} -o .config .config.o ${LDFLAGS} 2>&1" + OUT="${OUT}\n$(${CC} -o .config .config.o ${LDFLAGS} 2>&1)" + test $? -eq 0 && { + echo " using: ${LDFLAGS}" 1>&2 + echo "${LDFLAGS}" + exit 0 + } + for parm in $(seq 1 $#); do + OUT="${OUT}\n${CC} -o .config .config.o ${LDFLAGS} ${1} 2>&1" + OUT="${OUT}\n$(${CC} -o .config .config.o ${LDFLAGS} ${1} 2>&1)" + test $? -eq 0 && { + echo " using: ${LDFLAGS} ${1}" 1>&2 + echo "${LDFLAGS} ${1}" + exit 0 + } + shift + done + echo "failed!" 1>&2 + echo 1>&2 + echo -n "The following linker commands were executed:" 1>&2 + echo -e "${OUT}\n" 1>&2 + echo "This is a fatal error, configure is exiting!" 1>&2 + echo 1>&2 + echo "You can try to fix this by manually setting LDFLAGS in the environment before" 1>&2 + echo "running configure. E.g.:" 1>&2 + echo "LDFLAGS=-L/opt/somedir/lib ${0}" 1>&2 + echo 1>&2 + exit 1 +} + +CC=$(findprog "compiler" "${CC}" gcc cc icc) || exit +INSTALL=$(findprog "install" "${INSTALL}" install ginstall) || exit + +test -n "$DEBUG" && myCFLAGS="-O2 -g" || myCFLAGS="-Os" +CFLAGS="${CFLAGS} ${myCFLAGS} -Wall -Werror" + +PREFIX="${PREFIX:-/usr/local}" + +OS_ARCH=$(uname) + +echo +echo "configured using the following settings:" +echo +echo "VERSION=${VERSION}" +echo "CC=${CC}" +echo "CFLAGS=${CFLAGS}" +echo "LDFLAGS=${LDFLAGS}" +echo "INSTALL=${INSTALL}" +echo "PREFIX=${PREFIX}" +echo +echo -n "creating Makefile..." +echo "# This file was automatically generated by configure" > Makefile +sed -e "s#@VERSION@#${VERSION}#g" \ + -e "s#@CC@#${CC}#g" \ + -e "s#@CFLAGS@#${CFLAGS}#g" \ + -e "s#@LDFLAGS@#${LDFLAGS}#g" \ + -e "s#@INSTALL@#${INSTALL}#g" \ + -e "s#@PREFIX@#/usr/local#g" \ + Makefile.in >> Makefile +echo " done" +echo |