• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/BUILD b/BUILD
2index 0a5c9eb..d836578 100644
3--- a/BUILD
4+++ b/BUILD
5@@ -6,6 +6,11 @@ licenses(["notice"])
6
7 exports_files(["src/gflags_complections.sh", "COPYING.txt"])
8
9+config_setting(
10+    name = "android",
11+    values = {"crosstool_top": "//external:android/crosstool"},
12+)
13+
14 load(":bazel/gflags.bzl", "gflags_sources", "gflags_library")
15 (hdrs, srcs) = gflags_sources(namespace=["gflags", "google"])
16 gflags_library(hdrs=hdrs, srcs=srcs, threads=0)
17diff --git a/bazel/gflags.bzl b/bazel/gflags.bzl
18index cd0edad..5c1d8b5 100644
19--- a/bazel/gflags.bzl
20+++ b/bazel/gflags.bzl
21@@ -77,7 +77,10 @@ def gflags_library(hdrs=[], srcs=[], threads=1):
22     ]
23     linkopts = []
24     if threads:
25-        linkopts.append("-lpthread")
26+        linkopts += select({
27+            "//:android": [],
28+            "//conditions:default": ["-lpthread"],
29+        })
30     else:
31         name += "_nothreads"
32         copts.append("-DNO_THREADS")