Skip to content

Commit

Permalink
Sets -Wno-error=address-of-packed-member built with GCC9
Browse files Browse the repository at this point in the history
See also frugalos#10.
  • Loading branch information
shinnya committed Jul 27, 2019
1 parent 199c96e commit ad00d6e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
8 changes: 3 additions & 5 deletions install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ cd ../
git clone https://github.com/openstack/liberasurecode.git
cd liberasurecode/
git checkout 1.5.0
if [ "$(uname)" == "Darwin" ]; then
# if the compiler has the feature to check `address-of-packed-member`, we suppress it.
# it is only annoying for liberasurecode v1.5.0.
patch -p1 < ../for_darwin_to_detect_compiler_flag.patch
fi
# if the compiler has the feature to check `address-of-packed-member`, we suppress it.
# it is only annoying for liberasurecode v1.5.0.
patch -p1 < ../jerasure.patch
./autogen.sh
CFLAGS="-I${BUILD_DIR}/jerasure/include -I${BUILD_DIR}/include"
CFLAGS=$CFLAGS LIBS="-lJerasure" LDFLAGS="-L${BUILD_DIR}/lib" ./configure --disable-shared --with-pic --prefix $BUILD_DIR
Expand Down
23 changes: 23 additions & 0 deletions jerasure.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- a/configure.ac 2019-04-19 16:27:52.000000000 +0900
+++ b/configure.ac 2019-04-19 16:26:06.000000000 +0900
@@ -39,6 +39,20 @@ AC_PROG_LN_S
dnl Compiling with per-target flags requires AM_PROG_CC_C_O.
AC_PROG_CC
AM_PROG_CC_C_O
+
+# Check if a compiler supports "-Wno-error=address-of-packed-member"
+# If it supports the option, we add it to CFLAGS.
+ac_save_CFLAGS="$CFLAGS"
+AC_LANG_PUSH([C])
+CFLAGS="-Wno-error=address-of-packed-member"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[]])],
+[ac_c_recognize_address_of_packed_member=1],
+[ac_c_recognize_address_of_packed_member=0])
+AC_LANG_POP([C])
+AS_IF([test $ac_c_recognize_address_of_packed_member -eq 1],
+[CFLAGS="$ac_save_CFLAGS -Wno-error=address-of-packed-member"],
+[CFLAGS="$ac_save_CFLAGS"])
+
AC_PROG_LIBTOOL
AC_PROG_CXX
AC_PROG_INSTALL

0 comments on commit ad00d6e

Please sign in to comment.