Skip to content

Commit

Permalink
Configure enable -Wcast-align=strict when supported by compiler (soni…
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored Dec 16, 2020
1 parent 025a32c commit a77909d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ CFLAGS_COMMON+=" -ansi"
CFLAGS_COMMON+=" -fPIC"
CFLAGS_COMMON+=" -std=c++11"
CFLAGS_COMMON+=" -Wall"
CFLAGS_COMMON+=" -Wcast-align=strict"
CFLAGS_COMMON+=" -Wcast-align"
CFLAGS_COMMON+=" -Wcast-qual"
CFLAGS_COMMON+=" -Wconversion"
CFLAGS_COMMON+=" -Wdisabled-optimization"
Expand Down Expand Up @@ -119,6 +119,15 @@ CFLAGS_COMMON+=" -Wwrite-strings"
CFLAGS_COMMON+=" -Wno-switch-default"
CFLAGS_COMMON+=" -Wconversion"

SAVED_FLAGS="$CXXFLAGS"
CXXFLAGS="-Wcast-align=strict"
AC_MSG_CHECKING([whether CXX supports -Wcast-align=strict])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])]
[AC_SUBST([CFLAGS_COMMON], ["${CFLAGS_COMMON} -Wcast-align=strict"])],
[AC_MSG_RESULT([no])])
CXXFLAGS="$SAVED_FLAGS"

AC_SUBST(CFLAGS_COMMON)

AC_OUTPUT(Makefile
Expand Down

0 comments on commit a77909d

Please sign in to comment.