configure: capture environment variables in config

Capture the current value of CFLAGS, CXXFLAGS, LDFLAGS, and DESTDIR in
the CONFIG.local output from configure.

This allows sequences like this to work:

  CFLAGS='-O3' ./configure
  make

Change-Id: I1112577a94e35b948e8761b920a5bd2e4fcb10a9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/405692
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2018-03-28 11:24:48 -07:00 committed by Jim Harris
parent 90c0e24410
commit 08ec96eb70

21
configure vendored
View File

@ -52,6 +52,13 @@ function usage()
echo " vtune Required to profile I/O under Intel VTune Amplifier XE." echo " vtune Required to profile I/O under Intel VTune Amplifier XE."
echo " example: /opt/intel/vtune_amplifier_xe_version" echo " example: /opt/intel/vtune_amplifier_xe_version"
echo "" echo ""
echo "Environment variables:"
echo ""
echo "CFLAGS C compiler flags"
echo "CXXFLAGS C++ compiler flags"
echo "LDFLAGS Linker flags"
echo "DESTDIR Destination for 'make install'"
echo ""
} }
function check_dir() { function check_dir() {
@ -327,6 +334,20 @@ if [ -n "$VTUNE_SOURCE_DIR" ]; then
echo "VTUNE_SOURCE_DIR?=$VTUNE_SOURCE_DIR" >> CONFIG.local echo "VTUNE_SOURCE_DIR?=$VTUNE_SOURCE_DIR" >> CONFIG.local
fi fi
# Environment variables
if [ -n "$CFLAGS" ]; then
echo "CFLAGS?=$CFLAGS" >> CONFIG.local
fi
if [ -n "$CXXFLAGS" ]; then
echo "CXXFLAGS?=$CXXFLAGS" >> CONFIG.local
fi
if [ -n "$LDFLAGS" ]; then
echo "LDFLAGS?=$LDFLAGS" >> CONFIG.local
fi
if [ -n "$DESTDIR" ]; then
echo "DESTDIR?=$DESTDIR" >> CONFIG.local
fi
python_command= python_command=
for interpreter in python3 python2 python ; do for interpreter in python3 python2 python ; do
type $interpreter > /dev/null 2>&1 || continue type $interpreter > /dev/null 2>&1 || continue