Repository: conan-io/conan

Issue:
AutoToolsBuildEnvironment adds unknown options to MSVC
To help us debug your issue please explain:

- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
- [x] I've specified the Conan version, operating system version and any tool that can be relevant.
- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

certain projects (e.g. ffmpeg) use auto-tools style builds for Visual Studio as well.
as for conan 1.0.2, using the **AutoToolsBuildEnvironment** helper, MSVC receives unrecognized options:
```
cl : Command line warning D9002 : ignoring unknown option '-m64'
cl : Command line warning D9002 : ignoring unknown option '-g'
```


Discussion:

Resolving patch:
diff --git a/conans/client/build/autotools_environment.py b/conans/client/build/autotools_environment.py
--- a/conans/client/build/autotools_environment.py
+++ b/conans/client/build/autotools_environment.py
@@ -184,7 +184,10 @@ def make(self, args="", make_program=None, target=None):
 
     @property
     def _sysroot_flag(self):
-        return "--sysroot=%s" % self._adjust_path(self._deps_cpp_info.sysroot) if self._deps_cpp_info.sysroot else None
+        if self._compiler == 'Visual Studio':
+            return None
+        else:
+            return "--sysroot=%s" % self._adjust_path(self._deps_cpp_info.sysroot) if self._deps_cpp_info.sysroot else None
 
     def _configure_link_flags(self):
         """Not the -L"""
@@ -198,7 +201,7 @@ def _configure_link_flags(self):
     def _configure_flags(self):
         ret = copy.copy(self._deps_cpp_info.cflags)
         ret.append(self._architecture_flag)
-        if self._build_type == "Debug":
+        if self._build_type == "Debug" and str(self._compiler) in ['gcc', 'clang', 'apple-clang', 'sun-cc']:
             ret.append("-g")  # default debug information
         elif self._build_type == "Release" and self._compiler == "gcc":
             # Remove all symbol table and relocation information from the executable.
@@ -226,7 +229,9 @@ def _configure_defines(self):
 
     @property
     def _architecture_flag(self):
-        return architecture_dict.get(self._arch, "")
+        if str(self._compiler) in ['gcc', 'clang', 'apple-clang', 'sun-cc']:
+            return architecture_dict.get(self._arch, "")
+        return ""
 
     def _get_vars(self):
         def append(*args):
@@ -239,15 +244,21 @@ def append(*args):
                         ret.append(arg)
             return ret
 
-        lib_paths = ['-L%s' % self._adjust_path(x.replace("\\", "/")) for x in self.library_paths]
-        include_paths = ['-I%s' % self._adjust_path(x.replace("\\", "/")) for x in self.include_paths]
+        if self._compiler == 'Visual Studio':
+            lib_paths = ['/LIBPATH:%s' % x.replace("/", "\\") for x in self.library_paths]
+            include_paths = ['-I%s' % x.replace("/", "\\") for x in self.include_paths]
+            libs = [lib for lib in self.libs]
+        else:
+            lib_paths = ['-L%s' % self._adjust_path(x.replace("\\", "/")) for x in self.library_paths]
+            include_paths = ['-I%s' % self._adjust_path(x.replace("\\", "/")) for x in self.include_paths]
+            libs = ['-l%s' % lib for lib in self.libs]
 
         ld_flags = append(self.link_flags, lib_paths)
+
         cpp_flags = append(include_paths, ["-D%s" % x for x in self.defines])
-        libs = ['-l%s' % lib for lib in self.libs]
 
         tmp_compilation_flags = copy.copy(self.flags)
-        if self.fpic:
+        if self.fpic and not self._compiler == 'Visual Studio':
             tmp_compilation_flags.append("-fPIC")
 
         cxx_flags = append(tmp_compilation_flags, self.cxx_flags)


Test patch:
diff --git a/conans/test/build_helpers/autotools_configure_test.py b/conans/test/build_helpers/autotools_configure_test.py
--- a/conans/test/build_helpers/autotools_configure_test.py
+++ b/conans/test/build_helpers/autotools_configure_test.py
@@ -44,6 +44,24 @@ def test_mocked_methods(self):
         self.assertEquals(runner.command_called, "make %s -j%s" % (things, cpu_count()))
 
     def test_variables(self):
+        # Visual Studio
+        settings = MockSettings({"build_type": "Release",
+                                 "arch": "x86",
+                                 "compiler": "Visual Studio",
+                                 "compiler.version": "14",
+                                 "compiler.runtime": "MD"})
+        conanfile = MockConanfile(settings)
+        self._set_deps_info(conanfile)
+
+        be = AutoToolsBuildEnvironment(conanfile)
+        expected = {'CFLAGS': 'a_c_flag',
+                    'CPPFLAGS': '-Ipath\\includes -Iother\\include\\path -Donedefinition -Dtwodefinition',
+                    'CXXFLAGS': 'a_c_flag  a_cpp_flag',
+                    'LDFLAGS': 'shared_link_flag exe_link_flag  /LIBPATH:one\\lib\\path',
+                    'LIBS': 'onelib twolib'}
+
+        self.assertEquals(be.vars, expected)
+
         # GCC 32
         settings = MockSettings({"build_type": "Release",
                                  "arch": "x86",