From dfa559bcbd41397b3408c59d016631c7c65e320f Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Fri, 22 Jun 2012 12:24:59 +0300 Subject: [PATCH] configure: Add support for MSVC cl.exe/link.exe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- configure | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/configure b/configure index a11b9a10a2..ca6fd60e49 100755 --- a/configure +++ b/configure @@ -2097,6 +2097,25 @@ EOF die "Sanity test failed." fi +msvc_flags(){ + for flag; do + case $flag in + -fomit-frame-pointer) echo -Oy ;; + -g) echo -Z7 ;; + -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ + -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \ + -wd4152 -wd4324 -we4013 ;; + -std=c99) ;; + -fno-math-errno) ;; + -fno-common) ;; + -fno-signed-zeros) ;; + -lz) echo zlib.lib ;; + -l*) echo ${flag#-l}.lib ;; + *) echo $flag ;; + esac + done +} + pgi_flags(){ for flag; do case $flag in @@ -2283,6 +2302,29 @@ probe_cc(){ _cflags_size="-O2 -Munroll=c:1 $opt_common" _cflags_noopt="-O1" _flags_filter=pgi_flags + elif $_cc 2>&1 | grep -q Microsoft; then + _type=msvc + _ident=$($cc 2>&1 | head -n1) + _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)' + _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs' + _cflags_speed="-O2" + _cflags_size="-O1" + # Nonstandard output options, to avoid msys path conversion issues, relies on wrapper to remap it + if $_cc 2>&1 | grep -q Linker; then + _ld_o='-out $@' + else + _ld_o='-Fe$@' + fi + _cc_o='-Fo $@' + _flags_filter=msvc_flags + _ld_lib='lib%.a' + _ld_path='-libpath:' + _flags='-nologo' + _cflags='-D_USE_MATH_DEFINES -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64' + if [ $pfx = hostcc ]; then + _cflags="$cflags -Dsnprintf=_snprintf" + fi + disable aligned_stack fi eval ${pfx}_type=\$_type