gollvm: adapt cmake rules to handle libgo loff_t changes
Minor tweaks to the cmake rules to adapt to the gofrontend CL 413214;
we need to check for the presence of the "loff_t" type and define the
appropriate preprocessor symbols for sysinfo.c.
Change-Id: Ic3e5adad4b89eaef321620b4772d73666f99af78
Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/420216
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/cmake/modules/ConfigSetup.cmake b/cmake/modules/ConfigSetup.cmake
index 266e3a3..3d4cf5f 100644
--- a/cmake/modules/ConfigSetup.cmake
+++ b/cmake/modules/ConfigSetup.cmake
@@ -64,6 +64,7 @@
check_symbol_exists(strsignal "string.h" HAVE_STRSIGNAL)
# Checks for include files
+check_include_file(fcntl.h HAVE_FCNTL_H)
check_include_file(dlfcn.h HAVE_DLFCN_H)
check_include_file(inttypes.h HAVE_INTTYPES_H)
check_include_file(link.h HAVE_LINK_H)
@@ -119,6 +120,9 @@
check_type_size("long double" HAVE_LONG_DOUBLE)
check_type_size("long double" SIZEOF_LONG_DOUBLE)
check_type_size("void*" SIZEOF_VOID_P)
+set(CMAKE_EXTRA_INCLUDE_FILES fcntl.h)
+check_type_size("loff_t" HAVE_LOFF_T)
+set(CMAKE_EXTRA_INCLUDE_FILES)
# Check for various include files
check_include_file(alloca.h HAVE_ALLOCA_H)
diff --git a/libgo/config.h.cmake b/libgo/config.h.cmake
index 150937e..2ec9bd2 100644
--- a/libgo/config.h.cmake
+++ b/libgo/config.h.cmake
@@ -5,6 +5,7 @@
#include "llvm/Config/config.h"
/* Header files */
+#cmakedefine HAVE_FCNTL_H
#cmakedefine HAVE_LINUX_ETHER_H
#cmakedefine HAVE_LINUX_FILTER_H
#cmakedefine HAVE_LINUX_FS_H
@@ -162,4 +163,7 @@
/* Define to 1 if you have the `strsignal' function. */
#cmakedefine HAVE_STRSIGNAL 1
+/* Define to 1 if you have the `loff_t` type. */
+#cmakedefine HAVE_LOFF_T
+
#endif