configure.ac: add m4 macros that can check for compiler option support

We now use this to set certain options, if supported by the compilers
(C/C++).  Currently we enable various options, like
-Wno-format-truncation.  We use this to ignore complaints about
possibly truncations due to the use of the snprintf() family of
functions - where forced truncation is the whole point.
This commit is contained in:
Jon Trulson
2021-11-16 12:27:45 -07:00
parent 4b3901f63b
commit 3021e01559
2 changed files with 54 additions and 2 deletions

View File

@@ -77,8 +77,6 @@ case "${host_os}" in
OSMINORVERSION=15
SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -D_POSIX_SOURCE \
-D_DEFAULT_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE"
CPP_COMPILER_FLAGS="-fno-strict-aliasing -Wno-write-strings \
-Wno-unused-result"
;;
freebsd*)
build_freebsd=yes
@@ -306,6 +304,20 @@ AC_PROG_CC_C99
AC_PATH_X
AC_PATH_XTRA
dnl check some compiler flags
C_FLAG_CHECK([-Wno-format-truncation])
CXX_FLAG_CHECK([-Wno-format-truncation])
C_FLAG_CHECK([-fno-strict-aliasing])
CXX_FLAG_CHECK([-fno-strict-aliasing])
C_FLAG_CHECK([-Wno-write-strings])
CXX_FLAG_CHECK([-Wno-write-strings])
C_FLAG_CHECK([-Wno-unused-result])
CXX_FLAG_CHECK([-Wno-unused-result])
dnl Add X11 goodies here
EXTRA_LIBS="${X_LIBS} ${EXTRA_LIBS}"
EXTRA_INCS="${X_CFLAGS} ${EXTRA_INCS}"