Win port: add base::getopt_compat

Windows doesn't have <getopt.h> but all our executable these
days depend on it. We have two roads ahead:
1. Create an abstraction layer, like base::ArgParsers to deal
   with cmdline parsing.
2. Create a getopt emulation for Windows.

1 is too much risk and too much effort. On Android our cmdline
is de-facto an API, we can't risk subtle breakages.
Instead it's easier and lower risk to create a getopt emulation
for Windows.
This CL also introduces a test that checks that the behavior of
the two is consistent.

Bug: 174454879
Test: perfetto_unittests --gtest_filter=GetOpt*

Change-Id: I68752e615ad0aaf24226ddbce0d7ba77140bdca9
diff --git a/Android.bp b/Android.bp
index 046da6e..a8f0d8c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -6405,6 +6405,7 @@
     "src/base/ctrl_c_handler.cc",
     "src/base/event_fd.cc",
     "src/base/file_utils.cc",
+    "src/base/getopt_compat.cc",
     "src/base/logging.cc",
     "src/base/metatrace.cc",
     "src/base/paged_memory.cc",
@@ -6446,6 +6447,7 @@
   srcs: [
     "src/base/circular_queue_unittest.cc",
     "src/base/flat_set_unittest.cc",
+    "src/base/getopt_compat_unittest.cc",
     "src/base/metatrace_unittest.cc",
     "src/base/no_destructor_unittest.cc",
     "src/base/optional_unittest.cc",