]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
FreeBSD: clang compiler related changes to configure.ac
authorOliver Kurth <okurth@vmware.com>
Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)
committerOliver Kurth <okurth@vmware.com>
Tue, 19 Jun 2018 18:07:45 +0000 (11:07 -0700)
On FreeBSD, the unwind.h header is available in the libunwind
package (/usr/ports/devel/libunwind) which may or may not be installed
on a system.  The libunwind functions to determine the call-chain in a
program are defined only if " __GNU_SOURCE" is defined to enable "all"
GCC extensions.  Avoid the unwind.h header if seen on FreeBSD.

The "clang" compiler will issue warnings if the address of a member
of a packed structure is taken.  Since warnings are errors with -Wall,
add --Wno-address-of-packed-member to CFLAGS when compiling with
"clang".

open-vm-tools/configure.ac

index 9dfda10d16faec2572fa943a29a398025664d941..a04a3bebeb6717ee5b1f40038255889a983cf303 100644 (file)
@@ -1164,6 +1164,13 @@ AC_CHECK_HEADERS([sys/user.h],
    ])
 AC_CHECK_HEADERS([sys/vfs.h])
 AC_CHECK_HEADERS([syslimits.h])
+
+# On Freebsd, the unwind.h header file is available in the libunwind
+# package, but the necessary functions are only available if __GNU_SOURCE
+# is defined to enable "all" GCC extensions.
+if test "$os" = "freebsd"; then
+   ac_cv_header_unwind_h="no"
+fi
 AC_CHECK_HEADERS([unwind.h])
 
 AC_CHECK_HEADER(
@@ -1213,6 +1220,12 @@ AC_C_VOLATILE
 CFLAGS="$CFLAGS -Wall"
 CFLAGS="$CFLAGS -Werror"
 
+# Suppress warnings from clang when taking the address of packed struct
+# member fields when compiling hgfsServer.c
+if $CC --version | $GREP -i "clang" > /dev/null; then
+   CFLAGS="$CFLAGS -Wno-address-of-packed-member"
+fi
+
 # -Wno-unknown-pragmas is due to gcc not understanding '#pragma ident'
 # in Xlib.h on OpenSolaris.
 # Glib2 keep changing mutex APIs so we also need to disable 'deprecated'