configure/makefile To support updating zlib to 1.2.11. (mono/mono#15697)
authorJay Krell <jaykrell@microsoft.com>
Wed, 17 Jul 2019 19:07:56 +0000 (12:07 -0700)
committerRyan Lucia <rylucia@microsoft.com>
Wed, 17 Jul 2019 19:07:56 +0000 (12:07 -0700)
Commit migrated from https://github.com/mono/mono/commit/b08aa719484455c33553ae52394bb48840d653f5

src/mono/configure.ac
src/mono/mono/metadata/Makefile.am

index 6cbd91b..785fc87 100644 (file)
@@ -299,6 +299,12 @@ case "$host" in
                CFLAGS="$CFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
                CXXFLAGS="$CXXFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
 
+               # FIXME? Only if __ANDROID_API__ < 24?
+               # FILE32API means "long", which is stuck at 32bits for 32bit ABI (64bits for 64bit ABI).
+               # ABI 24 introduces the "o" for "file offset" variations, which can be widened to 64bits for 32bit ABI (and still 64bits for 64bit).
+               # Android itself uses FILE32API, and mono should use system zlib on Android anyway.
+               ZLIB_CFLAGS="$ZLIB_CFLAGS -DUSE_FILE32API"
+
                # to bypass the underscore linker check, can't work when cross-compiling
                mono_cv_uscore=yes
                mono_cv_clang=no
@@ -670,8 +676,16 @@ AC_PROG_LD_GNU
 
 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h sys/prctl.h copyfile.h)
 AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h complex.h unwind.h)
-AC_CHECK_HEADER(unistd.h, [HAVE_UNISTD_H=1], [HAVE_UNISTD_H=0])
+
+# zlib/configure checks for unistd.h existance and defines HAVE_UNISTD_H on the compiler
+# command line (not config.h) if it is present.
+AC_CHECK_HEADER(unistd.h,
+    [HAVE_UNISTD_H=1
+     ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_UNISTD_H"],
+    [HAVE_UNISTD_H=0])
+
 AC_SUBST(HAVE_UNISTD_H)
+
 AC_CHECK_HEADERS([linux/netlink.h linux/rtnetlink.h],
                   [], [], [#include <stddef.h>
                  #include <sys/socket.h>
@@ -4857,8 +4871,11 @@ else
   AC_DEFINE_UNQUOTED(SIZEOF_REGISTER,${target_sizeof_void_p},[size of target machine integer registers])
 fi
 
+# zlib/configure detects visibility support similarly and defines HAVE_HIDDEN
+# on the compiler command line (not config.h).
 if test "x$have_visibility_hidden" = "xyes"; then
    AC_DEFINE(HAVE_VISIBILITY_HIDDEN, 1, [Support for the visibility ("hidden") attribute])
+   ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_HIDDEN"
 fi
 
 if test "x$have_deprecated" = "xyes"; then
@@ -6591,9 +6608,26 @@ if test x"$GCC" = xyes; then
        JAY_CFLAGS="-Wno-implicit-function-declaration"
 fi
 
+# zlib/configure checks if this program compiles and if so
+# defines _LARGEFILE64_SOURCE on the compiler command line (not config.h).
+#
+AC_MSG_CHECKING([for large file support])
+AC_COMPILE_IFELSE(
+       [
+               #include <sys/types.h>
+               off64_t dummy = 0;
+       ], [
+               AC_MSG_RESULT(yes)
+               # FIXME The ramifications of _LARGEFILE64_SOURCE are not understood.
+               # ZLIB_CFLAGS="$ZLIB_CFLAGS -D_LARGEFILE64_SOURCE=1"
+       ], [
+               AC_MSG_RESULT(no)
+       ])
+
 AC_SUBST(CFLAGS)
 AC_SUBST(CPPFLAGS)
 AC_SUBST(LDFLAGS)
+AC_SUBST(ZLIB_CFLAGS)
 
 # Update all submodules recursively to ensure everything is checked out
 if test "x$with_core" != "xonly"; then
index 5e1d28d..00621d7 100644 (file)
@@ -164,7 +164,7 @@ libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\"
 # Support is a separate library because it is not valid C++.
 #
 libmonoruntime_support_la_SOURCES = $(support_sources)
-libmonoruntime_support_la_CFLAGS = $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@)
+libmonoruntime_support_la_CFLAGS = $(filter-out @CXX_REMOVE_CFLAGS@, @CFLAGS@) @ZLIB_CFLAGS@
 if HAVE_STATIC_ZLIB
 libmonoruntime_support_la_LDFLAGS = $(STATIC_ZLIB_PATH)
 else