Since #846, `HAVE_UNWIND_H` is not really in use. Instead we should use `HAVE__UNWIND_BACKTRACE` and `HAVE__UNWIND_GETIP` (added in #846). To prevent that from happening again, also added Bazel tests that confirm stacktrace are still working.
The previous approach used
--incompatible_enable_cc_toolchain_resolution, which is recommended by
the docs, but a Bazel developer told me it's obsolete. The new, old
approach is simpler and should stop the warning from being user-visible.
Use <chrono> and <atomic> for C++11 or greater.
For non-Windows pre-C++11 systems, use <time.h> and built-in atomic operations.
For Windows pre-C++11, use the Windows implementations for time and atomic operations.
This lets us drop the dependency on the preprocessed headers in
src/windows/glog/.
For some reason, this lets Bazel realize we've failed to declare a
dependency on dirent.h, so I added that too.
This uses strip_include_prefix to avoid leaking private headers
(config.h, port.h). This needs a workaround to prevent a "missing
dependency declarations" error.
We need at least following defs to be set to print stacktrace in
failure signal handler.
- HAVE_UNWIND_H: on Linux and macOS. unwind.h is usually present
by default on those OSes.
- HAVE_DLADDR: on macOS.
Windows is not cared because glog can not be built with bazel
on Windows today.
The code references `@ac_cv_have_libgflags@` but not `@ac_cv_have_libgflags_h@`. This corrects that.
`int(with_gflags)` incorporates the possibility of `True/False`: https://github.com/bazelbuild/bazel/issues/4792
This means that gflags no longer leaks config.h, so I had to fix a bug
in glog.bzl where config.h is generated at the wrong path.
I also switched to the best-practice for depending on git repositories,
ie using http_archive with a mirror.
This commit addresses a few issues:
1. No longer leak config.h in a way similar to
https://github.com/gflags/gflags/issues/233
The solution of prefixing the path by 'glog_internal' is modified from
https://github.com/gflags/gflags/issues/234
2. No longer expose internal headers.
3. Replace PACKAGE_NAME with native.package_name()
4. Uers can choose namespaces via the newly added 'namespace' keyword.
5. Replace glob with explicitly listing of files.
6. Make the genrules more compact using pythonic list construction.