[llvm] d5e9b76 - [gn build] Put HAVE_LIBZ and HAVE_ZLIB_H behind llvm_enable_zlib too.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Fri May 15 13:19:07 PDT 2020


Author: Nico Weber
Date: 2020-05-15T16:18:56-04:00
New Revision: d5e9b76253d978dcf321e4f3c7c629d0f4dcd507

URL: https://github.com/llvm/llvm-project/commit/d5e9b76253d978dcf321e4f3c7c629d0f4dcd507
DIFF: https://github.com/llvm/llvm-project/commit/d5e9b76253d978dcf321e4f3c7c629d0f4dcd507.diff

LOG: [gn build] Put HAVE_LIBZ and HAVE_ZLIB_H behind llvm_enable_zlib too.

In the CMake build, the HAVE_ vars are set based on system inspection,
and LLVM_ENABLE_ZLIB is set to false if neither's found. The GN build
doesn't do autodetection like this.

With this change, people can set llvm_enable_zlib=true on Windows
and as long as they provide a zlib.lib things should actually work.

(https://reviews.llvm.org/D79219 will remove 2 of the 3 config.h
values, hopefully soon. This change here just makes things a tiny
bit easier until that change is in.)

Added: 
    

Modified: 
    llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
index 9f29caddd79e..b54361526ce4 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -202,7 +202,6 @@ write_cmake_config("config") {
       "HAVE_ISATTY=",
       "HAVE_LIBPTHREAD=",
       "HAVE_PTHREAD_SETNAME_NP=",
-      "HAVE_LIBZ=",
       "HAVE_PREAD=",
       "HAVE_PTHREAD_GETSPECIFIC=",
       "HAVE_PTHREAD_H=",
@@ -221,7 +220,6 @@ write_cmake_config("config") {
       "HAVE_SYS_TIME_H=",
       "HAVE_TERMIOS_H=",
       "HAVE_UNISTD_H=",
-      "HAVE_ZLIB_H=",
       "HAVE__CHSIZE_S=1",
       "HAVE__UNWIND_BACKTRACE=",
       "stricmp=_stricmp",
@@ -240,7 +238,6 @@ write_cmake_config("config") {
       "HAVE_ISATTY=1",
       "HAVE_LIBPTHREAD=1",
       "HAVE_PTHREAD_SETNAME_NP=1",
-      "HAVE_LIBZ=1",
       "HAVE_PREAD=1",
       "HAVE_PTHREAD_GETSPECIFIC=1",
       "HAVE_PTHREAD_H=1",
@@ -259,7 +256,6 @@ write_cmake_config("config") {
       "HAVE_SYS_TIME_H=1",
       "HAVE_TERMIOS_H=1",
       "HAVE_UNISTD_H=1",
-      "HAVE_ZLIB_H=1",
       "HAVE__CHSIZE_S=",
       "HAVE__UNWIND_BACKTRACE=1",
       "stricmp=",
@@ -299,10 +295,20 @@ write_cmake_config("config") {
     values += [ "LLVM_ENABLE_DIA_SDK=" ]
   }
 
+  # FIXME: Once https://reviews.llvm.org/D79219 is in, remove the two
+  # redundant HAVE_ variables.
   if (llvm_enable_zlib) {
-    values += [ "LLVM_ENABLE_ZLIB=1" ]
+    values += [
+      "HAVE_LIBZ=1",
+      "HAVE_ZLIB_H=1",
+      "LLVM_ENABLE_ZLIB=1",
+    ]
   } else {
-    values += [ "LLVM_ENABLE_ZLIB=" ]
+    values += [
+      "HAVE_LIBZ=",
+      "HAVE_ZLIB_H=",
+      "LLVM_ENABLE_ZLIB=",
+    ]
   }
 
   if (llvm_enable_libxml2) {


        


More information about the llvm-commits mailing list